|
|
|
@ -71,6 +71,28 @@ RSpec.describe Form::Question, type: :model do |
|
|
|
expect(question).not_to be_value_is_no("random", true) |
|
|
|
expect(question).not_to be_value_is_no("random", true) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when there are different value helper values for lettings and sales" do |
|
|
|
|
|
|
|
context "with a lettings log" do |
|
|
|
|
|
|
|
let(:lettings_log) { FactoryBot.build(:lettings_log, :in_progress) } |
|
|
|
|
|
|
|
let(:question) { Form::Lettings::Questions::Ppcodenk.new(nil, nil, Form::Lettings::Pages::PreviousPostcode.new("previous_postcode", nil, Form::Lettings::Subsections::HouseholdSituation.new(nil, nil, Form::Lettings::Sections::Household)))} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "has the correct values" do |
|
|
|
|
|
|
|
expect(question.value_is_yes?(1, lettings_log.lettings?)).to be true |
|
|
|
|
|
|
|
expect(question.value_is_no?(0, lettings_log.lettings?)).to be true |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "with a sales log" do |
|
|
|
|
|
|
|
let(:sales_log) { FactoryBot.build(:sales_log, :in_progress) } |
|
|
|
|
|
|
|
let(:question) { Form::Sales::Questions::PreviousPostcodeKnown.new(nil, nil, Form::Sales::Pages::LastAccommodation.new("previous_postcode", nil, Form::Sales::Subsections::HouseholdSituation.new(nil, nil, Form::Sales::Sections::Household)))} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "has the correct values" do |
|
|
|
|
|
|
|
expect(question.value_is_yes?(0, sales_log.lettings?)).to be true |
|
|
|
|
|
|
|
expect(question.value_is_no?(1, sales_log.lettings?)).to be true |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when type is numeric" do |
|
|
|
context "when type is numeric" do |
|
|
|
it "has a min value" do |
|
|
|
it "has a min value" do |
|
|
|
expect(question.min).to eq(0) |
|
|
|
expect(question.min).to eq(0) |
|
|
|
|