Browse Source

Number of bedrooms must be between 1 and 9

pull/1212/head
Kat 3 years ago
parent
commit
10541a3ea6
  1. 4
      app/models/form/sales/questions/property_number_of_bedrooms.rb
  2. 10
      spec/models/form/sales/questions/property_number_of_bedrooms_spec.rb

4
app/models/form/sales/questions/property_number_of_bedrooms.rb

@ -5,7 +5,9 @@ class Form::Sales::Questions::PropertyNumberOfBedrooms < ::Form::Question
@check_answer_label = "Number of bedrooms" @check_answer_label = "Number of bedrooms"
@header = "How many bedrooms does the property have?" @header = "How many bedrooms does the property have?"
@hint_text = "A bedsit has 1 bedroom" @hint_text = "A bedsit has 1 bedroom"
@type = "text" @type = "numeric"
@width = 10 @width = 10
@min = 1
@max = 9
end end
end end

10
spec/models/form/sales/questions/property_number_of_bedrooms_spec.rb

@ -24,7 +24,7 @@ RSpec.describe Form::Sales::Questions::PropertyNumberOfBedrooms, type: :model do
end end
it "has the correct type" do it "has the correct type" do
expect(question.type).to eq("text") expect(question.type).to eq("numeric")
end end
it "is not marked as derived" do it "is not marked as derived" do
@ -34,4 +34,12 @@ RSpec.describe Form::Sales::Questions::PropertyNumberOfBedrooms, type: :model do
it "has the correct hint_text" do it "has the correct hint_text" do
expect(question.hint_text).to eq("A bedsit has 1 bedroom") expect(question.hint_text).to eq("A bedsit has 1 bedroom")
end end
it "has the correct min" do
expect(question.min).to eq(1)
end
it "has the correct max" do
expect(question.max).to eq(9)
end
end end

Loading…
Cancel
Save