i am trying out minitest, but need some advice on a clean way to test 
validations.

I setup my testing to use minitest by following the following railscast 
plus i added miniskirt for Factories.
http://railscasts.com/episodes/327-minitest-with-rails

everything works well, but there has to be a cleaner way of testing failed 
validations. would i be better off using something besides "must_raise"? if 
not, is there a way to make a helper function or something to clean this up 
so it is more readable? 

-----------------------------------------------------------
require "minitest_helper"  
describe User do
  it "rejects a bad password in validation" do
    user = Factory.build(:user, :password_confirmation => 'Not my password')
    failed_val = lambda { user.save! }
    failed_val.must_raise ActiveRecord::RecordInvalid
    error = failed_val.call rescue $!
    error.message.must_include "Password doesn't match confirmation"
  end
end
---------------------------------------------

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/ePOd5EETM0QJ.
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