Skip to content

Instantly share code, notes, and snippets.

@seth-macpherson
Created September 25, 2013 22:35
Show Gist options
  • Save seth-macpherson/6707046 to your computer and use it in GitHub Desktop.
Save seth-macpherson/6707046 to your computer and use it in GitHub Desktop.
require './test/test_helper.rb'
require "password_policy"
class MyPasswordTest < ActiveSupport::TestCase
def test_min_length
password = "howdy"
policy = PasswordPolicy.new({:min_length => 6})
assert_equal(false, policy.validate(password))
assert(policy.errors.first =~ /Password must be at least 6/)
password += "extra-char"
assert policy.validate(password)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment