Sha256: dbad56dfc3ae491930a9434273ba3569ad9aa216f77daa939cb4ab75470aa4ae

Contents?: true

Size: 1.35 KB

Versions: 6

Compression:

Stored size: 1.35 KB

Contents

require 'test_helper'

module ActsAsAuthenticTest
  class SingleAccessTest < ActiveSupport::TestCase
    def test_change_single_access_token_with_password_config
      refute User.change_single_access_token_with_password
      refute 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
      refute 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
      refute u.valid?
      refute u.errors[:single_access_token].empty?
    end

    def test_before_validation_reset_single_access_token
      u = User.new
      refute 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

6 entries across 6 versions & 1 rubygems

Version Path
authlogic-4.0.1 test/acts_as_authentic_test/single_access_test.rb
authlogic-4.0.0 test/acts_as_authentic_test/single_access_test.rb
authlogic-3.8.0 test/acts_as_authentic_test/single_access_test.rb
authlogic-3.7.0 test/acts_as_authentic_test/single_access_test.rb
authlogic-3.6.1 test/acts_as_authentic_test/single_access_test.rb
authlogic-3.6.0 test/acts_as_authentic_test/single_access_test.rb