[rspec-users] test spies

David Chelimsky dchelimsky at gmail.com
Tue Apr 13 10:38:53 EDT 2010


On Apr 12, 2010, at 2:38 PM, Michael Guterl wrote:

> On Mon, Apr 12, 2010 at 1:16 PM, David Chelimsky <dchelimsky at gmail.com> wrote:
>> On Apr 12, 2010, at 11:17 AM, Michael Guterl wrote:
>> 
>>> I'm curious what the current state of test spies in rspec is?
>>> 
>>> What is everyone using for this?  not a mock?  rr?  rspec-spies?
>>> I see that spies were going to be added to rspec 1.3.0, but pulled
>>> because of a bug
>>> (https://rspec.lighthouseapp.com/projects/5645/tickets/938), will this
>>> be brought back in?  I really like the rspec standard mock / stub
>>> syntax and am hesitant to move to another solution.
>> 
>> Not-a-mock works. Any reason not to just use that?
>> 
> 
> Mostly because I like the default rspec stub / mock syntax.  Adding
> not-a-mock replaces the entire mock framework:
> 
>  config.mock_with NotAMock::RspecMockFrameworkAdapter
> 
> doing so causes all of my existing specs to break.  It seemed like the
> built-in rspec solution did not require changing all of my existing
> mocks/stubs.

Sounds like not-a-mock is broken then, which is no surprise since rspec's mocks don't really offer any extension APIs. It must have broken after internal changes in rspec-mocks.

Per the lighthouse ticket, the addition of have_received raised new questions about sync'ing the should_receive and have_received APIs. I think that a fair sum of refactoring would be required to do this properly. This is very low on a very long list of priorities right now, so my recommendation is to fix not-a-mock to work with the latest rspec.

HTH,
David


More information about the rspec-users mailing list