6 changed files with 0 additions and 116 deletions
@ -1,12 +0,0 @@
|
||||
class Form::Lettings::Pages::PropertyNumberOfTimesRelet < ::Form::Page |
||||
def initialize(id, hsh, subsection) |
||||
super |
||||
@id = "property_number_of_times_relet" |
||||
@depends_on = [{ "first_time_property_let_as_social_housing" => 0, "is_renewal?" => false }, |
||||
{ "first_time_property_let_as_social_housing" => 1, "is_renewal?" => false }] |
||||
end |
||||
|
||||
def questions |
||||
@questions ||= [Form::Lettings::Questions::Offered.new(nil, nil, self)] |
||||
end |
||||
end |
||||
@ -1,15 +0,0 @@
|
||||
class Form::Lettings::Questions::Offered < ::Form::Question |
||||
def initialize(id, hsh, page) |
||||
super |
||||
@id = "offered" |
||||
@type = "numeric" |
||||
@width = 2 |
||||
@check_answers_card_number = 0 |
||||
@max = 150 |
||||
@min = 0 |
||||
@step = 1 |
||||
@question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) |
||||
end |
||||
|
||||
QUESTION_NUMBER_FROM_YEAR = { 2023 => 18, 2024 => 18, 2025 => 18, 2026 => 18 }.freeze |
||||
end |
||||
@ -1,32 +0,0 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Lettings::Pages::PropertyNumberOfTimesRelet, type: :model do |
||||
subject(:page) { described_class.new(page_id, page_definition, subsection) } |
||||
|
||||
let(:page_id) { nil } |
||||
let(:page_definition) { nil } |
||||
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2024, 4, 1))) } |
||||
|
||||
it "has correct subsection" do |
||||
expect(page.subsection).to eq(subsection) |
||||
end |
||||
|
||||
it "has correct questions" do |
||||
expect(page.questions.map(&:id)).to eq(%w[offered]) |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(page.id).to eq("property_number_of_times_relet") |
||||
end |
||||
|
||||
it "has the correct description" do |
||||
expect(page.description).to be_nil |
||||
end |
||||
|
||||
it "has correct depends_on" do |
||||
expect(page.depends_on).to eq( |
||||
[{ "first_time_property_let_as_social_housing" => 0, "is_renewal?" => false }, |
||||
{ "first_time_property_let_as_social_housing" => 1, "is_renewal?" => false }], |
||||
) |
||||
end |
||||
end |
||||
@ -1,32 +0,0 @@
|
||||
require "rails_helper" |
||||
|
||||
RSpec.describe Form::Lettings::Questions::Offered, type: :model do |
||||
subject(:question) { described_class.new(nil, nil, page) } |
||||
|
||||
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } |
||||
|
||||
it "has correct page" do |
||||
expect(question.page).to be page |
||||
end |
||||
|
||||
it "has the correct id" do |
||||
expect(question.id).to eq "offered" |
||||
end |
||||
|
||||
it "has the correct type" do |
||||
expect(question.type).to eq "numeric" |
||||
end |
||||
|
||||
it "has the correct minimum and maximum values" do |
||||
expect(question.min).to be 0 |
||||
expect(question.max).to be 150 |
||||
end |
||||
|
||||
it "has the correct step" do |
||||
expect(question.step).to be 1 |
||||
end |
||||
|
||||
it "is not marked as derived" do |
||||
expect(question.derived?(nil)).to be false |
||||
end |
||||
end |
||||
Loading…
Reference in new issue