Browse Source

add valid tests

pull/63/head
magicmilo 3 years ago
parent
commit
e2041cec9c
  1. 1
      app/models/case_log.rb
  2. 22
      spec/features/case_log_spec.rb

1
app/models/case_log.rb

@ -71,7 +71,6 @@ class CaseLogValidator < ActiveModel::Validator
end
p += 1
end
return false
end
def validate(record)

22
spec/features/case_log_spec.rb

@ -112,17 +112,17 @@ RSpec.describe "Test Features" do
}.to raise_error(ActiveRecord::RecordInvalid)
end
# it "Can answer yes if valid tenants" do
# expect {
# CaseLog.create!(pregnancy: "Yes", tenant_gender: "Female", tenant_age: 20)
# }.to raise_error(ActiveRecord::RecordInvalid)
# end
# it "Can answer yes if valid second tenant" do
# expect {
# CaseLog.create!(pregnancy: "Yes", tenant_gender: "Male", tenant_age: 99, person_2_gender: "Female", person_2_age: 20)
# }.to raise_error(ActiveRecord::RecordInvalid)
# end
it "Can answer yes if valid tenants" do
expect {
CaseLog.create!(pregnancy: "Yes", tenant_gender: "Female", tenant_age: 20)
}.not_to raise_error(ActiveRecord::RecordInvalid)
end
it "Can answer yes if valid second tenant" do
expect {
CaseLog.create!(pregnancy: "Yes", tenant_gender: "Male", tenant_age: 99, person_2_gender: "Female", person_2_age: 20)
}.not_to raise_error(ActiveRecord::RecordInvalid)
end
end
it "can be accessed by url" do

Loading…
Cancel
Save