On Wed, Aug 22, 2012 at 9:16 AM, J. B. Rainsberger <m...@jbrains.ca> wrote: > On Wed, Aug 22, 2012 at 10:07 AM, David Chelimsky <dchelim...@gmail.com> > wrote: >> >> On Wed, Aug 22, 2012 at 7:52 AM, J. B. Rainsberger <m...@jbrains.ca> wrote: >> > On Tue, Aug 21, 2012 at 11:37 PM, Bas Vodde <b...@odd-e.com> wrote: >> >> >> >> >> >> JB is right. >> >> >> >> Sometimes, for clarity, it is useful to add should_not, but for >> >> functionality it is usually not needed. >> > >> > >> > I know JMock has never() for this people. Should RSpec-mocks have >> > something >> > like object.should_receive(:nothing). >> >> never() is not a catch all for _all_ messages. It is for a specific >> message, just like it is in rspec-mocks >> >> # rspec >> object.should_receive(:msg).never >> >> #jmock >> never(object).msg() > > > In JMock, you can write this: > > never(object); > > and this means "never anything". Just like > > ignoring(object); > allowing(object); > > which each equate to mock().as_null_object().
Perhaps it goes without saying, but I was not aware of that ;) As you noted earlier this thread (not quoted above) RSpec::Mocks::Mock instances (returned by double(), mock(), or stub()) are strict by default - e.g. they'll complain about any unexpected messages. Obviously that does not account for any real objects. I'm open to adding an API for this, but not object.should_receive(:nothing) since that syntax is for declaring expected messages. Other ideas welcome. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users