|
|
|
@ -93,49 +93,6 @@ RSpec.describe "Form Features" do
|
|
|
|
|
) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "Validate pregnancy questions" do |
|
|
|
|
it "Cannot answer yes if no female tenants" do |
|
|
|
|
expect { |
|
|
|
|
CaseLog.create!(preg_occ: "Yes", |
|
|
|
|
sex1: "Male", |
|
|
|
|
age1: 20) |
|
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "Cannot answer yes if no female tenants within age range" do |
|
|
|
|
expect { |
|
|
|
|
CaseLog.create!(preg_occ: "Yes", |
|
|
|
|
sex1: "Female", |
|
|
|
|
age1: 51) |
|
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "Cannot answer prefer not to say if no valid tenants" do |
|
|
|
|
expect { |
|
|
|
|
CaseLog.create!(preg_occ: "Prefer not to say", |
|
|
|
|
sex1: "Male", |
|
|
|
|
age1: 20) |
|
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "Can answer yes if valid tenants" do |
|
|
|
|
expect { |
|
|
|
|
CaseLog.create!(preg_occ: "Yes", |
|
|
|
|
sex1: "Female", |
|
|
|
|
age1: 20) |
|
|
|
|
}.not_to raise_error |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "Can answer yes if valid second tenant" do |
|
|
|
|
expect { |
|
|
|
|
CaseLog.create!(preg_occ: "Yes", |
|
|
|
|
sex1: "Male", age1: 99, |
|
|
|
|
sex2: "Female", |
|
|
|
|
age2: 20) |
|
|
|
|
}.not_to raise_error |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "can be accessed by url" do |
|
|
|
|
visit("/case_logs/#{id}/person_1_age") |
|
|
|
|
expect(page).to have_field("case-log-age1-field") |
|
|
|
|