From b59b9c3e07bffd7b4f4f467dc618a1424a1592dd Mon Sep 17 00:00:00 2001 From: baarkerlounger <5101747+baarkerlounger@users.noreply.github.com> Date: Fri, 16 Sep 2022 10:08:03 +0100 Subject: [PATCH] Sale completion date (#877) * Update page id (URL) * Question order --- app/models/form/sales/pages/sale_date.rb | 2 +- app/models/form/sales/subsections/setup.rb | 2 +- spec/features/sales_log_spec.rb | 8 ++++---- spec/features/user_spec.rb | 2 +- spec/models/form/sales/pages/sale_date_spec.rb | 2 +- spec/models/form/sales/subsections/setup_spec.rb | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/models/form/sales/pages/sale_date.rb b/app/models/form/sales/pages/sale_date.rb index 814684e2e..518e9b5ff 100644 --- a/app/models/form/sales/pages/sale_date.rb +++ b/app/models/form/sales/pages/sale_date.rb @@ -1,7 +1,7 @@ class Form::Sales::Pages::SaleDate < ::Form::Page def initialize(id, hsh, subsection) super - @id = "sale_date" + @id = "completion_date" @header = "" @description = "" @subsection = subsection diff --git a/app/models/form/sales/subsections/setup.rb b/app/models/form/sales/subsections/setup.rb index db91e261f..4c8601e8d 100644 --- a/app/models/form/sales/subsections/setup.rb +++ b/app/models/form/sales/subsections/setup.rb @@ -10,8 +10,8 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection @pages ||= [ Form::Common::Pages::Organisation.new(nil, nil, self), Form::Common::Pages::CreatedBy.new(nil, nil, self), - Form::Sales::Pages::PurchaserCode.new(nil, nil, self), Form::Sales::Pages::SaleDate.new(nil, nil, self), + Form::Sales::Pages::PurchaserCode.new(nil, nil, self), ] end end diff --git a/spec/features/sales_log_spec.rb b/spec/features/sales_log_spec.rb index 4c07f2acd..270d9bf37 100644 --- a/spec/features/sales_log_spec.rb +++ b/spec/features/sales_log_spec.rb @@ -38,18 +38,18 @@ RSpec.describe "Sales Log Features" do visit("/sales-logs") click_button("Create a new sales log") click_link("Set up this sales log") - fill_in("sales_log[purchid]", with: "PC123") - click_button("Save and continue") fill_in("sales_log[saledate(1i)]", with: "2022") fill_in("sales_log[saledate(2i)]", with: "08") fill_in("sales_log[saledate(3i)]", with: "10") click_button("Save and continue") + fill_in("sales_log[purchid]", with: "PC123") + click_button("Save and continue") log_id = page.current_path.scan(/\d/).join visit("sales-logs/#{log_id}/setup/check-answers") - expect(page).to have_content("Purchaser code") - expect(page).to have_content("PC123") expect(page).to have_content("Sale completion date") expect(page).to have_content("2022") + expect(page).to have_content("Purchaser code") + expect(page).to have_content("PC123") end end diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index 530b038e6..0c7f6c2c6 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -512,7 +512,7 @@ RSpec.describe "User Features" do click_button("Sign in") fill_in("code", with: otp) click_button("Submit") - expect(page).to have_content("Logs") + expect(page).to have_content("Lettings logs") end context "but it is more than 15 minutes old" do diff --git a/spec/models/form/sales/pages/sale_date_spec.rb b/spec/models/form/sales/pages/sale_date_spec.rb index 1b2a8a924..7f78182a8 100644 --- a/spec/models/form/sales/pages/sale_date_spec.rb +++ b/spec/models/form/sales/pages/sale_date_spec.rb @@ -16,7 +16,7 @@ RSpec.describe Form::Sales::Pages::SaleDate, type: :model do end it "has the correct id" do - expect(page.id).to eq("sale_date") + expect(page.id).to eq("completion_date") end it "has the correct header" do diff --git a/spec/models/form/sales/subsections/setup_spec.rb b/spec/models/form/sales/subsections/setup_spec.rb index ca2c09e76..4e00a7631 100644 --- a/spec/models/form/sales/subsections/setup_spec.rb +++ b/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 expect(setup.pages.map(&:id)).to eq( - %w[organisation created_by purchaser_code sale_date], + %w[organisation created_by completion_date purchaser_code], ) end