Browse Source

feat: update tests (and add housingneeds_type to schema that was previously missing)

pull/893/head
natdeanlewissoftwire 2 years ago
parent
commit
21201dc875
  1. 1
      db/schema.rb
  2. 1
      spec/factories/sales_log.rb
  3. 2
      spec/models/form/sales/subsections/setup_spec.rb
  4. 4
      spec/models/form_handler_spec.rb
  5. 4
      spec/models/form_spec.rb

1
db/schema.rb

@ -230,6 +230,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_09_21_154025) do
t.bigint "location_id" t.bigint "location_id"
t.integer "major_repairs_date_value_check" t.integer "major_repairs_date_value_check"
t.integer "void_date_value_check" t.integer "void_date_value_check"
t.integer "housingneeds_type"
t.integer "housingneeds_other" t.integer "housingneeds_other"
t.index ["created_by_id"], name: "index_lettings_logs_on_created_by_id" t.index ["created_by_id"], name: "index_lettings_logs_on_created_by_id"
t.index ["location_id"], name: "index_lettings_logs_on_location_id" t.index ["location_id"], name: "index_lettings_logs_on_location_id"

1
spec/factories/sales_log.rb

@ -10,6 +10,7 @@ FactoryBot.define do
ownershipsch { 2 } ownershipsch { 2 }
type { 8 } type { 8 }
saledate { Time.utc(2022, 2, 2, 10, 36, 49) } saledate { Time.utc(2022, 2, 2, 10, 36, 49) }
companybuy { 1 }
jointpur { 1 } jointpur { 1 }
end end
end end

2
spec/models/form/sales/subsections/setup_spec.rb

@ -13,7 +13,7 @@ RSpec.describe Form::Sales::Subsections::Setup, type: :model do
it "has correct pages" do it "has correct pages" do
expect(setup.pages.map(&:id)).to eq( expect(setup.pages.map(&:id)).to eq(
%w[organisation created_by completion_date purchaser_code ownership_scheme shared_ownership_type discounted_ownership_type outright_ownership_type joint_purchase], %w[organisation created_by completion_date purchaser_code ownership_scheme shared_ownership_type discounted_ownership_type outright_ownership_type buyer_company joint_purchase],
) )
end end

4
spec/models/form_handler_spec.rb

@ -61,14 +61,14 @@ RSpec.describe FormHandler do
it "is able to load a current sales form" do it "is able to load a current sales form" do
form = form_handler.get_form("current_sales") form = form_handler.get_form("current_sales")
expect(form).to be_a(Form) expect(form).to be_a(Form)
expect(form.pages.count).to eq(9) expect(form.pages.count).to eq(10)
expect(form.name).to eq("2022_2023_sales") expect(form.name).to eq("2022_2023_sales")
end end
it "is able to load a previous sales form" do it "is able to load a previous sales form" do
form = form_handler.get_form("previous_sales") form = form_handler.get_form("previous_sales")
expect(form).to be_a(Form) expect(form).to be_a(Form)
expect(form.pages.count).to eq(9) expect(form.pages.count).to eq(10)
expect(form.name).to eq("2021_2022_sales") expect(form.name).to eq("2021_2022_sales")
end end
end end

4
spec/models/form_spec.rb

@ -218,9 +218,9 @@ RSpec.describe Form, type: :model do
expect(form.sections[0].class).to eq(Form::Sales::Sections::Setup) expect(form.sections[0].class).to eq(Form::Sales::Sections::Setup)
expect(form.subsections.count).to eq(1) expect(form.subsections.count).to eq(1)
expect(form.subsections.first.id).to eq("setup") expect(form.subsections.first.id).to eq("setup")
expect(form.pages.count).to eq(9) expect(form.pages.count).to eq(10)
expect(form.pages.first.id).to eq("organisation") expect(form.pages.first.id).to eq("organisation")
expect(form.questions.count).to eq(10) expect(form.questions.count).to eq(11)
expect(form.questions.first.id).to eq("owning_organisation_id") expect(form.questions.first.id).to eq("owning_organisation_id")
expect(form.start_date).to eq(Time.zone.parse("2022-04-01")) expect(form.start_date).to eq(Time.zone.parse("2022-04-01"))
expect(form.end_date).to eq(Time.zone.parse("2023-07-01")) expect(form.end_date).to eq(Time.zone.parse("2023-07-01"))

Loading…
Cancel
Save