diff options
author | Rémy Coutable <remy@rymai.me> | 2018-03-30 18:18:12 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-04-06 18:41:52 +0300 |
commit | 4b035896c4ed188c0b4ab0e0b5d1d97e4fef9886 (patch) | |
tree | fe2c72f9a850a1d16f05e05b85f82cd090b57c7f /spec/support | |
parent | 0fff9db5eac32ae42cc06e31447104ae15c93675 (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.rb | 20 |
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 |