[rspec-users] How to test update_attribute with mocha?

Phlip phlip2005 at gmail.com
Fri May 15 10:13:29 EDT 2009

Matt Wynne wrote:

> On the other hand, if the tests fail for no good reason all the time 
> because they're fragile, people may stop listening to them, and maybe 
> eventually stop writing them. The argument I'm making is really just for 
> slowing down and taking a little more care, with the eventual benefit of 
> tests that are trustworthy and easy to maintain. I would imagine that's 
> your goal too, but we apparently have different approaches :)

The specific umbrage I took over mocking to detect a update_attribute is I 
worked for 2.5 years on a huge Rails project with hundreds of tests, including 
mocks, including controller tests that went a little too far, including very 
fragile tests, and I never once had the inclination to mock update_attribute. 
The real attribute is just so easy to detect!

Run fragile tests more often and revert more often.


More information about the rspec-users mailing list