lib/rubocop/cop/rspec/verified_doubles.rb in rubocop-rspec-1.22.2 vs lib/rubocop/cop/rspec/verified_doubles.rb in rubocop-rspec-1.23.0
- old
+ new
@@ -7,16 +7,21 @@
#
# @see https://relishapp.com/rspec/rspec-mocks/docs/verifying-doubles
#
# @example
# # bad
- # it '...' do
- # widget = double("Widget")
+ # let(:foo) do
+ # double(method_name: 'returned value')
# end
#
+ # # bad
+ # let(:foo) do
+ # double("ClassName", method_name: 'returned value')
+ # end
+ #
# # good
- # it '...' do
- # widget = instance_double("Widget")
+ # let(:foo) do
+ # instance_double("ClassName", method_name: 'returned value')
# end
class VerifiedDoubles < Cop
MSG = 'Prefer using verifying doubles over normal doubles.'.freeze
def_node_matcher :unverified_double, <<-PATTERN