From b66518e3299e1a678f1776de1e5350e7d3d44b63 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Fri, 11 Feb 2022 11:26:06 +0000 Subject: [PATCH] Check all new records have correct validator --- spec/models/case_log_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/models/case_log_spec.rb b/spec/models/case_log_spec.rb index 9833fa672..7999129d1 100644 --- a/spec/models/case_log_spec.rb +++ b/spec/models/case_log_spec.rb @@ -18,6 +18,20 @@ RSpec.describe CaseLog do end describe "#new" do + context "when creating a record" do + let(:case_log) do + described_class.create( + owning_organisation: owning_organisation, + managing_organisation: managing_organisation, + ) + end + + it "attaches the correct custom validator" do + expect(case_log._validators.values.flatten.map(&:class)) + .to include(CaseLogValidator) + end + end + # TODO: replace these with validator specs and checks for method call here context "when a reasonable preference is set to yes" do it "validates that previously homeless should be selected" do