Browse Source

Number of bedrooms must be between 1 and 9 (#1212)

CLDC-869-add-validations-for-initial-equity-for-shared-ownership
kosiakkatrina 2 years ago committed by GitHub
parent
commit
c035b905f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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