[rspec-users] Mocks and Refactoring - doing it wrong?

Scott Taylor mailing_lists at railsnewbie.com
Thu Oct 30 02:21:10 EDT 2008


On Oct 30, 2008, at 2:14 AM, Scott Taylor wrote:

>
> On Oct 30, 2008, at 2:01 AM, Sebastian W. wrote:
>
>> Hi Scott,
>> Cool - I see what you're saying here. The only thing that I'm a bit
>> confused still is that it seems like, at least if your system is
>> starting to get larger, you'd really *want* your fast unit test to  
>> help
>> you catch API changes like this to help you make updates faster.
>>
>> Having to run a suite of more expensive integration tests just to  
>> catch
>> API changes seems a little funny. But I guess I'm also hoping that
>> there's some way for the mocks to help with that sort of thing -  
>> it's my
>> understanding that some other frameworks out there help you with that
>> sort of stuff. One example mentioned to me was JMock -- granted,  
>> that's
>> Java, but still - if it's possible in Java, Ruby should be able to  
>> do it
>> too. :P
>
> Most certainly.
>
> David, et. all:
>
> Why don't we have a partial mock which will raise an error (or at  
> least a warning) when stubbing an object who's class doesn't  
> respond_to? the method given?  I feel like this sort of simple  
> dependency has been brought up 1000 times on the list before, but  
> never been explicitly stated.

Also, I'd be game for implementing this, and think it would be a good  
default behavior for the #mock method when passed a class name, but  
not a literal string.

Scott


>
>
> WDYT?
>
> Scott
>
>>
>> -- 
>> Posted via http://www.ruby-forum.com/.
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list