diff --git a/config/locales/en.yml b/config/locales/en.yml index 5cd4dc087..98e40dfb3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -202,9 +202,9 @@ en: beds: non_positive: "Number of bedrooms has to be greater than 0" over_max: "Number of bedrooms cannot be more than 12" - bedsits_have_max_one_bedroom: "Bedsit bedroom maximum 1" + bedsits_have_max_one_bedroom: "Number of bedrooms must be 1 if the property is a bedsit" proptype: - bedsits_have_max_one_bedroom: "Bedsit maximum 1 bedroom" + bedsits_have_max_one_bedroom: "Answer cannot be 'Bedsit' if the property has 2 or more bedrooms" postcode: must_match_previous: "Buyer's last accommodation and discounted ownership postcodes must match" diff --git a/spec/models/validations/sales/property_validations_spec.rb b/spec/models/validations/sales/property_validations_spec.rb index d5d2d48dd..180f16021 100644 --- a/spec/models/validations/sales/property_validations_spec.rb +++ b/spec/models/validations/sales/property_validations_spec.rb @@ -50,7 +50,7 @@ RSpec.describe Validations::Sales::PropertyValidations do end describe "#validate_property_unit_type" do - context "when number of bedrooms is <= 1" do + context "when number of bedrooms is 1" do let(:record) { FactoryBot.build(:sales_log, beds: 1, proptype: 2) } it "does not add an error if it's a bedsit" do @@ -64,8 +64,8 @@ RSpec.describe Validations::Sales::PropertyValidations do it "does add an error if it's a bedsit" do property_validator.validate_bedsit_number_of_beds(record) - expect(record.errors.added?(:proptype, "Bedsit maximum 1 bedroom")).to be true - expect(record.errors.added?(:beds, "Bedsit bedroom maximum 1")).to be true + expect(record.errors.added?(:proptype, "Answer cannot be 'Bedsit' if the property has 2 or more bedrooms")).to be true + expect(record.errors.added?(:beds, "Number of bedrooms must be 1 if the property is a bedsit")).to be true end it "does not add an error if proptype is undefined" do diff --git a/spec/requests/sales_logs_controller_spec.rb b/spec/requests/sales_logs_controller_spec.rb index e9e0fd93a..8bb02fa8b 100644 --- a/spec/requests/sales_logs_controller_spec.rb +++ b/spec/requests/sales_logs_controller_spec.rb @@ -83,7 +83,7 @@ RSpec.describe SalesLogsController, type: :request do it "validates sales log parameters" do json_response = JSON.parse(response.body) expect(response).to have_http_status(:unprocessable_entity) - expect(json_response["errors"]).to match_array([["beds", ["Bedsit bedroom maximum 1"]], ["proptype", ["Bedsit maximum 1 bedroom"]]]) + expect(json_response["errors"]).to match_array([["beds", ["Number of bedrooms must be 1 if the property is a bedsit"]], ["proptype", ["Answer cannot be 'Bedsit' if the property has 2 or more bedrooms"]]]) end end end