From 4bf6af3b6119d9c5fc4a67f066ccbd9d8431b413 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 12 Dec 2024 05:28:05 -0500 Subject: [PATCH] Remove unused `model_have_error_on_field` matcher (#33273) --- spec/models/form/import_spec.rb | 5 +---- .../matchers/model/model_have_error_on_field.rb | 15 --------------- 2 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 spec/support/matchers/model/model_have_error_on_field.rb diff --git a/spec/models/form/import_spec.rb b/spec/models/form/import_spec.rb index e14ad6eca0..dd8fd35a05 100644 --- a/spec/models/form/import_spec.rb +++ b/spec/models/form/import_spec.rb @@ -61,10 +61,7 @@ RSpec.describe Form::Import do let(:import_type) { 'following' } let(:import_file) { 'boop.ogg' } - it 'has errors' do - # NOTE: not testing more specific error because we don't know the string to match - expect(subject).to model_have_error_on_field(:data) - end + it { is_expected.to_not allow_value(data).for(:data) } end context 'when importing more follows than allowed' do diff --git a/spec/support/matchers/model/model_have_error_on_field.rb b/spec/support/matchers/model/model_have_error_on_field.rb deleted file mode 100644 index 0f9c81a475..0000000000 --- a/spec/support/matchers/model/model_have_error_on_field.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -RSpec::Matchers.define :model_have_error_on_field do |expected| - match do |record| - record.valid? if record.errors.empty? - - record.errors.key?(expected) - end - - failure_message do |record| - keys = record.errors.attribute_names - - "expect record.errors(#{keys}) to include #{expected}" - end -end