[rspec-users] spec'ing validates_uniqueness_of :whatever

Steven Baker steven at stevenrbaker.com
Fri Apr 4 02:12:47 EDT 2008

>> If you were to write an example that creates two models, and ensures
>> that the duplicate errored appropriately, my "rule" is violated.   
>> Each
>> of your examples is then specifying the behaviour of the
>> validates_uniqueness_of method, which you didn't write.
> I don't really agree with this.  The desired behavior is to disallow
> two records with the same data.  v_u_o is simply a quick and easy
> means to that end.

Right.  As I said (or intended to) that particular example was so  
simple that it was a grey area.  But it did cause me to think about  
the problem, and I found it interesting.


More information about the rspec-users mailing list