Sha256: 3e6ed99702a9f114e69c41a713b844544c43e7cf92ce3469444caa08366ae40a

Contents?: true

Size: 1.28 KB

Versions: 20

Compression:

Stored size: 1.28 KB

Contents

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

module ORMAdaptersTests
  module ActiveRecordAdapterTests
    class AuthenticatesManyTest < ActiveSupport::TestCase
      def test_authenticates_many_new
        binary_logic = companies(:binary_logic)
        user_session = binary_logic.user_sessions.new
        assert_equal({:find_options => {:conditions => "\"users\".company_id = #{binary_logic.id}"}, :id => nil}, user_session.scope)
    
        employee_session = binary_logic.employee_sessions.new
        assert_equal({:find_options => {:conditions => "\"employees\".company_id = #{binary_logic.id}"}, :id => nil}, employee_session.scope)
      end
  
      def test_authenticates_many_create_and_find
        binary_logic = companies(:binary_logic)
        logic_over_data = companies(:logic_over_data)
        ben = users(:ben)
        zack = users(:zack)
    
        assert !binary_logic.user_sessions.find
        assert !logic_over_data.user_sessions.find
        assert logic_over_data.user_sessions.create(zack)
        assert !binary_logic.user_sessions.find
        assert logic_over_data.user_sessions.find
        assert binary_logic.user_sessions.create(ben)
        assert binary_logic.user_sessions.find
        assert !logic_over_data.user_sessions.find
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

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