-
-
Notifications
You must be signed in to change notification settings - Fork 284
Closed
Description
When processing the following code:
# spec/lib/application/configuration_spec.rb
describe '.ignore' do
context 'when the block is given' do
it 'changes the count of the registered regex' do
expect do
described_class.ignore do |ignore|
ignore << /(a|b)/
ignore.push(/.*/)
end
end.to change(described_class.ignore, :count).by(2)
end
end
endI have the next recommendation:
spec/lib/application/configuration_spec.rb:33:13: C: FactoryBot/AttributeDefinedStatically: Use a block to declare attribute values.
ignore.push(/.*/)
^^^^^^^^^^^^Also, I have the same recommendation in another file:
# spec/dummy/config/initializers/seo.rb
config.ignore do |ignore|
ignore.push(%r{\A/admin.*}.freeze)
ignore.push(%r{\A/\z}.freeze)
endspec/dummy/config/initializers/seo.rb:28:5: C: FactoryBot/AttributeDefinedStatically: Use a block to declare attribute values.
ignore.push(%r{\A/admin.*}.freeze)
^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/dummy/config/initializers/seo.rb:29:5: C: FactoryBot/AttributeDefinedStatically: Use a block to declare attribute values.
ignore.push(%r{\A/\z}.freeze)
^^^^^^^^^^^^^^^^^^^^^^rubocop -V
0.93.1 (using Parser 2.7.2.0, rubocop-ast 0.8.0, running on ruby 2.6.5 x86_64-darwin20)
bundle info rubocop-rspec
* rubocop-rspec (1.43.2)
Summary: Code style checking for RSpec files
Homepage: https://github.com/rubocop-hq/rubocop-rspec
Path: /Users/chubchenko/.rvm/gems/ruby-2.6.5/gems/rubocop-rspec-1.43.2Metadata
Metadata
Assignees
Labels
No labels