From e2041cec9c28a64c5ff4a8cd9c594b8bc38d60eb Mon Sep 17 00:00:00 2001 From: magicmilo Date: Mon, 25 Oct 2021 16:30:20 +0100 Subject: [PATCH] add valid tests --- app/models/case_log.rb | 1 - spec/features/case_log_spec.rb | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 4bc71db3f..43946e75e 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -71,7 +71,6 @@ class CaseLogValidator < ActiveModel::Validator end p += 1 end - return false end def validate(record) diff --git a/spec/features/case_log_spec.rb b/spec/features/case_log_spec.rb index e915e97a6..8d1435885 100644 --- a/spec/features/case_log_spec.rb +++ b/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