|
|
|
|
@ -1,11 +1,12 @@
|
|
|
|
|
require "rails_helper" |
|
|
|
|
|
|
|
|
|
RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model do |
|
|
|
|
subject(:question) { described_class.new(question_id, question_definition, page) } |
|
|
|
|
subject(:question) { described_class.new(question_id, question_definition, page, person_index:) } |
|
|
|
|
|
|
|
|
|
let(:question_id) { "relat2" } |
|
|
|
|
let(:question_definition) { nil } |
|
|
|
|
let(:page) { instance_double(Form::Page) } |
|
|
|
|
let(:person_index) { 2 } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(page).to receive(:id).and_return("person_1_relationship_to_buyer_1") |
|
|
|
|
@ -29,16 +30,17 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
|
|
|
|
|
it "has the correct answer_options" do |
|
|
|
|
expect(question.answer_options).to eq({ |
|
|
|
|
"P" => { "value" => "Partner" }, |
|
|
|
|
"C" => { "value" => "Child", "hint" => "Must be eligible for child benefit, aged under 16 or under 20 if still in full-time education." }, |
|
|
|
|
"X" => { "value" => "Other" }, |
|
|
|
|
"R" => { "value" => "Person prefers not to say" }, |
|
|
|
|
}) |
|
|
|
|
"P" => { "value" => "Partner" }, |
|
|
|
|
"C" => { "value" => "Child", "hint" => "Must be eligible for child benefit, aged under 16 or under 20 if still in full-time education." }, |
|
|
|
|
"X" => { "value" => "Other" }, |
|
|
|
|
"R" => { "value" => "Person prefers not to say" }, |
|
|
|
|
}) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when person 1" do |
|
|
|
|
context "and not joint purchase" do |
|
|
|
|
let(:question_id) { "relat2" } |
|
|
|
|
let(:person_index) { 2 } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(page).to receive(:id).and_return("person_1_relationship_to_buyer_1") |
|
|
|
|
@ -49,11 +51,11 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct header" do |
|
|
|
|
expect(question.header).to eq("What is Person 1’s relationship to buyer 1?") |
|
|
|
|
expect(question.header).to eq("What is Person 1’s relationship to Buyer 1?") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct check_answer_label" do |
|
|
|
|
expect(question.check_answer_label).to eq("Person 1’s relationship to buyer 1") |
|
|
|
|
expect(question.check_answer_label).to eq("Person 1’s relationship to Buyer 1") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has expected check answers card number" do |
|
|
|
|
@ -62,6 +64,7 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "and joint purchase" do |
|
|
|
|
let(:person_index) { 3 } |
|
|
|
|
let(:question_id) { "relat3" } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
@ -73,11 +76,11 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct header" do |
|
|
|
|
expect(question.header).to eq("What is Person 1’s relationship to buyer 1?") |
|
|
|
|
expect(question.header).to eq("What is Person 1’s relationship to Buyer 1?") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct check_answer_label" do |
|
|
|
|
expect(question.check_answer_label).to eq("Person 1’s relationship to buyer 1") |
|
|
|
|
expect(question.check_answer_label).to eq("Person 1’s relationship to Buyer 1") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has expected check answers card number" do |
|
|
|
|
@ -89,6 +92,7 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
context "when person 2" do |
|
|
|
|
context "and not joint purchase" do |
|
|
|
|
let(:question_id) { "relat3" } |
|
|
|
|
let(:person_index) { 3 } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(page).to receive(:id).and_return("person_2_relationship_to_buyer_1") |
|
|
|
|
@ -99,11 +103,11 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct header" do |
|
|
|
|
expect(question.header).to eq("What is Person 2’s relationship to buyer 1?") |
|
|
|
|
expect(question.header).to eq("What is Person 2’s relationship to Buyer 1?") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct check_answer_label" do |
|
|
|
|
expect(question.check_answer_label).to eq("Person 2’s relationship to buyer 1") |
|
|
|
|
expect(question.check_answer_label).to eq("Person 2’s relationship to Buyer 1") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has expected check answers card number" do |
|
|
|
|
@ -113,6 +117,7 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
|
|
|
|
|
context "and joint purchase" do |
|
|
|
|
let(:question_id) { "relat4" } |
|
|
|
|
let(:person_index) { 4 } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(page).to receive(:id).and_return("person_2_relationship_to_buyer_1_joint_purchase") |
|
|
|
|
@ -123,11 +128,11 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct header" do |
|
|
|
|
expect(question.header).to eq("What is Person 2’s relationship to buyer 1?") |
|
|
|
|
expect(question.header).to eq("What is Person 2’s relationship to Buyer 1?") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct check_answer_label" do |
|
|
|
|
expect(question.check_answer_label).to eq("Person 2’s relationship to buyer 1") |
|
|
|
|
expect(question.check_answer_label).to eq("Person 2’s relationship to Buyer 1") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has expected check answers card number" do |
|
|
|
|
@ -139,6 +144,7 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
context "when person 3" do |
|
|
|
|
context "and not joint purchase" do |
|
|
|
|
let(:question_id) { "relat4" } |
|
|
|
|
let(:person_index) { 4 } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(page).to receive(:id).and_return("person_3_relationship_to_buyer_1") |
|
|
|
|
@ -149,11 +155,11 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct header" do |
|
|
|
|
expect(question.header).to eq("What is Person 3’s relationship to buyer 1?") |
|
|
|
|
expect(question.header).to eq("What is Person 3’s relationship to Buyer 1?") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct check_answer_label" do |
|
|
|
|
expect(question.check_answer_label).to eq("Person 3’s relationship to buyer 1") |
|
|
|
|
expect(question.check_answer_label).to eq("Person 3’s relationship to Buyer 1") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has expected check answers card number" do |
|
|
|
|
@ -163,6 +169,7 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
|
|
|
|
|
context "and joint purchase" do |
|
|
|
|
let(:question_id) { "relat5" } |
|
|
|
|
let(:person_index) { 5 } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(page).to receive(:id).and_return("person_3_relationship_to_buyer_1_joint_purchase") |
|
|
|
|
@ -173,11 +180,11 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct header" do |
|
|
|
|
expect(question.header).to eq("What is Person 3’s relationship to buyer 1?") |
|
|
|
|
expect(question.header).to eq("What is Person 3’s relationship to Buyer 1?") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct check_answer_label" do |
|
|
|
|
expect(question.check_answer_label).to eq("Person 3’s relationship to buyer 1") |
|
|
|
|
expect(question.check_answer_label).to eq("Person 3’s relationship to Buyer 1") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has expected check answers card number" do |
|
|
|
|
@ -189,6 +196,7 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
context "when person 4" do |
|
|
|
|
context "and not joint purchase" do |
|
|
|
|
let(:question_id) { "relat5" } |
|
|
|
|
let(:person_index) { 5 } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(page).to receive(:id).and_return("person_4_relationship_to_buyer_1") |
|
|
|
|
@ -199,11 +207,11 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct header" do |
|
|
|
|
expect(question.header).to eq("What is Person 4’s relationship to buyer 1?") |
|
|
|
|
expect(question.header).to eq("What is Person 4’s relationship to Buyer 1?") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct check_answer_label" do |
|
|
|
|
expect(question.check_answer_label).to eq("Person 4’s relationship to buyer 1") |
|
|
|
|
expect(question.check_answer_label).to eq("Person 4’s relationship to Buyer 1") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has expected check answers card number" do |
|
|
|
|
@ -213,6 +221,7 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
|
|
|
|
|
context "and joint purchase" do |
|
|
|
|
let(:question_id) { "relat6" } |
|
|
|
|
let(:person_index) { 6 } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(page).to receive(:id).and_return("person_4_relationship_to_buyer_1_joint_purchase") |
|
|
|
|
@ -223,11 +232,11 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct header" do |
|
|
|
|
expect(question.header).to eq("What is Person 4’s relationship to buyer 1?") |
|
|
|
|
expect(question.header).to eq("What is Person 4’s relationship to Buyer 1?") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has the correct check_answer_label" do |
|
|
|
|
expect(question.check_answer_label).to eq("Person 4’s relationship to buyer 1") |
|
|
|
|
expect(question.check_answer_label).to eq("Person 4’s relationship to Buyer 1") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "has expected check answers card number" do |
|
|
|
|
|