Browse Source

Move sales created_by page and question out of common

pull/1533/head
Jack S 3 years ago
parent
commit
d7102b6a7b
  1. 4
      app/models/form/sales/pages/created_by.rb
  2. 2
      app/models/form/sales/questions/created_by_id.rb
  3. 2
      app/models/form/sales/subsections/setup.rb
  4. 2
      spec/models/form/lettings/questions/created_by_id_spec.rb
  5. 2
      spec/models/form/sales/pages/created_by_spec.rb
  6. 4
      spec/models/form/sales/questions/created_by_id_spec.rb

4
app/models/form/common/pages/created_by.rb → app/models/form/sales/pages/created_by.rb

@ -1,4 +1,4 @@
class Form::Common::Pages::CreatedBy < ::Form::Page class Form::Sales::Pages::CreatedBy < ::Form::Page
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
super super
@id = "created_by" @id = "created_by"
@ -6,7 +6,7 @@ class Form::Common::Pages::CreatedBy < ::Form::Page
def questions def questions
@questions ||= [ @questions ||= [
Form::Common::Questions::CreatedById.new(nil, nil, self), Form::Sales::Questions::CreatedById.new(nil, nil, self),
] ]
end end

2
app/models/form/common/questions/created_by_id.rb → app/models/form/sales/questions/created_by_id.rb

@ -1,4 +1,4 @@
class Form::Common::Questions::CreatedById < ::Form::Question class Form::Sales::Questions::CreatedById < ::Form::Question
ANSWER_OPTS = { "" => "Select an option" }.freeze ANSWER_OPTS = { "" => "Select an option" }.freeze
def initialize(id, hsh, page) def initialize(id, hsh, page)

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

@ -8,7 +8,7 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection
def pages def pages
@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::Sales::Pages::CreatedBy.new(nil, nil, self),
Form::Sales::Pages::SaleDate.new(nil, nil, self), Form::Sales::Pages::SaleDate.new(nil, nil, self),
Form::Sales::Pages::SaleDateCheck.new(nil, nil, self), Form::Sales::Pages::SaleDateCheck.new(nil, nil, self),
Form::Sales::Pages::PurchaserCode.new(nil, nil, self), Form::Sales::Pages::PurchaserCode.new(nil, nil, self),

2
spec/models/form/lettings/questions/created_by_id_spec.rb

@ -129,7 +129,7 @@ RSpec.describe Form::Lettings::Questions::CreatedById, type: :model do
end end
it "only displays users that belong user's org" do it "only displays users that belong user's org" do
expect(question.displayed_answer_options(lettings_log, data_provider)).to eq(Form::Common::Questions::CreatedById::ANSWER_OPTS) expect(question.displayed_answer_options(lettings_log, data_provider)).to eq(Form::Lettings::Questions::CreatedById::ANSWER_OPTS)
end end
end end
end end

2
spec/models/form/common/pages/created_by_spec.rb → spec/models/form/sales/pages/created_by_spec.rb

@ -1,6 +1,6 @@
require "rails_helper" require "rails_helper"
RSpec.describe Form::Common::Pages::CreatedBy, type: :model do RSpec.describe Form::Sales::Pages::CreatedBy, type: :model do
subject(:page) { described_class.new(page_id, page_definition, subsection) } subject(:page) { described_class.new(page_id, page_definition, subsection) }
let(:page_id) { nil } let(:page_id) { nil }

4
spec/models/form/common/questions/created_by_id_spec.rb → spec/models/form/sales/questions/created_by_id_spec.rb

@ -1,6 +1,6 @@
require "rails_helper" require "rails_helper"
RSpec.describe Form::Common::Questions::CreatedById, type: :model do RSpec.describe Form::Sales::Questions::CreatedById, type: :model do
subject(:question) { described_class.new(question_id, question_definition, page) } subject(:question) { described_class.new(question_id, question_definition, page) }
let(:question_id) { nil } let(:question_id) { nil }
@ -120,7 +120,7 @@ RSpec.describe Form::Common::Questions::CreatedById, type: :model do
end end
it "only displays users that belong user's org" do it "only displays users that belong user's org" do
expect(question.displayed_answer_options(sales_log, data_provider)).to eq(Form::Common::Questions::CreatedById::ANSWER_OPTS) expect(question.displayed_answer_options(sales_log, data_provider)).to eq(Form::Sales::Questions::CreatedById::ANSWER_OPTS)
end end
end end
end end
Loading…
Cancel
Save