Sha256: 976eeccec4daa6ed93ade5a90483761df55a5002462908024ed2cc44baf635db

Contents?: true

Size: 1.42 KB

Versions: 37

Compression:

Stored size: 1.42 KB

Contents

require File.dirname(__FILE__) + '/../test_helper.rb'

module ActsAsAuthenticTest
  class SingleAccessTest < ActiveSupport::TestCase
    def test_change_single_access_token_with_password_config
      assert !User.change_single_access_token_with_password
      assert !Employee.change_single_access_token_with_password
      
      User.change_single_access_token_with_password = true
      assert User.change_single_access_token_with_password
      User.change_single_access_token_with_password false
      assert !User.change_single_access_token_with_password
    end
    
    def test_validates_uniqueness_of_single_access_token
      u = User.new
      u.single_access_token = users(:ben).single_access_token
      assert !u.valid?
      assert u.errors[:single_access_token].size > 0
    end
    
    def test_before_validation_reset_single_access_token
      u = User.new
      assert !u.valid?
      assert_not_nil u.single_access_token
    end
    
    def test_after_password_set_reset_single_access_token
      User.change_single_access_token_with_password = true
      
      ben = users(:ben)
      old_single_access_token = ben.single_access_token
      ben.password = "new_pass"
      assert_not_equal old_single_access_token, ben.single_access_token
      
      User.change_single_access_token_with_password = false
    end
    
    def test_after_password_set_is_not_called
      ldaper = Ldaper.new
      assert ldaper.save
    end
  end
end

Version data entries

37 entries across 37 versions & 15 rubygems

Version Path
authlogic-2.1.11 test/acts_as_authentic_test/single_access_test.rb
authlogic-2.1.10 test/acts_as_authentic_test/single_access_test.rb
binarylogic-authlogic-2.1.0 test/acts_as_authentic_test/single_access_test.rb
binarylogic-authlogic-2.1.1 test/acts_as_authentic_test/single_access_test.rb
crankharder-authlogic-2.1.1 test/acts_as_authentic_test/single_access_test.rb
jlecour-authlogic-2.1.2 test/acts_as_authentic_test/single_access_test.rb
kschrader-authlogic-2.1.2 test/acts_as_authentic_test/single_access_test.rb
kschrader-authlogic-2.1.3 test/acts_as_authentic_test/single_access_test.rb
authlogic-2.1.8 test/acts_as_authentic_test/single_access_test.rb
authlogic-2.1.7 test/acts_as_authentic_test/single_access_test.rb
expertiza-authlogic-2.1.6.1 test/acts_as_authentic_test/single_access_test.rb
wulffeld_authlogic-2.1.3 test/acts_as_authentic_test/single_access_test.rb
authlogic-2.1.6 test/acts_as_authentic_test/single_access_test.rb
lockbox_middleware-1.2.1 vendor/gems/authlogic-2.1.3/test/acts_as_authentic_test/single_access_test.rb
Empact-authlogic-2.1.5 test/acts_as_authentic_test/single_access_test.rb
authlogic-2.1.5 test/acts_as_authentic_test/single_access_test.rb
authlogic-2.1.4 test/acts_as_authentic_test/single_access_test.rb
Empact-authlogic-2.1.4 test/acts_as_authentic_test/single_access_test.rb
namxam-authlogic-2.1.3.1 test/acts_as_authentic_test/single_access_test.rb
drogus-authlogic-2.1.3 test/acts_as_authentic_test/single_access_test.rb