Browse Source

Sale completion date (#877)

* Update page id (URL)

* Question order
pull/879/head
baarkerlounger 2 years ago committed by baarkerlounger
parent
commit
b59b9c3e07
  1. 2
      app/models/form/sales/pages/sale_date.rb
  2. 2
      app/models/form/sales/subsections/setup.rb
  3. 8
      spec/features/sales_log_spec.rb
  4. 2
      spec/features/user_spec.rb
  5. 2
      spec/models/form/sales/pages/sale_date_spec.rb
  6. 2
      spec/models/form/sales/subsections/setup_spec.rb

2
app/models/form/sales/pages/sale_date.rb

@ -1,7 +1,7 @@
class Form::Sales::Pages::SaleDate < ::Form::Page class Form::Sales::Pages::SaleDate < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "sale_date" @id = "completion_date"
@header = "" @header = ""
@description = "" @description = ""
@subsection = subsection @subsection = subsection

2
app/models/form/sales/subsections/setup.rb

@ -10,8 +10,8 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection
@pages ||= [ @pages ||= [
Form::Common::Pages::Organisation.new(nil, nil, self), Form::Common::Pages::Organisation.new(nil, nil, self),
Form::Common::Pages::CreatedBy.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::SaleDate.new(nil, nil, self),
Form::Sales::Pages::PurchaserCode.new(nil, nil, self),
] ]
end end
end end

8
spec/features/sales_log_spec.rb

@ -38,18 +38,18 @@ RSpec.describe "Sales Log Features" do
visit("/sales-logs") visit("/sales-logs")
click_button("Create a new sales log") click_button("Create a new sales log")
click_link("Set up this 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(1i)]", with: "2022")
fill_in("sales_log[saledate(2i)]", with: "08") fill_in("sales_log[saledate(2i)]", with: "08")
fill_in("sales_log[saledate(3i)]", with: "10") fill_in("sales_log[saledate(3i)]", with: "10")
click_button("Save and continue") 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 log_id = page.current_path.scan(/\d/).join
visit("sales-logs/#{log_id}/setup/check-answers") 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("Sale completion date")
expect(page).to have_content("2022") expect(page).to have_content("2022")
expect(page).to have_content("Purchaser code")
expect(page).to have_content("PC123")
end end
end end

2
spec/features/user_spec.rb

@ -512,7 +512,7 @@ RSpec.describe "User Features" do
click_button("Sign in") click_button("Sign in")
fill_in("code", with: otp) fill_in("code", with: otp)
click_button("Submit") click_button("Submit")
expect(page).to have_content("Logs") expect(page).to have_content("Lettings logs")
end end
context "but it is more than 15 minutes old" do context "but it is more than 15 minutes old" do

2
spec/models/form/sales/pages/sale_date_spec.rb

@ -16,7 +16,7 @@ RSpec.describe Form::Sales::Pages::SaleDate, type: :model do
end end
it "has the correct id" do it "has the correct id" do
expect(page.id).to eq("sale_date") expect(page.id).to eq("completion_date")
end end
it "has the correct header" do it "has the correct header" do

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 purchaser_code sale_date], %w[organisation created_by completion_date purchaser_code],
) )
end end

Loading…
Cancel
Save