Sha256: ec289f0bbd4d0dd4707a33d0656c095df6429d9769e69a1e8e391a2ef0950256
Contents?: true
Size: 914 Bytes
Versions: 8
Compression:
Stored size: 914 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module RSpec # Prefer using verifying doubles over normal doubles. # # @see https://relishapp.com/rspec/rspec-mocks/docs/verifying-doubles # # @example # # bad # it '...' do # widget = double("Widget") # end # # # good # it '...' do # widget = instance_double("Widget") # end class VerifiedDoubles < Cop MSG = 'Prefer using verifying doubles over normal doubles.'.freeze def_node_matcher :unverified_double, <<-PATTERN {(send nil {:double :spy} $_ ...) } PATTERN def on_send(node) unverified_double(node) do |name| return if name.sym_type? && cop_config['IgnoreSymbolicNames'] add_offense(node, :expression) end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems