From d7d78e0da84a04a07ec55818b2c1c3c8a0f419f2 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Thu, 15 Sep 2022 11:49:16 +0100 Subject: [PATCH] Extract common questions --- app/models/form/{lettings => common}/pages/created_by.rb | 4 ++-- app/models/form/{lettings => common}/pages/organisation.rb | 4 ++-- .../form/{lettings => common}/questions/created_by_id.rb | 2 +- .../{lettings => common}/questions/owning_organisation_id.rb | 2 +- app/models/form/lettings/subsections/setup.rb | 4 ++-- app/models/form/sales/pages/purchaser_code.rb | 4 ++-- app/models/form/sales/questions/purchaser_code.rb | 2 +- app/models/form/sales/subsections/setup.rb | 4 ++-- .../models/form/{lettings => common}/pages/created_by_spec.rb | 2 +- .../form/{lettings => common}/pages/organisation_spec.rb | 2 +- .../form/{lettings => common}/questions/created_by_id_spec.rb | 2 +- .../questions/owning_organisation_id_spec.rb | 2 +- spec/models/form/sales/pages/purchaser_code_spec.rb | 2 +- spec/models/form/sales/questions/purchaser_code_spec.rb | 2 +- 14 files changed, 19 insertions(+), 19 deletions(-) rename app/models/form/{lettings => common}/pages/created_by.rb (69%) rename app/models/form/{lettings => common}/pages/organisation.rb (67%) rename app/models/form/{lettings => common}/questions/created_by_id.rb (93%) rename app/models/form/{lettings => common}/questions/owning_organisation_id.rb (92%) rename spec/models/form/{lettings => common}/pages/created_by_spec.rb (95%) rename spec/models/form/{lettings => common}/pages/organisation_spec.rb (94%) rename spec/models/form/{lettings => common}/questions/created_by_id_spec.rb (96%) rename spec/models/form/{lettings => common}/questions/owning_organisation_id_spec.rb (97%) diff --git a/app/models/form/lettings/pages/created_by.rb b/app/models/form/common/pages/created_by.rb similarity index 69% rename from app/models/form/lettings/pages/created_by.rb rename to app/models/form/common/pages/created_by.rb index 42289befa..e02f97740 100644 --- a/app/models/form/lettings/pages/created_by.rb +++ b/app/models/form/common/pages/created_by.rb @@ -1,4 +1,4 @@ -class Form::Lettings::Pages::CreatedBy < ::Form::Page +class Form::Common::Pages::CreatedBy < ::Form::Page def initialize(id, hsh, subsection) super @id = "created_by" @@ -9,7 +9,7 @@ class Form::Lettings::Pages::CreatedBy < ::Form::Page def questions @questions ||= [ - Form::Lettings::Questions::CreatedById.new(nil, nil, self), + Form::Common::Questions::CreatedById.new(nil, nil, self), ] end diff --git a/app/models/form/lettings/pages/organisation.rb b/app/models/form/common/pages/organisation.rb similarity index 67% rename from app/models/form/lettings/pages/organisation.rb rename to app/models/form/common/pages/organisation.rb index 548f61941..48b157a56 100644 --- a/app/models/form/lettings/pages/organisation.rb +++ b/app/models/form/common/pages/organisation.rb @@ -1,4 +1,4 @@ -class Form::Lettings::Pages::Organisation < ::Form::Page +class Form::Common::Pages::Organisation < ::Form::Page def initialize(id, hsh, subsection) super @id = "organisation" @@ -9,7 +9,7 @@ class Form::Lettings::Pages::Organisation < ::Form::Page def questions @questions ||= [ - Form::Lettings::Questions::OwningOrganisationId.new(nil, nil, self), + Form::Common::Questions::OwningOrganisationId.new(nil, nil, self), ] end diff --git a/app/models/form/lettings/questions/created_by_id.rb b/app/models/form/common/questions/created_by_id.rb similarity index 93% rename from app/models/form/lettings/questions/created_by_id.rb rename to app/models/form/common/questions/created_by_id.rb index 9a2767290..b0558e5e2 100644 --- a/app/models/form/lettings/questions/created_by_id.rb +++ b/app/models/form/common/questions/created_by_id.rb @@ -1,4 +1,4 @@ -class Form::Lettings::Questions::CreatedById < ::Form::Question +class Form::Common::Questions::CreatedById < ::Form::Question def initialize(id, hsh, page) super @id = "created_by_id" diff --git a/app/models/form/lettings/questions/owning_organisation_id.rb b/app/models/form/common/questions/owning_organisation_id.rb similarity index 92% rename from app/models/form/lettings/questions/owning_organisation_id.rb rename to app/models/form/common/questions/owning_organisation_id.rb index e70c59859..84eefbf21 100644 --- a/app/models/form/lettings/questions/owning_organisation_id.rb +++ b/app/models/form/common/questions/owning_organisation_id.rb @@ -1,4 +1,4 @@ -class Form::Lettings::Questions::OwningOrganisationId < ::Form::Question +class Form::Common::Questions::OwningOrganisationId < ::Form::Question def initialize(id, hsh, page) super @id = "owning_organisation_id" diff --git a/app/models/form/lettings/subsections/setup.rb b/app/models/form/lettings/subsections/setup.rb index 5be178313..79d346599 100644 --- a/app/models/form/lettings/subsections/setup.rb +++ b/app/models/form/lettings/subsections/setup.rb @@ -8,8 +8,8 @@ class Form::Lettings::Subsections::Setup < ::Form::Subsection def pages @pages ||= [ - Form::Lettings::Pages::Organisation.new(nil, nil, self), - Form::Lettings::Pages::CreatedBy.new(nil, nil, self), + Form::Common::Pages::Organisation.new(nil, nil, self), + Form::Common::Pages::CreatedBy.new(nil, nil, self), Form::Lettings::Pages::NeedsType.new(nil, nil, self), Form::Lettings::Pages::Scheme.new(nil, nil, self), Form::Lettings::Pages::Location.new(nil, nil, self), diff --git a/app/models/form/sales/pages/purchaser_code.rb b/app/models/form/sales/pages/purchaser_code.rb index f70c71e96..79723e0b0 100644 --- a/app/models/form/sales/pages/purchaser_code.rb +++ b/app/models/form/sales/pages/purchaser_code.rb @@ -1,4 +1,4 @@ -class Form::Sales::Setup::Pages::PurchaserCode < ::Form::Page +class Form::Sales::Pages::PurchaserCode < ::Form::Page def initialize(id, hsh, subsection) super @id = "purchaser_code" @@ -9,7 +9,7 @@ class Form::Sales::Setup::Pages::PurchaserCode < ::Form::Page def questions @questions ||= [ - Form::Sales::Setup::Questions::PurchaserCode.new(nil, nil, self), + Form::Sales::Questions::PurchaserCode.new(nil, nil, self), ] end end diff --git a/app/models/form/sales/questions/purchaser_code.rb b/app/models/form/sales/questions/purchaser_code.rb index 409ed6ac1..b391faf21 100644 --- a/app/models/form/sales/questions/purchaser_code.rb +++ b/app/models/form/sales/questions/purchaser_code.rb @@ -1,4 +1,4 @@ -class Form::Sales::Setup::Questions::PurchaserCode < ::Form::Question +class Form::Sales::Questions::PurchaserCode < ::Form::Question def initialize(id, hsh, page) super @id = "purchid" diff --git a/app/models/form/sales/subsections/setup.rb b/app/models/form/sales/subsections/setup.rb index d812acd0d..42eac8f6f 100644 --- a/app/models/form/sales/subsections/setup.rb +++ b/app/models/form/sales/subsections/setup.rb @@ -8,8 +8,8 @@ class Form::Sales::Subsections::Setup < ::Form::Subsection def pages @pages ||= [ - Form::Sales::Setup::Pages::PurchaserCode.new(nil, nil, self), - Form::Sales::Setup::Pages::SaleDate.new(nil, nil, self), + Form::Sales::Pages::PurchaserCode.new(nil, nil, self), + Form::Sales::Pages::SaleDate.new(nil, nil, self), ] end end diff --git a/spec/models/form/lettings/pages/created_by_spec.rb b/spec/models/form/common/pages/created_by_spec.rb similarity index 95% rename from spec/models/form/lettings/pages/created_by_spec.rb rename to spec/models/form/common/pages/created_by_spec.rb index f9de0d011..1f11a5889 100644 --- a/spec/models/form/lettings/pages/created_by_spec.rb +++ b/spec/models/form/common/pages/created_by_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Form::Lettings::Pages::CreatedBy, type: :model do +RSpec.describe Form::Common::Pages::CreatedBy, type: :model do subject(:page) { described_class.new(page_id, page_definition, subsection) } let(:page_id) { nil } diff --git a/spec/models/form/lettings/pages/organisation_spec.rb b/spec/models/form/common/pages/organisation_spec.rb similarity index 94% rename from spec/models/form/lettings/pages/organisation_spec.rb rename to spec/models/form/common/pages/organisation_spec.rb index 0eb6eca1c..ae7a1027c 100644 --- a/spec/models/form/lettings/pages/organisation_spec.rb +++ b/spec/models/form/common/pages/organisation_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Form::Lettings::Pages::Organisation, type: :model do +RSpec.describe Form::Common::Pages::Organisation, type: :model do subject(:page) { described_class.new(page_id, page_definition, subsection) } let(:page_id) { nil } diff --git a/spec/models/form/lettings/questions/created_by_id_spec.rb b/spec/models/form/common/questions/created_by_id_spec.rb similarity index 96% rename from spec/models/form/lettings/questions/created_by_id_spec.rb rename to spec/models/form/common/questions/created_by_id_spec.rb index c40e95063..b00e21f90 100644 --- a/spec/models/form/lettings/questions/created_by_id_spec.rb +++ b/spec/models/form/common/questions/created_by_id_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Form::Lettings::Questions::CreatedById, type: :model do +RSpec.describe Form::Common::Questions::CreatedById, type: :model do subject(:question) { described_class.new(question_id, question_definition, page) } let(:question_id) { nil } diff --git a/spec/models/form/lettings/questions/owning_organisation_id_spec.rb b/spec/models/form/common/questions/owning_organisation_id_spec.rb similarity index 97% rename from spec/models/form/lettings/questions/owning_organisation_id_spec.rb rename to spec/models/form/common/questions/owning_organisation_id_spec.rb index 776086f74..9ee32e342 100644 --- a/spec/models/form/lettings/questions/owning_organisation_id_spec.rb +++ b/spec/models/form/common/questions/owning_organisation_id_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Form::Lettings::Questions::OwningOrganisationId, type: :model do +RSpec.describe Form::Common::Questions::OwningOrganisationId, type: :model do subject(:question) { described_class.new(question_id, question_definition, page) } let(:question_id) { nil } diff --git a/spec/models/form/sales/pages/purchaser_code_spec.rb b/spec/models/form/sales/pages/purchaser_code_spec.rb index 7135e822b..05ee6becc 100644 --- a/spec/models/form/sales/pages/purchaser_code_spec.rb +++ b/spec/models/form/sales/pages/purchaser_code_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Form::Sales::Setup::Pages::PurchaserCode, type: :model do +RSpec.describe Form::Sales::Pages::PurchaserCode, type: :model do subject(:page) { described_class.new(page_id, page_definition, subsection) } let(:page_id) { nil } diff --git a/spec/models/form/sales/questions/purchaser_code_spec.rb b/spec/models/form/sales/questions/purchaser_code_spec.rb index 49ad611ba..3d01dd0ab 100644 --- a/spec/models/form/sales/questions/purchaser_code_spec.rb +++ b/spec/models/form/sales/questions/purchaser_code_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Form::Sales::Setup::Questions::PurchaserCode, type: :model do +RSpec.describe Form::Sales::Questions::PurchaserCode, type: :model do subject(:question) { described_class.new(question_id, question_definition, page) } let(:question_id) { nil }