|
|
|
@ -24,4 +24,24 @@ RSpec.describe Location, type: :model do
|
|
|
|
|
.to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Postcode Enter a postcode in the correct format, for example AA1 1AA") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#units" do |
|
|
|
|
let(:location) { FactoryBot.build(:location) } |
|
|
|
|
|
|
|
|
|
it "does add an error when the postcode is invalid" do |
|
|
|
|
location.units = nil |
|
|
|
|
expect { location.save! } |
|
|
|
|
.to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Units Enter total number of units at this location") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "#type_of_unit" do |
|
|
|
|
let(:location) { FactoryBot.build(:location) } |
|
|
|
|
|
|
|
|
|
it "does add an error when the postcode is invalid" do |
|
|
|
|
location.type_of_unit = nil |
|
|
|
|
expect { location.save! } |
|
|
|
|
.to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Type of unit Select the most common type of unit at this location") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|