[Rails] Re: Rspec unit test fails sometimes (validation race conditi

2010-05-24 Thread Marnen Laibow-Koser
Milan Dobrota wrote: In the specs it is actually 10.times instead of 9. Milan Dobrota wrote: post = Post.make 9.times { Comment.make(:post = post) } comment = Comment.new(:post = post) comment.save.should be_false Well, there's your problem, then -- you've already made your 10th comment!

[Rails] Re: Rspec unit test fails sometimes (validation race conditi

2010-05-24 Thread Milan Dobrota
No because validations happen before the object is saved. Validation will pass and the object will get saved properly. Well... sometimes. Sometimes not. Marnen Laibow-Koser wrote: Well, there's your problem, then -- you've already made your 10th comment! BTW, you should consider