[rspec-users] Mock should receive no messages?

Pat Maddox pat.maddox at gmail.com
Thu Jun 4 20:53:38 EDT 2009


On Wed, Jun 3, 2009 at 10:46 AM, Sebastian W. <lists at ruby-forum.com> wrote:
> Hello all,
> Is there a way to explicitly tell a mock to expect no messages and give
> an error if it does? I believe this is the default behavior, but thought
> it might be nice for code readers to see.

Document it in the mock object's name.

my_mock = mock('never receives a message')

I don't see any reason why something should be added to RSpec core.

Pat


More information about the rspec-users mailing list