Closed eaden-hnry closed 1 year ago
With the following class,
class Foo def self.mymeth(arg1:, arg2:) end end
The following test passes:
expect(Foo).to receive(:mymeth).with("hello").and_return(true) Foo.mymeth("hello")
I have a couple of questions; Given that receive will validate that Foo actually has a method called mymeth, it seems some validation is taking place.
receive
Foo
mymeth
Should with also validate that the correct keyword arguments are passed?
with
If not, why should receive validate the method exists?
Are you certain you've turned on partial double verification on?
RSpec.configure do |config| config.mock_with :rspec do |mocks| mocks.verify_partial_doubles = true end end
With the following class,
The following test passes:
I have a couple of questions; Given that
receive
will validate thatFoo
actually has a method calledmymeth
, it seems some validation is taking place.Should
with
also validate that the correct keyword arguments are passed?If not, why should receive validate the method exists?