Browse Source

Test the whole validation

pull/45/head
baarkerlounger 4 years ago
parent
commit
868abda643
  1. 8
      spec/models/case_log_spec.rb

8
spec/models/case_log_spec.rb

@ -2,8 +2,16 @@ require "rails_helper"
RSpec.describe Form, type: :model do RSpec.describe Form, type: :model do
describe "#new" do describe "#new" do
it "validates age is a number" do
expect { CaseLog.create!(tenant_age: "random") }.to raise_error(ActiveRecord::RecordInvalid)
end
it "validates age is under 120" do it "validates age is under 120" do
expect { CaseLog.create!(tenant_age: 121) }.to raise_error(ActiveRecord::RecordInvalid) expect { CaseLog.create!(tenant_age: 121) }.to raise_error(ActiveRecord::RecordInvalid)
end end
it "validates age is over 0" do
expect { CaseLog.create!(tenant_age: 0) }.to raise_error(ActiveRecord::RecordInvalid)
end
end end
end end

Loading…
Cancel
Save