class RuboCop::Cop::RSpec::AnyInstance

end
end
allow(my_instance).to receive(:foo)
allow(MyClass).to receive(:new).and_return(my_instance)
before do
let(:my_instance) { instance_double(MyClass) }
describe MyClass do
# good
end
before { allow_any_instance_of(MyClass).to receive(:foo) }
describe MyClass do
# bad
@example
Prefer instance doubles over stubbing any instance of a class
Check that instances are not being stubbed globally.

def on_send(node)

def on_send(node)
  disallowed_stub(node) do |method|
    add_offense(
      node,
      message: format(MSG, method: method)
    )
  end
end