45 changed files with 988 additions and 63 deletions
@ -0,0 +1,21 @@
|
||||
class Form::Sales::Pages::Buyer1GenderSameAsSex < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "buyer_1_gender_same_as_sex" |
||||
@depends_on = [ |
||||
{ |
||||
"buyer_has_seen_privacy_notice?" => true, |
||||
}, |
||||
{ |
||||
"buyer_not_interviewed?" => true, |
||||
}, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::GenderSameAsSex.new(nil, nil, self, person_index: 1, buyer: true), |
||||
Form::Sales::Questions::GenderDescription.new(nil, nil, self, person_index: 1), |
||||
] |
||||
end |
||||
end |
||||
@ -0,0 +1,23 @@
|
||||
class Form::Sales::Pages::Buyer2GenderSameAsSex < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "buyer_2_gender_same_as_sex" |
||||
@depends_on = [ |
||||
{ |
||||
"joint_purchase?" => true, |
||||
"buyer_has_seen_privacy_notice?" => true, |
||||
}, |
||||
{ |
||||
"joint_purchase?" => true, |
||||
"buyer_not_interviewed?" => true, |
||||
}, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::GenderSameAsSex.new(nil, nil, self, person_index: 2, buyer: true), |
||||
Form::Sales::Questions::GenderDescription.new(nil, nil, self, person_index: 2), |
||||
] |
||||
end |
||||
end |
||||
@ -0,0 +1,16 @@
|
||||
class Form::Sales::Pages::PersonGenderSameAsSex < ::Form::Page |
||||
def initialize(id, hsh, subsection, person_index:) |
||||
super(id, hsh, subsection) |
||||
@person_index = person_index |
||||
@depends_on = [ |
||||
{ "details_known_#{person_index}" => 1 }, |
||||
] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [ |
||||
Form::Sales::Questions::GenderSameAsSex.new(nil, nil, self, person_index: @person_index), |
||||
Form::Sales::Questions::GenderDescription.new(nil, nil, self, person_index: @person_index), |
||||
] |
||||
end |
||||
end |
||||
@ -0,0 +1,16 @@
|
||||
class Form::Sales::Questions::GenderDescription < ::Form::Question |
||||
def initialize(id, hsh, page, person_index:) |
||||
super(id, hsh, page) |
||||
@id = "gender_description#{person_index}" |
||||
@type = "text" |
||||
@check_answers_card_number = person_index |
||||
@person_index = person_index |
||||
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] |
||||
end |
||||
|
||||
QUESTION_NUMBER_FROM_YEAR = { 2026 => 0 }.freeze |
||||
|
||||
def derived?(log) |
||||
log.public_send("gender_same_as_sex#{@person_index}") != 2 |
||||
end |
||||
end |
||||
@ -0,0 +1,33 @@
|
||||
class Form::Sales::Questions::GenderSameAsSex < ::Form::Question |
||||
def initialize(id, hsh, page, person_index:, buyer: false) |
||||
super(id, hsh, page) |
||||
@id = "gender_same_as_sex#{person_index}" |
||||
@type = "radio" |
||||
@check_answers_card_number = person_index |
||||
@conditional_for = { "gender_description#{person_index}" => [2] } |
||||
@inferred_check_answers_value = [{ "condition" => { "gender_same_as_sex#{person_index}" => 2 }, "value" => "No" }] |
||||
@person_index = person_index |
||||
@buyer = buyer |
||||
@copy_key = "sales.household_characteristics.gender_same_as_sex#{person_index}.#{buyer ? 'buyer' : 'person'}" if person_index == 2 |
||||
@question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] |
||||
end |
||||
|
||||
QUESTION_NUMBER_FROM_YEAR = { 2026 => 0 }.freeze |
||||
|
||||
def answer_options |
||||
{ |
||||
"1" => { "value" => "Yes" }, |
||||
"2" => { "value" => "No, enter gender identity" }, |
||||
"divider" => { "value" => true }, |
||||
"3" => { "value" => "#{@buyer ? 'Buyer' : 'Person'} prefers not to say" }, |
||||
}.freeze |
||||
end |
||||
|
||||
def label_from_value(value, _log = nil, _user = nil) |
||||
return unless value |
||||
|
||||
return "Prefers not to say" if value == 3 |
||||
|
||||
super |
||||
end |
||||
end |
||||
@ -1,3 +1,3 @@
|
||||
<div class="govuk-button-group"> |
||||
<%= govuk_link_to "Clear address and search instead", address_search_input_path(@log.log_type, @log.id), class: "govuk-button govuk-button--secondary" %> |
||||
<%= govuk_link_to "Clear address and search by UPRN instead", address_search_input_path(@log.log_type, @log.id), class: "govuk-button govuk-button--secondary" %> |
||||
</div> |
||||
|
||||
@ -0,0 +1,18 @@
|
||||
class AddGenderSameAsSexFieldsToSalesLogs < ActiveRecord::Migration[7.0] |
||||
def change |
||||
change_table :sales_logs, bulk: true do |t| |
||||
t.integer :gender_same_as_sex1 |
||||
t.integer :gender_same_as_sex2 |
||||
t.integer :gender_same_as_sex3 |
||||
t.integer :gender_same_as_sex4 |
||||
t.integer :gender_same_as_sex5 |
||||
t.integer :gender_same_as_sex6 |
||||
t.string :gender_description1 |
||||
t.string :gender_description2 |
||||
t.string :gender_description3 |
||||
t.string :gender_description4 |
||||
t.string :gender_description5 |
||||
t.string :gender_description6 |
||||
end |
||||
end |
||||
end |
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,31 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::Buyer1GenderSameAsSex, type: :model do |
||||
include CollectionTimeHelper |
||||
|
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
||||
let(:page_definition) { nil } |
||||
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: current_collection_start_date)) } |
||||
|
||||
it "has correct subsection" do |
||||
expect(page.subsection).to eq(subsection) |
||||
end |
||||
|
||||
it "has correct questions" do |
||||
expect(page.questions.map(&:id)).to eq(%w[gender_same_as_sex1 gender_description1]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("buyer_1_gender_same_as_sex") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to be_nil |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq([{ "buyer_has_seen_privacy_notice?" => true }, { "buyer_not_interviewed?" => true }]) |
||||
end |
||||
end |
||||
@ -0,0 +1,40 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::Buyer2GenderSameAsSex, type: :model do |
||||
include CollectionTimeHelper |
||||
|
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
||||
let(:page_definition) { nil } |
||||
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: current_collection_start_date)) } |
||||
|
||||
it "has correct subsection" do |
||||
expect(page.subsection).to eq(subsection) |
||||
end |
||||
|
||||
it "has correct questions" do |
||||
expect(page.questions.map(&:id)).to eq(%w[gender_same_as_sex2 gender_description2]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("buyer_2_gender_same_as_sex") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to be_nil |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq([ |
||||
{ |
||||
"joint_purchase?" => true, |
||||
"buyer_has_seen_privacy_notice?" => true, |
||||
}, |
||||
{ |
||||
"joint_purchase?" => true, |
||||
"buyer_not_interviewed?" => true, |
||||
}, |
||||
]) |
||||
end |
||||
end |
||||
@ -0,0 +1,105 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Pages::PersonGenderSameAsSex, type: :model do |
||||
include CollectionTimeHelper |
||||
|
||||
subject(:page) { described_class.new(page_id, page_definition, subsection, person_index:) } |
||||
|
||||
let(:page_definition) { nil } |
||||
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: current_collection_start_date)) } |
||||
let(:person_index) { 2 } |
||||
let(:page_id) { "person_2_gender_same_as_sex" } |
||||
|
||||
it "has correct subsection" do |
||||
expect(page.subsection).to eq(subsection) |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to be_nil |
||||
end |
||||
|
||||
context "with person 2" do |
||||
let(:person_index) { 2 } |
||||
let(:page_id) { "person_2_gender_same_as_sex" } |
||||
|
||||
it "has correct questions" do |
||||
expect(page.questions.map(&:id)).to eq(%w[gender_same_as_sex2 gender_description2]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("person_2_gender_same_as_sex") |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq([{ "details_known_2" => 1 }]) |
||||
end |
||||
end |
||||
|
||||
context "with person 3" do |
||||
let(:person_index) { 3 } |
||||
let(:page_id) { "person_3_gender_same_as_sex" } |
||||
|
||||
it "has correct questions" do |
||||
expect(page.questions.map(&:id)).to eq(%w[gender_same_as_sex3 gender_description3]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("person_3_gender_same_as_sex") |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq([{ "details_known_3" => 1 }]) |
||||
end |
||||
end |
||||
|
||||
context "with person 4" do |
||||
let(:person_index) { 4 } |
||||
let(:page_id) { "person_4_gender_same_as_sex" } |
||||
|
||||
it "has correct questions" do |
||||
expect(page.questions.map(&:id)).to eq(%w[gender_same_as_sex4 gender_description4]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("person_4_gender_same_as_sex") |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq([{ "details_known_4" => 1 }]) |
||||
end |
||||
end |
||||
|
||||
context "with person 5" do |
||||
let(:person_index) { 5 } |
||||
let(:page_id) { "person_5_gender_same_as_sex" } |
||||
|
||||
it "has correct questions" do |
||||
expect(page.questions.map(&:id)).to eq(%w[gender_same_as_sex5 gender_description5]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("person_5_gender_same_as_sex") |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq([{ "details_known_5" => 1 }]) |
||||
end |
||||
end |
||||
|
||||
context "with person 6" do |
||||
let(:person_index) { 6 } |
||||
let(:page_id) { "person_6_gender_same_as_sex" } |
||||
|
||||
it "has correct questions" do |
||||
expect(page.questions.map(&:id)).to eq(%w[gender_same_as_sex6 gender_description6]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("person_6_gender_same_as_sex") |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq([{ "details_known_6" => 1 }]) |
||||
end |
||||
end |
||||
end |
||||
@ -0,0 +1,163 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::GenderDescription, type: :model do |
||||
include CollectionTimeHelper |
||||
|
||||
subject(:question) { described_class.new(question_id, question_definition, page, person_index:) } |
||||
|
||||
let(:question_id) { nil } |
||||
let(:question_definition) { nil } |
||||
let(:page) { instance_double(Form::Page) } |
||||
let(:person_index) { 2 } |
||||
let(:subsection) { instance_double(Form::Subsection) } |
||||
let(:form) { instance_double(Form, start_date: current_collection_start_date) } |
||||
|
||||
before do |
||||
allow(page).to receive(:subsection).and_return(subsection) |
||||
allow(subsection).to receive(:form).and_return(form) |
||||
end |
||||
|
||||
it "has correct page" do |
||||
expect(question.page).to eq(page) |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("text") |
||||
end |
||||
|
||||
context "when person 1" do |
||||
let(:person_index) { 1 } |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("gender_description1") |
||||
end |
||||
|
||||
it "has expected check answers card number" do |
||||
expect(question.check_answers_card_number).to eq(1) |
||||
end |
||||
|
||||
it "has the correct inferred_check_answers_value" do |
||||
expect(question.inferred_check_answers_value).to be_nil |
||||
end |
||||
|
||||
context "when gender_same_as_sex1 is 'Yes'" do |
||||
let(:log) { build(:sales_log, gender_same_as_sex1: 1) } |
||||
|
||||
it "is marked as derived" do |
||||
expect(question.derived?(log)).to be true |
||||
end |
||||
end |
||||
|
||||
context "when gender_same_as_sex1 is 'No'" do |
||||
let(:log) { build(:sales_log, gender_same_as_sex1: 2) } |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?(log)).to be false |
||||
end |
||||
end |
||||
|
||||
context "when gender_same_as_sex1 is 'Prefers not to say'" do |
||||
let(:log) { build(:sales_log, gender_same_as_sex1: 3) } |
||||
|
||||
it "is marked as derived" do |
||||
expect(question.derived?(log)).to be true |
||||
end |
||||
end |
||||
end |
||||
|
||||
context "when person 2" do |
||||
let(:person_index) { 2 } |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("gender_description2") |
||||
end |
||||
|
||||
it "has expected check answers card number" do |
||||
expect(question.check_answers_card_number).to eq(2) |
||||
end |
||||
|
||||
it "has the correct inferred_check_answers_value" do |
||||
expect(question.inferred_check_answers_value).to be_nil |
||||
end |
||||
|
||||
context "when gender_same_as_sex2 is 'Yes'" do |
||||
let(:log) { build(:sales_log, gender_same_as_sex2: 1) } |
||||
|
||||
it "is marked as derived" do |
||||
expect(question.derived?(log)).to be true |
||||
end |
||||
end |
||||
|
||||
context "when gender_same_as_sex2 is 'No'" do |
||||
let(:log) { build(:sales_log, gender_same_as_sex2: 2) } |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?(log)).to be false |
||||
end |
||||
end |
||||
end |
||||
|
||||
context "when person 3" do |
||||
let(:person_index) { 3 } |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("gender_description3") |
||||
end |
||||
|
||||
it "has expected check answers card number" do |
||||
expect(question.check_answers_card_number).to eq(3) |
||||
end |
||||
|
||||
it "has the correct inferred_check_answers_value" do |
||||
expect(question.inferred_check_answers_value).to be_nil |
||||
end |
||||
end |
||||
|
||||
context "when person 4" do |
||||
let(:person_index) { 4 } |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("gender_description4") |
||||
end |
||||
|
||||
it "has expected check answers card number" do |
||||
expect(question.check_answers_card_number).to eq(4) |
||||
end |
||||
|
||||
it "has the correct inferred_check_answers_value" do |
||||
expect(question.inferred_check_answers_value).to be_nil |
||||
end |
||||
end |
||||
|
||||
context "when person 5" do |
||||
let(:person_index) { 5 } |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("gender_description5") |
||||
end |
||||
|
||||
it "has expected check answers card number" do |
||||
expect(question.check_answers_card_number).to eq(5) |
||||
end |
||||
|
||||
it "has the correct inferred_check_answers_value" do |
||||
expect(question.inferred_check_answers_value).to be_nil |
||||
end |
||||
end |
||||
|
||||
context "when person 6" do |
||||
let(:person_index) { 6 } |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("gender_description6") |
||||
end |
||||
|
||||
it "has expected check answers card number" do |
||||
expect(question.check_answers_card_number).to eq(6) |
||||
end |
||||
|
||||
it "has the correct inferred_check_answers_value" do |
||||
expect(question.inferred_check_answers_value).to be_nil |
||||
end |
||||
end |
||||
end |
||||
@ -0,0 +1,189 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Questions::GenderSameAsSex, type: :model do |
||||
include CollectionTimeHelper |
||||
|
||||
subject(:question) { described_class.new(question_id, question_definition, page, person_index:) } |
||||
|
||||
let(:question_id) { nil } |
||||
let(:question_definition) { nil } |
||||
let(:page) { instance_double(Form::Page) } |
||||
let(:person_index) { 2 } |
||||
let(:subsection) { instance_double(Form::Subsection) } |
||||
let(:form) { instance_double(Form, start_date: current_collection_start_date) } |
||||
|
||||
before do |
||||
allow(page).to receive(:subsection).and_return(subsection) |
||||
allow(subsection).to receive(:form).and_return(form) |
||||
end |
||||
|
||||
it "has correct page" do |
||||
expect(question.page).to eq(page) |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq("radio") |
||||
end |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?(nil)).to be false |
||||
end |
||||
|
||||
context "when buyer is false (default)" do |
||||
it "has the correct answer_options" do |
||||
expect(question.answer_options).to eq({ |
||||
"1" => { "value" => "Yes" }, |
||||
"2" => { "value" => "No, enter gender identity" }, |
||||
"divider" => { "value" => true }, |
||||
"3" => { "value" => "Person prefers not to say" }, |
||||
}) |
||||
end |
||||
end |
||||
|
||||
context "when buyer is true" do |
||||
subject(:question) { described_class.new(question_id, question_definition, page, person_index:, buyer: true) } |
||||
|
||||
it "has the correct answer_options" do |
||||
expect(question.answer_options).to eq({ |
||||
"1" => { "value" => "Yes" }, |
||||
"2" => { "value" => "No, enter gender identity" }, |
||||
"divider" => { "value" => true }, |
||||
"3" => { "value" => "Buyer prefers not to say" }, |
||||
}) |
||||
end |
||||
end |
||||
|
||||
it "returns correct label_from_value for 'Prefers not to say'" do |
||||
expect(question.label_from_value(3)).to eq("Prefers not to say") |
||||
end |
||||
|
||||
it "returns nil label_from_value for nil" do |
||||
expect(question.label_from_value(nil)).to be_nil |
||||
end |
||||
|
||||
context "when person 1 (buyer)" do |
||||
subject(:question) { described_class.new(question_id, question_definition, page, person_index: 1, buyer: true) } |
||||
|
||||
let(:person_index) { 1 } |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("gender_same_as_sex1") |
||||
end |
||||
|
||||
it "has expected check answers card number" do |
||||
expect(question.check_answers_card_number).to eq(1) |
||||
end |
||||
|
||||
it "has the correct conditional_for" do |
||||
expect(question.conditional_for).to eq({ "gender_description1" => [2] }) |
||||
end |
||||
|
||||
it "has the correct inferred_check_answers_value" do |
||||
expect(question.inferred_check_answers_value).to eq([{ "condition" => { "gender_same_as_sex1" => 2 }, "value" => "No" }]) |
||||
end |
||||
|
||||
it "has the correct answer_options with Buyer label" do |
||||
expect(question.answer_options["3"]).to eq({ "value" => "Buyer prefers not to say" }) |
||||
end |
||||
end |
||||
|
||||
context "when person 2" do |
||||
let(:person_index) { 2 } |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("gender_same_as_sex2") |
||||
end |
||||
|
||||
it "has expected check answers card number" do |
||||
expect(question.check_answers_card_number).to eq(2) |
||||
end |
||||
|
||||
it "has the correct conditional_for" do |
||||
expect(question.conditional_for).to eq({ "gender_description2" => [2] }) |
||||
end |
||||
|
||||
it "has the correct inferred_check_answers_value" do |
||||
expect(question.inferred_check_answers_value).to eq([{ "condition" => { "gender_same_as_sex2" => 2 }, "value" => "No" }]) |
||||
end |
||||
end |
||||
|
||||
context "when person 3" do |
||||
let(:person_index) { 3 } |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("gender_same_as_sex3") |
||||
end |
||||
|
||||
it "has expected check answers card number" do |
||||
expect(question.check_answers_card_number).to eq(3) |
||||
end |
||||
|
||||
it "has the correct conditional_for" do |
||||
expect(question.conditional_for).to eq({ "gender_description3" => [2] }) |
||||
end |
||||
|
||||
it "has the correct inferred_check_answers_value" do |
||||
expect(question.inferred_check_answers_value).to eq([{ "condition" => { "gender_same_as_sex3" => 2 }, "value" => "No" }]) |
||||
end |
||||
end |
||||
|
||||
context "when person 4" do |
||||
let(:person_index) { 4 } |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("gender_same_as_sex4") |
||||
end |
||||
|
||||
it "has expected check answers card number" do |
||||
expect(question.check_answers_card_number).to eq(4) |
||||
end |
||||
|
||||
it "has the correct conditional_for" do |
||||
expect(question.conditional_for).to eq({ "gender_description4" => [2] }) |
||||
end |
||||
|
||||
it "has the correct inferred_check_answers_value" do |
||||
expect(question.inferred_check_answers_value).to eq([{ "condition" => { "gender_same_as_sex4" => 2 }, "value" => "No" }]) |
||||
end |
||||
end |
||||
|
||||
context "when person 5" do |
||||
let(:person_index) { 5 } |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("gender_same_as_sex5") |
||||
end |
||||
|
||||
it "has expected check answers card number" do |
||||
expect(question.check_answers_card_number).to eq(5) |
||||
end |
||||
|
||||
it "has the correct conditional_for" do |
||||
expect(question.conditional_for).to eq({ "gender_description5" => [2] }) |
||||
end |
||||
|
||||
it "has the correct inferred_check_answers_value" do |
||||
expect(question.inferred_check_answers_value).to eq([{ "condition" => { "gender_same_as_sex5" => 2 }, "value" => "No" }]) |
||||
end |
||||
end |
||||
|
||||
context "when person 6" do |
||||
let(:person_index) { 6 } |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq("gender_same_as_sex6") |
||||
end |
||||
|
||||
it "has expected check answers card number" do |
||||
expect(question.check_answers_card_number).to eq(6) |
||||
end |
||||
|
||||
it "has the correct conditional_for" do |
||||
expect(question.conditional_for).to eq({ "gender_description6" => [2] }) |
||||
end |
||||
|
||||
it "has the correct inferred_check_answers_value" do |
||||
expect(question.inferred_check_answers_value).to eq([{ "condition" => { "gender_same_as_sex6" => 2 }, "value" => "No" }]) |
||||
end |
||||
end |
||||
end |
||||
Loading…
Reference in new issue