Sha256: d0a9996b18c0d71a7cae52ec7a33d91b4674a8ff87829a59606ef1fc0ecf6221

Contents?: true

Size: 1012 Bytes

Versions: 3

Compression:

Stored size: 1012 Bytes

Contents

require File.expand_path("helper", File.dirname(__FILE__))

# Shield::Password::Simple
scope do
  test "encrypt" do
    encrypted = Shield::Password.encrypt("password")
    assert Shield::Password.check("password", encrypted)
  end

  test "with custom 64 character salt" do
    encrypted = Shield::Password.encrypt("password", "A" * 64)
    assert Shield::Password.check("password", encrypted)
  end

  test "nil password doesn't raise" do
    ex = nil

    begin
      encrypted = Shield::Password.encrypt(nil)
    rescue Exception => e
      ex = e
    end

    assert nil == ex
  end
end

# Shield::Password::PBKDF2
scope do
  setup do
    Shield::Password.strategy = Shield::Password::PBKDF2
  end

  test "encrypt" do
    encrypted = Shield::Password.encrypt("password")
    assert Shield::Password.check("password", encrypted)
  end

  test "with custom 64 character salt" do
    encrypted = Shield::Password.encrypt("password", "A" * 64)
    assert Shield::Password.check("password", encrypted)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shield-0.1.0 test/password.rb
shield-0.1.0.rc1 test/password.rb
shield-0.0.4 test/password_hash_test.rb