Sha256: 80afac7c2bf3790b2ceac1f87cf922d6f5423469da8090d1e003579c4b78dbc5

Contents?: true

Size: 1.45 KB

Versions: 9

Compression:

Stored size: 1.45 KB

Contents

require "test_helper"

class Encryptors < ActiveSupport::TestCase
  include Support::Swappers

  test 'should match a password created by authlogic' do
    authlogic = "b623c3bc9c775b0eb8edb218a382453396fec4146422853e66ecc4b6bc32d7162ee42074dcb5f180a770dc38b5df15812f09bbf497a4a1b95fe5e7d2b8eb7eb4"
    encryptor = Devise::Encryptable::Encryptors::AuthlogicSha512.digest('123mudar', 20, 'usZK_z_EAaF61Gwkw-ed', '')
    assert_equal authlogic, encryptor
  end

  test 'should match a password created by restful_authentication' do
    restful_authentication = "93110f71309ce91366375ea44e2a6f5cc73fa8d4"
    encryptor = Devise::Encryptable::Encryptors::RestfulAuthenticationSha1.digest('123mudar', 10, '48901d2b247a54088acb7f8ea3e695e50fe6791b', 'fee9a51ec0a28d11be380ca6dee6b4b760c1a3bf')
    assert_equal restful_authentication, encryptor
  end

  test 'should match a password created by clearance' do
    clearance = "0f40bbae18ddefd7066276c3ef209d40729b0378"
    encryptor = Devise::Encryptable::Encryptors::ClearanceSha1.digest('123mudar', nil, '65c58472c207c829f28c68619d3e3aefed18ab3f', nil)
    assert_equal clearance, encryptor
  end

  Devise::ENCRYPTORS_LENGTH.each do |key, value|
    test "should have length #{value} for #{key.inspect}" do
      swap Devise, :encryptor => key do
        encryptor = Devise::Encryptable::Encryptors.const_get(key.to_s.classify)
        assert_equal value, encryptor.digest('a', 4, encryptor.salt(4), nil).size
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
devise-encryptable-0.1.2 test/devise/encryptable/encryptors_test.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/devise-encryptable-0.1.1/test/devise/encryptable/encryptors_test.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/devise-encryptable-0.1.1/test/devise/encryptable/encryptors_test.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/devise-encryptable-0.1.1/test/devise/encryptable/encryptors_test.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/devise-encryptable-0.1.1/test/devise/encryptable/encryptors_test.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/devise-encryptable-0.1.1/test/devise/encryptable/encryptors_test.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/devise-encryptable-0.1.1/test/devise/encryptable/encryptors_test.rb
devise-encryptable-0.1.1 test/devise/encryptable/encryptors_test.rb
devise-encryptable-0.1.0 test/devise/encryptable/encryptors_test.rb