Philip Hallstrom wrote in post #960209: > On Nov 8, 2010, at 3:28 PM, Anthony Smith wrote: > >> My thought is that it verifies you're receiving the error you expected and >> not > an artifact from another issue. So my intention is not to test Rails but > to make > sure my tests are doing what I'm expecting. Does that make sense or am I > just > paranoid? > > Both :) Instead of testing the specific error message which could > change you could test to make sure there is N (or at least N) number of > errors on @account.name. That would solve your issue of it being > invalid for some unrelated reason.
That's still testing Rails instead of your code. Instead, here's what I do: before :each do @account = Account.make # from a factory with valid values end it "should be valid with valid values" @account.should be_valid # now we have our baseline end it "should not be valid without a name" @account.name = nil @account.should_not be_valid end ...and so on. This is the best stolidity I've been able to figure out. Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

