lib/rubocop/cop/rspec/expect_change.rb in rubocop-rspec-1.35.0 vs lib/rubocop/cop/rspec/expect_change.rb in rubocop-rspec-1.36.0
- old
+ new
@@ -10,25 +10,25 @@
#
# This cop can be configured using the `EnforcedStyle` option.
#
# @example `EnforcedStyle: block`
# # bad
- # expect(run).to change(Foo, :bar)
+ # expect { run }.to change(Foo, :bar)
#
# # good
- # expect(run).to change { Foo.bar }
+ # expect { run }.to change { Foo.bar }
#
# @example `EnforcedStyle: method_call`
# # bad
- # expect(run).to change { Foo.bar }
- # expect(run).to change { foo.baz }
+ # expect { run }.to change { Foo.bar }
+ # expect { run }.to change { foo.baz }
#
# # good
- # expect(run).to change(Foo, :bar)
- # expect(run).to change(foo, :baz)
+ # expect { run }.to change(Foo, :bar)
+ # expect { run }.to change(foo, :baz)
# # also good when there are arguments or chained method calls
- # expect(run).to change { Foo.bar(:count) }
- # expect(run).to change { user.reload.name }
+ # expect { run }.to change { Foo.bar(:count) }
+ # expect { run }.to change { user.reload.name }
#
class ExpectChange < Cop
include ConfigurableEnforcedStyle
MSG_BLOCK = 'Prefer `change(%<obj>s, :%<attr>s)`.'