Sha256: d2252f51ce37a2a8223c79ef98f893608958667e7d39572339c1d36fa4938b21

Contents?: true

Size: 1.45 KB

Versions: 19

Compression:

Stored size: 1.45 KB

Contents

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

module ORMAdaptersTests
  module ActiveRecordAdapterTests
    module ActsAsAuthenticTests
      class SingleAccessTest < ActiveSupport::TestCase
        def test_before_validation
          user = User.new
          assert_equal nil, user.single_access_token
          assert !user.valid?
          assert user.single_access_token
        end
        
        def test_change_with_password
          ben = users(:ben)
          old_single_access_token = ben.single_access_token
          
          User.acts_as_authentic(:change_single_access_token_with_password => true)
          ben.password = "new_pass"
          assert_not_equal old_single_access_token, ben.single_access_token
          
          ben.reload
          User.acts_as_authentic(:change_single_access_token_with_password => false)
          ben.password = "new_pass"
          assert_equal old_single_access_token, ben.single_access_token
        end
        
        def test_reset_single_access_token
          ben = users(:ben)
          old_single_access_token = ben.single_access_token
          ben.reset_single_access_token
          assert_not_equal old_single_access_token, ben.single_access_token
          ben.reload
          assert_equal old_single_access_token, ben.single_access_token
          ben.reset_single_access_token!
          assert_not_equal old_single_access_token, ben.single_access_token
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
authlogic-1.3.2 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.1.1 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.3.1 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.2.1 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.2.2 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.1.2 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.2.0 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.3.0 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.4.0 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.3.5 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.3.7 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.3.9 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.4.1 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.3.6 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.3.8 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.3.3 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.3.4 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.4.3 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb
authlogic-1.4.2 test/orm_adapters_tests/active_record_adapter_tests/acts_as_authentic_tests/single_access_test.rb