Displaying 1 result from an estimated 1 matches for "failed_val".
2012 Mar 13
4
minitest validations - is there a cleaner way?
...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...