Browse Source

test: add test for validate_property_number_of_bedrooms (sales)

pull/1188/head
Sam Seed 3 years ago
parent
commit
8ed7081434
  1. 22
      spec/models/validations/sales/property_validations_spec.rb

22
spec/models/validations/sales/property_validations_spec.rb

@ -70,4 +70,26 @@ RSpec.describe Validations::Sales::PropertyValidations do
end
end
end
describe "#validate_property_number_of_bedrooms" 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
property_validator.validate_property_number_of_bedrooms(record)
expect(record.errors).not_to be_present
end
end
context "when number of bedrooms is > 1" do
let(:record) { FactoryBot.build(:sales_log, beds: 2, proptype: 2) }
it "does add an error if it's a bedsit" do
property_validator.validate_property_number_of_bedrooms(record)
expect(record.errors).to be_present
end
end
end
end

Loading…
Cancel
Save