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.


> On Nov 8, 2010, at 6:14 PM, Marnen Laibow-Koser wrote:
> 
>> Anthony Smith wrote in post #960202:
>>> For example:
>>> 
>>> it 'should not validate if nil' do
>>>     @account.name = nil
>>>     @account.should_not be_valid
>> 
>> Those two lines are good practice: you're testing that the object is 
>> invalid when you want it to be.
>> 
>>>     @account.errors[:name][0].should eq 'can\'t be blank'
>> 
>> That line seems unnecessary: you're testing the Rails framework, which 
>> is already well tested.
>> 
>>> end
>>> 
>>> Is this good practice?
>> 
>> 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.
>> 
> 
> -- 
> 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.
> 

-- 
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.

Reply via email to