Browse Source

feat: update tests

pull/2214/head
natdeanlewissoftwire 2 years ago
parent
commit
3fe073b08b
  1. 12
      spec/models/form/lettings/questions/starter_tenancy_type_spec.rb
  2. 108
      spec/models/form/lettings/questions/tenancy_type_spec.rb

12
spec/models/form/lettings/questions/starter_tenancy_type_spec.rb

@ -14,11 +14,15 @@ RSpec.describe Form::Lettings::Questions::StarterTenancyType, type: :model do
allow(subsection).to receive(:form).and_return(form)
end
context "with collection year before 2024" do
context "with 2023/24 form" do
before do
allow(form).to receive(:start_year_after_2024?).and_return(false)
end
it "has the correct check answer label" do
expect(question.check_answer_label).to eq("Type of main tenancy after the starter period has ended?")
end
it "has the correct hint_text" do
expect(question.hint_text).to eq("This is also known as an ‘introductory period’.")
end
@ -52,11 +56,15 @@ RSpec.describe Form::Lettings::Questions::StarterTenancyType, type: :model do
end
end
context "with collection year >= 2024" do
context "with 2024/25 form" do
before do
allow(form).to receive(:start_year_after_2024?).and_return(true)
end
it "has the correct check answer label" do
expect(question.check_answer_label).to eq("What is the type of tenancy after the starter or introductory period has ended")
end
it "has the correct updated hint_text" do
expect(question.hint_text).to eq("")
end

108
spec/models/form/lettings/questions/tenancy_type_spec.rb

@ -42,30 +42,36 @@ RSpec.describe Form::Lettings::Questions::TenancyType, type: :model do
end
context "with 2023/24 form" do
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"4" => {
"value" => "Assured Shorthold Tenancy (AST) – Fixed term",
"hint" => "Mostly housing associations provide these. Fixed term tenancies are intended to be for a set amount of time up to 20 years.",
},
"6" => {
"value" => "Secure – fixed term",
"hint" => "Mostly local authorities provide these. Fixed term tenancies are intended to be for a set amount of time up to 20 years.",
},
"2" => {
"value" => "Assured – lifetime",
},
"7" => {
"value" => "Secure – lifetime",
},
"5" => {
"value" => "Licence agreement",
"hint" => "Licence agreements are mostly used for Supported Housing and work on a rolling basis.",
},
"3" => {
"value" => "Other",
before do
allow(form).to receive(:start_year_after_2024?).and_return(false)
end
it "has the correct answer options" do
expect(question.answer_options).to eq(
{
"4" => {
"value" => "Assured Shorthold Tenancy (AST) – Fixed term",
"hint" => "Mostly housing associations provide these. Fixed term tenancies are intended to be for a set amount of time up to 20 years.",
},
"6" => {
"value" => "Secure – fixed term",
"hint" => "Mostly local authorities provide these. Fixed term tenancies are intended to be for a set amount of time up to 20 years.",
},
"2" => {
"value" => "Assured – lifetime",
},
"7" => {
"value" => "Secure – lifetime",
},
"5" => {
"value" => "Licence agreement",
"hint" => "Licence agreements are mostly used for Supported Housing and work on a rolling basis.",
},
"3" => {
"value" => "Other",
},
},
})
)
end
end
@ -74,34 +80,36 @@ RSpec.describe Form::Lettings::Questions::TenancyType, type: :model do
allow(form).to receive(:start_year_after_2024?).and_return(true)
end
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"4" => {
"value" => "Assured Shorthold Tenancy (AST) – Fixed term",
"hint" => "These are mostly provided by housing associations. Fixed term tenancies are intended to be for a set amount of time up to 20 years.",
},
"6" => {
"value" => "Secure – fixed term",
"hint" => "These are mostly provided by local authorities. Fixed term tenancies are intended to be for a set amount of time up to 20 years.",
},
"2" => {
"value" => "Assured – lifetime",
},
"7" => {
"value" => "Secure – lifetime",
},
"8" => {
"value" => "Periodic",
"hint" => "These are rolling tenancies with no fixed end date. They may have an initial fixed term and then become rolling.",
},
"5" => {
"value" => "Licence agreement",
"hint" => "These are mostly used for Supported Housing and work on a rolling basis.",
},
"3" => {
"value" => "Other",
it "has the correct answer options" do
expect(question.answer_options).to eq(
{
"4" => {
"value" => "Assured Shorthold Tenancy (AST) – Fixed term",
"hint" => "These are mostly provided by housing associations. Fixed term tenancies are intended to be for a set amount of time up to 20 years.",
},
"6" => {
"value" => "Secure – fixed term",
"hint" => "These are mostly provided by local authorities. Fixed term tenancies are intended to be for a set amount of time up to 20 years.",
},
"2" => {
"value" => "Assured – lifetime",
},
"7" => {
"value" => "Secure – lifetime",
},
"8" => {
"value" => "Periodic",
"hint" => "These are rolling tenancies with no fixed end date. They may have an initial fixed term and then become rolling.",
},
"5" => {
"value" => "Licence agreement",
"hint" => "These are mostly used for Supported Housing and work on a rolling basis.",
},
"3" => {
"value" => "Other",
},
},
})
)
end
end

Loading…
Cancel
Save