baarkerlounger
2 years ago
committed by
GitHub
63 changed files with 137 additions and 139 deletions
@ -1,4 +1,4 @@
|
||||
class Form::Setup::Questions::CreatedById < ::Form::Question |
||||
class Form::Common::Questions::CreatedById < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "created_by_id" |
@ -1,4 +1,4 @@
|
||||
class Form::Setup::Questions::OwningOrganisationId < ::Form::Question |
||||
class Form::Common::Questions::OwningOrganisationId < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "owning_organisation_id" |
@ -1,4 +1,4 @@
|
||||
class Form::Setup::Questions::IrproductOther < ::Form::Question |
||||
class Form::Lettings::Questions::IrproductOther < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "irproduct_other" |
@ -1,4 +1,4 @@
|
||||
class Form::Setup::Questions::LocationId < ::Form::Question |
||||
class Form::Lettings::Questions::LocationId < ::Form::Question |
||||
def initialize(_id, hsh, page) |
||||
super("location_id", hsh, page) |
||||
@check_answer_label = "Location" |
@ -1,4 +1,4 @@
|
||||
class Form::Setup::Questions::NeedsType < ::Form::Question |
||||
class Form::Lettings::Questions::NeedsType < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "needstype" |
@ -1,4 +1,4 @@
|
||||
class Form::Setup::Questions::PropertyReference < ::Form::Question |
||||
class Form::Lettings::Questions::PropertyReference < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "propcode" |
@ -1,4 +1,4 @@
|
||||
class Form::Setup::Questions::Renewal < ::Form::Question |
||||
class Form::Lettings::Questions::Renewal < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "renewal" |
@ -1,4 +1,4 @@
|
||||
class Form::Setup::Questions::RentType < ::Form::Question |
||||
class Form::Lettings::Questions::RentType < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "rent_type" |
@ -1,4 +1,4 @@
|
||||
class Form::Setup::Questions::SchemeId < ::Form::Question |
||||
class Form::Lettings::Questions::SchemeId < ::Form::Question |
||||
def initialize(_id, hsh, page) |
||||
super("scheme_id", hsh, page) |
||||
@check_answer_label = "Scheme name" |
@ -1,4 +1,4 @@
|
||||
class Form::Setup::Questions::TenancyStartDate < ::Form::Question |
||||
class Form::Lettings::Questions::TenancyStartDate < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "startdate" |
@ -1,4 +1,4 @@
|
||||
class Form::Setup::Questions::TenantCode < ::Form::Question |
||||
class Form::Lettings::Questions::TenantCode < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "tenancycode" |
@ -1,10 +1,10 @@
|
||||
class Form::Sections::Setup < ::Form::Section |
||||
class Form::Lettings::Sections::Setup < ::Form::Section |
||||
def initialize(id, hsh, form) |
||||
super |
||||
@id = "setup" |
||||
@label = "Before you start" |
||||
@description = "" |
||||
@form = form |
||||
@subsections = [Form::Setup::Subsections::Setup.new(nil, nil, self)] |
||||
@subsections = [Form::Lettings::Subsections::Setup.new(nil, nil, self)] |
||||
end |
||||
end |
@ -0,0 +1,37 @@
|
||||
class Form::Lettings::Subsections::Setup < ::Form::Subsection |
||||
def initialize(id, hsh, section) |
||||
super |
||||
@id = "setup" |
||||
@label = "Set up this lettings log" |
||||
@section = section |
||||
end |
||||
|
||||
def pages |
||||
@pages ||= [ |
||||
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), |
||||
Form::Lettings::Pages::Renewal.new(nil, nil, self), |
||||
Form::Lettings::Pages::TenancyStartDate.new(nil, nil, self), |
||||
Form::Lettings::Pages::RentType.new(nil, nil, self), |
||||
Form::Lettings::Pages::TenantCode.new(nil, nil, self), |
||||
Form::Lettings::Pages::PropertyReference.new(nil, nil, self), |
||||
] |
||||
end |
||||
|
||||
def applicable_questions(lettings_log) |
||||
questions.select { |q| support_only_questions.include?(q.id) } + super |
||||
end |
||||
|
||||
def enabled?(_lettings_log) |
||||
true |
||||
end |
||||
|
||||
private |
||||
|
||||
def support_only_questions |
||||
%w[owning_organisation_id created_by_id].freeze |
||||
end |
||||
end |
@ -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" |
@ -1,4 +1,4 @@
|
||||
class Form::Sales::Setup::Questions::SaleDate < ::Form::Question |
||||
class Form::Sales::Questions::SaleDate < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "saledate" |
@ -0,0 +1,10 @@
|
||||
class Form::Sales::Sections::Setup < ::Form::Section |
||||
def initialize(id, hsh, form) |
||||
super |
||||
@id = "setup" |
||||
@label = "Before you start" |
||||
@description = "" |
||||
@form = form |
||||
@subsections = [Form::Sales::Subsections::Setup.new(nil, nil, self)] || [] |
||||
end |
||||
end |
@ -1,10 +0,0 @@
|
||||
class Form::Sales::Setup::Sections::Setup < ::Form::Section |
||||
def initialize(id, hsh, form) |
||||
super |
||||
@id = "setup" |
||||
@label = "Before you start" |
||||
@description = "" |
||||
@form = form |
||||
@subsections = [Form::Sales::Setup::Subsections::Setup.new(nil, nil, self)] || [] |
||||
end |
||||
end |
@ -1,15 +0,0 @@
|
||||
class Form::Sales::Setup::Subsections::Setup < ::Form::Subsection |
||||
def initialize(id, hsh, section) |
||||
super |
||||
@id = "setup" |
||||
@label = "Set up this sales log" |
||||
@section = section |
||||
end |
||||
|
||||
def pages |
||||
@pages ||= [ |
||||
Form::Sales::Setup::Pages::PurchaserCode.new(nil, nil, self), |
||||
Form::Sales::Setup::Pages::SaleDate.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -0,0 +1,15 @@
|
||||
class Form::Sales::Subsections::Setup < ::Form::Subsection |
||||
def initialize(id, hsh, section) |
||||
super |
||||
@id = "setup" |
||||
@label = "Set up this sales log" |
||||
@section = section |
||||
end |
||||
|
||||
def pages |
||||
@pages ||= [ |
||||
Form::Sales::Pages::PurchaserCode.new(nil, nil, self), |
||||
Form::Sales::Pages::SaleDate.new(nil, nil, self), |
||||
] |
||||
end |
||||
end |
@ -1,37 +0,0 @@
|
||||
class Form::Subsections::Setup < ::Form::Subsection |
||||
def initialize(id, hsh, section) |
||||
super |
||||
@id = "setup" |
||||
@label = "Set up this lettings log" |
||||
@section = section |
||||
end |
||||
|
||||
def pages |
||||
@pages ||= [ |
||||
Form::Setup::Pages::Organisation.new(nil, nil, self), |
||||
Form::Setup::Pages::CreatedBy.new(nil, nil, self), |
||||
Form::Setup::Pages::NeedsType.new(nil, nil, self), |
||||
Form::Setup::Pages::Scheme.new(nil, nil, self), |
||||
Form::Setup::Pages::Location.new(nil, nil, self), |
||||
Form::Setup::Pages::Renewal.new(nil, nil, self), |
||||
Form::Setup::Pages::TenancyStartDate.new(nil, nil, self), |
||||
Form::Setup::Pages::RentType.new(nil, nil, self), |
||||
Form::Setup::Pages::TenantCode.new(nil, nil, self), |
||||
Form::Setup::Pages::PropertyReference.new(nil, nil, self), |
||||
] |
||||
end |
||||
|
||||
def applicable_questions(lettings_log) |
||||
questions.select { |q| support_only_questions.include?(q.id) } + super |
||||
end |
||||
|
||||
def enabled?(_lettings_log) |
||||
true |
||||
end |
||||
|
||||
private |
||||
|
||||
def support_only_questions |
||||
%w[owning_organisation_id created_by_id].freeze |
||||
end |
||||
end |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::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 } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::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 } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::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 } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::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 } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Pages::Location, type: :model do |
||||
RSpec.describe Form::Lettings::Pages::Location, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Pages::NeedsType, type: :model do |
||||
RSpec.describe Form::Lettings::Pages::NeedsType, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Pages::PropertyReference, type: :model do |
||||
RSpec.describe Form::Lettings::Pages::PropertyReference, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Pages::Renewal, type: :model do |
||||
RSpec.describe Form::Lettings::Pages::Renewal, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Pages::RentType, type: :model do |
||||
RSpec.describe Form::Lettings::Pages::RentType, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Pages::Scheme, type: :model do |
||||
RSpec.describe Form::Lettings::Pages::Scheme, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Pages::TenancyStartDate, type: :model do |
||||
RSpec.describe Form::Lettings::Pages::TenancyStartDate, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Pages::TenantCode, type: :model do |
||||
RSpec.describe Form::Lettings::Pages::TenantCode, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Questions::IrproductOther, type: :model do |
||||
RSpec.describe Form::Lettings::Questions::IrproductOther, type: :model do |
||||
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||
|
||||
let(:question_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Questions::LocationId, type: :model do |
||||
RSpec.describe Form::Lettings::Questions::LocationId, type: :model do |
||||
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||
|
||||
let(:question_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Questions::NeedsType, type: :model do |
||||
RSpec.describe Form::Lettings::Questions::NeedsType, type: :model do |
||||
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||
|
||||
let(:question_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Questions::PropertyReference, type: :model do |
||||
RSpec.describe Form::Lettings::Questions::PropertyReference, type: :model do |
||||
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||
|
||||
let(:question_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Questions::Renewal, type: :model do |
||||
RSpec.describe Form::Lettings::Questions::Renewal, type: :model do |
||||
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||
|
||||
let(:question_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Questions::RentType, type: :model do |
||||
RSpec.describe Form::Lettings::Questions::RentType, type: :model do |
||||
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||
|
||||
let(:question_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Questions::SchemeId, type: :model do |
||||
RSpec.describe Form::Lettings::Questions::SchemeId, type: :model do |
||||
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||
|
||||
let(:question_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Questions::TenancyStartDate, type: :model do |
||||
RSpec.describe Form::Lettings::Questions::TenancyStartDate, type: :model do |
||||
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||
|
||||
let(:question_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Questions::TenantCode, type: :model do |
||||
RSpec.describe Form::Lettings::Questions::TenantCode, type: :model do |
||||
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||
|
||||
let(:question_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Setup::Sections::Setup, type: :model do |
||||
RSpec.describe Form::Lettings::Sections::Setup, type: :model do |
||||
subject(:setup) { described_class.new(section_id, section_definition, form) } |
||||
|
||||
let(:section_id) { nil } |
@ -1,11 +1,11 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Subsections::Setup, type: :model do |
||||
RSpec.describe Form::Lettings::Subsections::Setup, type: :model do |
||||
subject(:setup) { described_class.new(subsection_id, subsection_definition, section) } |
||||
|
||||
let(:subsection_id) { nil } |
||||
let(:subsection_definition) { nil } |
||||
let(:section) { instance_double(Form::Setup::Sections::Setup) } |
||||
let(:section) { instance_double(Form::Lettings::Sections::Setup) } |
||||
|
||||
it "has correct section" do |
||||
expect(setup.section).to eq(section) |
@ -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 } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Setup::Pages::SaleDate, type: :model do |
||||
RSpec.describe Form::Sales::Pages::SaleDate, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
@ -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 } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Setup::Questions::SaleDate, type: :model do |
||||
RSpec.describe Form::Sales::Questions::SaleDate, type: :model do |
||||
subject(:question) { described_class.new(question_id, question_definition, page) } |
||||
|
||||
let(:question_id) { nil } |
@ -1,6 +1,6 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Setup::Sections::Setup, type: :model do |
||||
RSpec.describe Form::Sales::Sections::Setup, type: :model do |
||||
subject(:setup) { described_class.new(section_id, section_definition, form) } |
||||
|
||||
let(:section_id) { nil } |
@ -1,11 +1,11 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Sales::Setup::Subsections::Setup, type: :model do |
||||
RSpec.describe Form::Sales::Subsections::Setup, type: :model do |
||||
subject(:setup) { described_class.new(subsection_id, subsection_definition, section) } |
||||
|
||||
let(:subsection_id) { nil } |
||||
let(:subsection_definition) { nil } |
||||
let(:section) { instance_double(Form::Sales::Setup::Sections::Setup) } |
||||
let(:section) { instance_double(Form::Sales::Sections::Setup) } |
||||
|
||||
it "has correct section" do |
||||
expect(setup.section).to eq(section) |
Loading…
Reference in new issue