Skip to content

Instantly share code, notes, and snippets.

@czj
Created May 22, 2012 11:19
Show Gist options
  • Save czj/2768433 to your computer and use it in GitHub Desktop.
Save czj/2768433 to your computer and use it in GitHub Desktop.
Testing validations with MiniTest + Factory Girl
require "minitest_helper"
describe User do
it "rejects a bad password in validation" do
user = Factory.build(:user, :password_confirmation => 'Not my password')
user.invalid?(:password_confirmation).must_equal true
user.errors[:password_confirmation].must_equal "Password doesn't match confirmation"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment