Browse Source

CLDC-4402: previous let type spec

CLDC-4402-audit-start-year-2024-or-later-usage
samyou-softwire 2 days ago
parent
commit
80d6c6a6bd
  1. 25
      spec/models/form/lettings/questions/previous_let_type_spec.rb

25
spec/models/form/lettings/questions/previous_let_type_spec.rb

@ -1,11 +1,13 @@
require "rails_helper"
RSpec.describe Form::Lettings::Questions::PreviousLetType, type: :model do
include CollectionTimeHelper
subject(:question) { described_class.new(nil, nil, page) }
let(:page) { instance_double(Form::Page) }
let(:subsection) { instance_double(Form::Subsection) }
let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) }
let(:form) { instance_double(Form, start_date: current_collection_start_year) }
before do
allow(form).to receive(:start_year_2025_or_later?).and_return(false)
@ -29,27 +31,8 @@ RSpec.describe Form::Lettings::Questions::PreviousLetType, type: :model do
expect(question.derived?(nil)).to be false
end
context "with collection year on or after 2024" do
it "has the correct answer options" do
expect(question.answer_options).to eq({
"1" => { "value" => "Social rent basis" },
"2" => { "value" => "Affordable rent basis" },
"5" => { "value" => "A London Affordable Rent basis" },
"6" => { "value" => "A Rent to Buy basis" },
"7" => { "value" => "A London Living Rent basis" },
"8" => { "value" => "Another Intermediate Rent basis" },
"divider" => { "value" => true },
"3" => { "value" => "Don’t know" },
})
end
it "has the correct question number" do
expect(question.question_number).to eq(17)
end
end
context "with collection year on or after 2025" do
let(:form) { instance_double(Form, start_date: Time.zone.local(2025, 4, 1)) }
let(:form) { instance_double(Form, start_date: collection_start_date_for_year(2025)) }
before do
allow(form).to receive(:start_year_2025_or_later?).and_return(true)

Loading…
Cancel
Save