From ead7583ea3bf1baced03e08410b464e758ec6f36 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Sat, 12 Oct 2024 19:30:38 -0400 Subject: [PATCH] Add coverage for rule_ids not matching rules --- spec/models/report_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rb index 97ed01e8c0..64412860fc 100644 --- a/spec/models/report_spec.rb +++ b/spec/models/report_spec.rb @@ -170,6 +170,12 @@ RSpec.describe Report do it { is_expected.to_not allow_value(rule.id).for(:rule_ids) } end + context 'with extra rule ids on a violation' do + subject { Fabricate.build :report, category: :violation } + + it { is_expected.to_not allow_value([nil, Fabricate(:rule).id]).for(:rule_ids) } + end + def comment_over_limit 'a' * described_class::COMMENT_SIZE_LIMIT * 2 end