[rspec-users] Mock or Stub strategy for validates_uniqueness_of

Ashley Moran work at ashleymoran.me.uk
Wed Jul 25 10:30:24 EDT 2007


On 25 Jul 2007, at 01:07, Kyle Hargraves wrote:

> Going through reflect_on_association feels too much like specifying  
> the
> use of a particular implementation, rather than the desired outcome.

I second that.  I agree that you should only test the code you write,  
but unfortunately(!) you get a lot of behaviour for each line of code  
you write in rails, so I prefer to test the expected behaviour than  
signs that the behaviour is in place

Sometimes I'm forced to break this, in which case I write an  
assumption spec that tests a single case of what the library should  
be doing, then test that I interact with it properly.

Ashley




More information about the rspec-users mailing list