Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/matchers/nullify_if_blank_matcher.rb')
-rw-r--r--spec/support/matchers/nullify_if_blank_matcher.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/support/matchers/nullify_if_blank_matcher.rb b/spec/support/matchers/nullify_if_blank_matcher.rb
new file mode 100644
index 00000000000..8f6737499cc
--- /dev/null
+++ b/spec/support/matchers/nullify_if_blank_matcher.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+RSpec::Matchers.define :nullify_if_blank do |attribute|
+ match do |record|
+ expect(record.class.attributes_to_nullify).to include(attribute)
+ end
+
+ failure_message do |record|
+ "expected nullify_if_blank configuration on #{record.class} to include #{attribute}"
+ end
+end