|
|
|
@ -1,11 +1,12 @@ |
|
|
|
require "rails_helper" |
|
|
|
require "rails_helper" |
|
|
|
|
|
|
|
|
|
|
|
RSpec.describe Form::Sales::Questions::StaircaseOwned, type: :model do |
|
|
|
RSpec.describe Form::Sales::Questions::StaircaseOwned, type: :model do |
|
|
|
subject(:question) { described_class.new(question_id, question_definition, page) } |
|
|
|
subject(:question) { described_class.new(question_id, question_definition, page, joint_purchase:) } |
|
|
|
|
|
|
|
|
|
|
|
let(:question_id) { nil } |
|
|
|
let(:question_id) { nil } |
|
|
|
let(:question_definition) { nil } |
|
|
|
let(:question_definition) { nil } |
|
|
|
let(:page) { instance_double(Form::Page) } |
|
|
|
let(:page) { instance_double(Form::Page) } |
|
|
|
|
|
|
|
let(:joint_purchase) { false } |
|
|
|
|
|
|
|
|
|
|
|
it "has correct page" do |
|
|
|
it "has correct page" do |
|
|
|
expect(question.page).to eq(page) |
|
|
|
expect(question.page).to eq(page) |
|
|
|
@ -15,6 +16,19 @@ RSpec.describe Form::Sales::Questions::StaircaseOwned, type: :model do |
|
|
|
expect(question.id).to eq("stairowned") |
|
|
|
expect(question.id).to eq("stairowned") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when a joint purchase" do |
|
|
|
|
|
|
|
let(:joint_purchase) { true } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "has the correct header" do |
|
|
|
|
|
|
|
expect(question.header).to eq("What percentage of the property do the buyers now own in total?") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "has the correct check_answer_label" do |
|
|
|
|
|
|
|
expect(question.check_answer_label).to eq("Percentage the buyers now own in total") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when not a joint purchase" do |
|
|
|
it "has the correct header" do |
|
|
|
it "has the correct header" do |
|
|
|
expect(question.header).to eq("What percentage of the property does the buyer now own in total?") |
|
|
|
expect(question.header).to eq("What percentage of the property does the buyer now own in total?") |
|
|
|
end |
|
|
|
end |
|
|
|
@ -22,6 +36,7 @@ RSpec.describe Form::Sales::Questions::StaircaseOwned, type: :model do |
|
|
|
it "has the correct check_answer_label" do |
|
|
|
it "has the correct check_answer_label" do |
|
|
|
expect(question.check_answer_label).to eq("Percentage the buyer now owns in total") |
|
|
|
expect(question.check_answer_label).to eq("Percentage the buyer now owns in total") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "has the correct type" do |
|
|
|
it "has the correct type" do |
|
|
|
expect(question.type).to eq("numeric") |
|
|
|
expect(question.type).to eq("numeric") |
|
|
|
|