Browse Source

tests

pull/70/head
magicmilo 3 years ago
parent
commit
1cf1197096
  1. 1
      app/models/case_log.rb
  2. 30
      spec/models/case_log_spec.rb

1
app/models/case_log.rb

@ -111,6 +111,7 @@ private
next if record["person_#{n}_gender"].nil? || record["person_#{n}_age"].nil? next if record["person_#{n}_gender"].nil? || record["person_#{n}_age"].nil?
count += 1 count += 1
end end
return count
end end
end end

30
spec/models/case_log_spec.rb

@ -96,6 +96,36 @@ RSpec.describe Form, type: :model do
}.to raise_error(ActiveRecord::RecordInvalid) }.to raise_error(ActiveRecord::RecordInvalid)
end end
end end
context "Shared accomodation bedrooms validation" do
it "you must have more than zero bedrooms" do
expect {
CaseLog.create!(property_unit_type: "Shared house",
property_number_of_bedrooms: 0)
}.to raise_error(ActiveRecord::RecordInvalid)
end
it "you must answer less than 8 bedrooms" do
expect {
CaseLog.create!(property_unit_type: "Shared bungalow",
property_number_of_bedrooms: 8)
}.to raise_error(ActiveRecord::RecordInvalid)
end
it "A bedsit must only have one room" do
expect {
CaseLog.create!(property_unit_type: "Bed-sit",
property_number_of_bedrooms: 2)
}.to raise_error(ActiveRecord::RecordInvalid)
end
it "A bedsit must only have one room" do
expect {
CaseLog.create!(property_unit_type: "Bed-sit",
property_number_of_bedrooms: 0)
}.to raise_error(ActiveRecord::RecordInvalid)
end
end
end end
describe "status" do describe "status" do

Loading…
Cancel
Save