Don't allow object.should_not_receive(:m).and_return #134

Closed
dchelimsky opened this Issue May 5, 2012 · 1 comment

Projects

None yet

2 participants

@dchelimsky
RSpec member

See #132 for background.

The following is misleading and should not be allowed:

object.should_not_receive(:message).and_return value

If the object should_not_receive the message, than there is no need to assign a return value.

Let's raise an error in 3.0 recommending the user remove and_return, and add a deprecation warning in a 2.x release with the same message.

@Bodhisattva2-0 Bodhisattva2-0 pushed a commit to c42engineering/rspec-mocks that referenced this issue Jun 8, 2012
Neha Kumari Issue #134: Add deprecation warning for should_not_receive followed b…
…y and_return.
a1bc823
@Bodhisattva2-0 Bodhisattva2-0 referenced this issue Jun 9, 2012
Closed

Issue134 #149

@Bodhisattva2-0 Bodhisattva2-0 pushed a commit to c42engineering/rspec-mocks that referenced this issue Jun 11, 2012
Neha Kumari Issue #134: Add deprecation warning for should_not_receive followed b…
…y and_return.
15c84d7
@JonRowe
RSpec member

Was this resolved by #151, or is it good practise to keep this open until the "behaviour" is actually removed?

@samphippen samphippen closed this in #299 May 29, 2013
@arsduo arsduo pushed a commit to arsduo/koala that referenced this issue Feb 1, 2014
Cyril Fluck Clean code generating a deprecation warning
should_not_receive can't be used with and_return
See rspec/rspec-mocks#134
c2f9cb7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment