Browse Source

CLDC-2075: date clarification in tests

pull/1707/head
Aaron Spencer 3 years ago
parent
commit
c6ece5a94e
  1. 8
      spec/models/form/sales/pages/discounted_ownership_type_spec.rb
  2. 8
      spec/models/form/sales/pages/outright_ownership_type_spec.rb
  3. 10
      spec/models/form/sales/pages/shared_ownership_type_spec.rb
  4. 8
      spec/models/form/sales/questions/discounted_ownership_type_spec.rb
  5. 8
      spec/models/form/sales/questions/outright_ownership_type_spec.rb
  6. 9
      spec/models/form/sales/questions/shared_ownership_type_spec.rb

8
spec/models/form/sales/pages/discounted_ownership_type_spec.rb

@ -9,16 +9,16 @@ RSpec.describe Form::Sales::Pages::DiscountedOwnershipType, type: :model do
let(:start_date) { Time.zone.today } let(:start_date) { Time.zone.today }
describe "headers" do describe "headers" do
context "when form year is for 2023" do context "when form year is for 2023/24" do
let(:start_date) { Time.utc(2023, 2, 8) } let(:start_date) { Time.zone.local(2023, 4, 8) }
it "has the correct header" do it "has the correct header" do
expect(page.header).to eq("Type of discounted ownership sale") expect(page.header).to eq("Type of discounted ownership sale")
end end
end end
context "when form year is for before 2023" do context "when form year is for before 2023/24" do
let(:start_date) { Time.utc(2022, 2, 8) } let(:start_date) { Time.zone.local(2022, 2, 8) }
it "does not have a page header" do it "does not have a page header" do
expect(page.header).to eq(nil) expect(page.header).to eq(nil)

8
spec/models/form/sales/pages/outright_ownership_type_spec.rb

@ -31,16 +31,16 @@ RSpec.describe Form::Sales::Pages::OutrightOwnershipType, type: :model do
end end
describe "headers" do describe "headers" do
context "when the form year is 2023" do context "when the form year is 2023/24" do
let(:start_date) { Time.utc(2023, 2, 8) } let(:start_date) { Time.zone.local(2023, 4, 8) }
it "has the correct header" do it "has the correct header" do
expect(page.header).to eq("Type of outright sale") expect(page.header).to eq("Type of outright sale")
end end
end end
context "when the form is before the year 2023" do context "when the form is before the year 2023/24" do
let(:start_date) { Time.utc(2022, 2, 8) } let(:start_date) { Time.zone.local(2022, 4, 8) }
it "does not have a page header" do it "does not have a page header" do
expect(page.header).to eq(nil) expect(page.header).to eq(nil)

10
spec/models/form/sales/pages/shared_ownership_type_spec.rb

@ -1,4 +1,4 @@
require "rails_hel\per" require "rails_helper"
RSpec.describe Form::Sales::Pages::SharedOwnershipType, type: :model do RSpec.describe Form::Sales::Pages::SharedOwnershipType, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) } subject(:page) { described_class.new(page_id, page_definition, subsection) }
@ -9,16 +9,16 @@ RSpec.describe Form::Sales::Pages::SharedOwnershipType, type: :model do
let(:start_date) { Time.utc(2022, 4, 1) } let(:start_date) { Time.utc(2022, 4, 1) }
describe "headers" do describe "headers" do
context "when 2023" do context "when form is after the year 2023/24" do
let(:start_date) { Time.utc(2023, 2, 8) } let(:start_date) { Time.zone.local(2023, 4, 8) }
it "has the correct header" do it "has the correct header" do
expect(page.header).to eq("Type of shared ownership sale") expect(page.header).to eq("Type of shared ownership sale")
end end
end end
context "when before 2023" do context "when form is before the year 2023/24" do
let(:start_date) { Time.utc(2022, 2, 8) } let(:start_date) { Time.zone.local(2022, 2, 8) }
it "has the correct header" do it "has the correct header" do
expect(page.header).to eq(nil) expect(page.header).to eq(nil)

8
spec/models/form/sales/questions/discounted_ownership_type_spec.rb

@ -46,8 +46,8 @@ RSpec.describe Form::Sales::Questions::DiscountedOwnershipType, type: :model do
end end
describe "partial guidance" do describe "partial guidance" do
context "when the form is for 2023" do context "when the form is for 2023/24" do
let(:start_date) { Time.utc(2023, 2, 8) } let(:start_date) { Time.zone.local(2023, 4, 8) }
it "shows shows correct guidance_partial" do it "shows shows correct guidance_partial" do
expect(question.guidance_partial).to eq("discounted_ownership_type_definitions") expect(question.guidance_partial).to eq("discounted_ownership_type_definitions")
@ -59,8 +59,8 @@ RSpec.describe Form::Sales::Questions::DiscountedOwnershipType, type: :model do
end end
end end
context "when the form is for before 2023" do context "when the form is for before 2023/24" do
let(:start_date) { Time.utc(2022, 2, 8) } let(:start_date) { Time.zone.local(2022, 4, 8) }
it "does not show a guidance_partial" do it "does not show a guidance_partial" do
expect(question.guidance_partial).to eq(nil) expect(question.guidance_partial).to eq(nil)

8
spec/models/form/sales/questions/outright_ownership_type_spec.rb

@ -47,8 +47,8 @@ RSpec.describe Form::Sales::Questions::OutrightOwnershipType, type: :model do
end end
describe "partial guidance" do describe "partial guidance" do
context "when the form is for year 2023" do context "when the form is for year 2023/24" do
let(:start_date) { Time.utc(2023, 2, 8) } let(:start_date) { Time.zone.local(2023, 4, 8) }
it "has the correct guidance_partial" do it "has the correct guidance_partial" do
expect(question.guidance_partial).to eq("outright_sale_type_definitions") expect(question.guidance_partial).to eq("outright_sale_type_definitions")
@ -60,8 +60,8 @@ RSpec.describe Form::Sales::Questions::OutrightOwnershipType, type: :model do
end end
end end
context "when the form is for before year 2023" do context "when the form is for before year 2023/24" do
let(:start_date) { Time.utc(2022, 2, 8) } let(:start_date) { Time.zone.local(2022, 4, 8) }
it "does not display a guidance partial" do it "does not display a guidance partial" do
expect(question.guidance_partial).to eq(nil) expect(question.guidance_partial).to eq(nil)

9
spec/models/form/sales/questions/shared_ownership_type_spec.rb

@ -5,7 +5,7 @@ RSpec.describe Form::Sales::Questions::SharedOwnershipType, type: :model do
let(:question_id) { nil } let(:question_id) { nil }
let(:question_definition) { nil } let(:question_definition) { nil }
let(:start_date) { Time.utc(2022, 4, 1) } let(:start_date) { Time.zone.local(2022, 4, 1) }
let(:form) { instance_double(Form, start_date:) } let(:form) { instance_double(Form, start_date:) }
let(:subsection) { instance_double(Form::Subsection, form:) } let(:subsection) { instance_double(Form::Subsection, form:) }
let(:page) { instance_double(Form::Page, subsection:) } let(:page) { instance_double(Form::Page, subsection:) }
@ -38,7 +38,8 @@ RSpec.describe Form::Sales::Questions::SharedOwnershipType, type: :model do
expect(question.hint_text).to eq("A shared ownership sale is when the purchaser buys up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion") expect(question.hint_text).to eq("A shared ownership sale is when the purchaser buys up to 75% of the property value and pays rent to the Private Registered Provider (PRP) on the remaining portion")
end end
context "when form start date is 2022" do context "when form start date is 2022/23" do
let(:start_date) { Time.zone.local(2022, 4, 1) }
it "has the correct answer_options" do it "has the correct answer_options" do
expect(question.answer_options).to eq({ expect(question.answer_options).to eq({
"2" => { "value" => "Shared Ownership" }, "2" => { "value" => "Shared Ownership" },
@ -56,8 +57,8 @@ RSpec.describe Form::Sales::Questions::SharedOwnershipType, type: :model do
end end
end end
context "when form start date is 2023" do context "when form start date is 2023/24" do
let(:start_date) { Time.utc(2023, 4, 2) } let(:start_date) { Time.zone.local(2023, 4, 2) }
it "has the correct answer_options" do it "has the correct answer_options" do
expect(question.answer_options).to eq({ expect(question.answer_options).to eq({

Loading…
Cancel
Save