Skip to content

Commit a94f456

Browse files
authored
Merge pull request rubocop#793 from ydah/fix-doc-for-allowed-pattern
Fix a wrong AllowedPatterns example in `Rails/FindEach`
2 parents 313cd20 + 6d01925 commit a94f456

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/rubocop/cop/rails/find_each.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module Rails
1717
# # good
1818
# User.order(:foo).each
1919
#
20-
# @example AllowedPattern: [/order/]
20+
# @example AllowedPattern: ['order']
2121
# # good
2222
# User.order(:foo).each
2323
class FindEach < Base

spec/rubocop/cop/rails/find_each_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class C < ActiveRecord::Base
142142
end
143143

144144
context 'allowed patterns' do
145-
let(:cop_config) { { 'AllowedMethods' => [], 'AllowedPatterns' => [/order/, /lock/], 'IgnoredMethods' => [] } }
145+
let(:cop_config) { { 'AllowedMethods' => [], 'AllowedPatterns' => %w[order lock], 'IgnoredMethods' => [] } }
146146

147147
it 'does not register an offense when using order(...) earlier' do
148148
expect_no_offenses('User.order(:name).each { |u| u.something }')

0 commit comments

Comments
 (0)