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:
authorRémy Coutable <remy@rymai.me>2018-03-30 18:18:12 +0300
committerRémy Coutable <remy@rymai.me>2018-04-06 18:41:52 +0300
commit4b035896c4ed188c0b4ab0e0b5d1d97e4fef9886 (patch)
treefe2c72f9a850a1d16f05e05b85f82cd090b57c7f /spec/support
parent0fff9db5eac32ae42cc06e31447104ae15c93675 (diff)
Introduce a new FactoriesInMigrationSpecs cop
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/helpers/expect_offense.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/support/helpers/expect_offense.rb b/spec/support/helpers/expect_offense.rb
new file mode 100644
index 00000000000..35718ba90c5
--- /dev/null
+++ b/spec/support/helpers/expect_offense.rb
@@ -0,0 +1,20 @@
+require 'rubocop/rspec/support'
+
+# https://github.com/backus/rubocop-rspec/blob/master/spec/support/expect_offense.rb
+# rubocop-rspec gem extension of RuboCop's ExpectOffense module.
+#
+# This mixin is the same as rubocop's ExpectOffense except the default
+# filename ends with `_spec.rb`
+module ExpectOffense
+ include RuboCop::RSpec::ExpectOffense
+
+ DEFAULT_FILENAME = 'example_spec.rb'.freeze
+
+ def expect_offense(source, filename = DEFAULT_FILENAME)
+ super
+ end
+
+ def expect_no_offenses(source, filename = DEFAULT_FILENAME)
+ super
+ end
+end