[rspec-users] Mock or Stub strategy for validates_uniqueness_of

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

On 24 Jul 2007, at 14:49, Daniel N wrote:

> That looks like the kind of thing I was initially thinking of, but  
> I started to think that having all those objects being created in a  
> non-related spec could lead to trouble.  If I change what makes any  
> of those objects valid, these supposedly unrelated specs will then  
> break.

Yep, I've had that several times unfortunately...

> I want to try and keep everything seperate, but in this case it  
> seems that things are interdependent.

from the other email...

> It hits the database, but the valid_clipping_attributes are mocks  
> that are used throughout the spec so it's divorced from the other  
> specs.

I like the idea of separating out the valid atributes.  Most of my  
models start along the lines of
   "An XModel created with valid attributes should be valid"
this sanity checks that I know what a valid model is and means if  
anything goes wrong I don't waste hours hunting through


More information about the rspec-users mailing list