Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

46 lines
1.7 KiB

require "rails_helper"
RSpec.describe Form::Lettings::Questions::Period, type: :model do
subject(:question) { described_class.new(nil, nil, page) }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) }
it "has the correct hint" do
expect(question.hint_text).to eq("Select how often the household is charged. This may be different to how often they pay.")
end
it "has correct answer options" do
expect(question.answer_options).to eq(
{
"2" => { "value" => "Every 2 weeks" },
"3" => { "value" => "Every 4 weeks" },
"4" => { "value" => "Every calendar month" },
"9" => { "value" => "Weekly for 46 weeks" },
"8" => { "value" => "Weekly for 47 weeks" },
"7" => { "value" => "Weekly for 48 weeks" },
"6" => { "value" => "Weekly for 49 weeks" },
"5" => { "value" => "Weekly for 50 weeks" },
"11" => { "value" => "Weekly for 51 weeks" },
"1" => { "value" => "Weekly for 52 weeks" },
"10" => { "value" => "Weekly for 53 weeks" },
},
)
end
context "when managing organisation has rent periods" do
let(:managing_organisation) { create(:organisation, skip_rent_period_creation: true) }
let(:log) { create(:lettings_log, managing_organisation:) }
before do
create(:organisation_rent_period, organisation: managing_organisation, rent_period: 3)
end
it "has correct displayed answer options" do
expect(question.displayed_answer_options(log, nil)).to eq(
{
"3" => { "value" => "Every 4 weeks" },
},
)
end
end
end