Browse Source

Add common organisation and created by questions to sales logs (#874)

pull/876/head
baarkerlounger 2 years ago committed by GitHub
parent
commit
32a99f1c5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/models/form/sales/subsections/setup.rb
  2. 2
      spec/models/form/sales/subsections/setup_spec.rb
  3. 8
      spec/models/form_spec.rb

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

@ -8,6 +8,8 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection
def pages
@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),
]

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
expect(setup.pages.map(&:id)).to eq(
%w[purchaser_code sale_date],
%w[organisation created_by purchaser_code sale_date],
)
end

8
spec/models/form_spec.rb

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

Loading…
Cancel
Save