Displaying 1 result from an estimated 1 matches for "minitest_help".
Did you mean:
minitest_helper
2012 Mar 13
4
minitest validations - is there a cleaner way?
...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.c...