We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sometimes, I see people defining a mock and tacking a stub onto the end it:
expect(foo).to receive(:bar).with(42).and_return("hello world") subject.exercise
Now RSpec will expect foo to receive :bar with the argument 42.
foo
:bar
42
If you read the code aloud, it very much sounds like "hello world" should also be part of the expectation. It isn’t.
"hello world"
I can think of at least two ways to rewrite this:
allow(foo).to receive(:bar).with(42).and_return("hello world") expect(foo).to receive(:bar).with(42) subject.exercise
or
allow(foo).to receive(:bar).with(42).and_return("hello world") subject.exercise expect(foo).to have_received(:bar).with(42)
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Sometimes, I see people defining a mock and tacking a stub onto the end it:
Now RSpec will expect
foo
to receive:bar
with the argument42
.If you read the code aloud, it very much sounds like
"hello world"
should also be part of the expectation. It isn’t.I can think of at least two ways to rewrite this:
or
The text was updated successfully, but these errors were encountered: