|
|
@ -5,6 +5,7 @@ RSpec.describe Form::Sales::Questions::LivingBeforePurchaseYears, type: :model d |
|
|
|
|
|
|
|
|
|
|
|
let(:question_id) { nil } |
|
|
|
let(:question_id) { nil } |
|
|
|
let(:question_definition) { nil } |
|
|
|
let(:question_definition) { nil } |
|
|
|
|
|
|
|
let(:start_date) { Time.utc(2024, 2, 8) } |
|
|
|
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date:)) } |
|
|
|
let(:subsection) { instance_double(Form::Subsection, form: instance_double(Form, start_date:)) } |
|
|
|
let(:page) { instance_double(Form::Page, subsection:) } |
|
|
|
let(:page) { instance_double(Form::Page, subsection:) } |
|
|
|
|
|
|
|
|
|
|
@ -47,10 +48,6 @@ RSpec.describe Form::Sales::Questions::LivingBeforePurchaseYears, type: :model d |
|
|
|
expect(question.step).to eq(1) |
|
|
|
expect(question.step).to eq(1) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "has correct suffix" do |
|
|
|
|
|
|
|
expect(question.suffix).to eq(" years") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "has correct min" do |
|
|
|
it "has correct min" do |
|
|
|
expect(question.min).to eq(0) |
|
|
|
expect(question.min).to eq(0) |
|
|
|
end |
|
|
|
end |
|
|
@ -99,10 +96,6 @@ RSpec.describe Form::Sales::Questions::LivingBeforePurchaseYears, type: :model d |
|
|
|
expect(question.step).to eq(1) |
|
|
|
expect(question.step).to eq(1) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "has correct suffix" do |
|
|
|
|
|
|
|
expect(question.suffix).to eq(" years") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "has correct min" do |
|
|
|
it "has correct min" do |
|
|
|
expect(question.min).to eq(0) |
|
|
|
expect(question.min).to eq(0) |
|
|
|
end |
|
|
|
end |
|
|
@ -111,4 +104,20 @@ RSpec.describe Form::Sales::Questions::LivingBeforePurchaseYears, type: :model d |
|
|
|
expect(question.max).to eq(80) |
|
|
|
expect(question.max).to eq(80) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when 1 year" do |
|
|
|
|
|
|
|
let(:sales_log) { FactoryBot.build(:sales_log, proplen: 1) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "has correct suffix" do |
|
|
|
|
|
|
|
expect(question.suffix_label(sales_log)).to eq(" year") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when multiple years" do |
|
|
|
|
|
|
|
let(:sales_log) { FactoryBot.build(:sales_log, proplen: 5) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "has correct suffix" do |
|
|
|
|
|
|
|
expect(question.suffix_label(sales_log)).to eq(" years") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|