Sha256: d7cf7df2f45a1a6776df9e9ce983634353bd231f4c8f5e004f8caf6a9870f20d
Contents?: true
Size: 1.12 KB
Versions: 16
Compression:
Stored size: 1.12 KB
Contents
require File.dirname(__FILE__) + '/../test_helper.rb' module SessionTests class AuthenticatesManyAssociationTest < ActiveSupport::TestCase def test_initialize assoc = Authlogic::Session::AuthenticatesManyAssociation.new(UserSession, {:conditions => ["1 = ?", 1]}, :some_id) assert_equal UserSession, assoc.klass assert_equal({:conditions => ["1 = ?", 1]}, assoc.find_options) assert_equal :some_id, assoc.id end def test_new ben = users(:ben) assoc = Authlogic::Session::AuthenticatesManyAssociation.new(UserSession, {:conditions => ["1 = ?", 1]}, :some_id) session = assoc.new(ben) assert_equal ben, session.unauthorized_record assert_equal({:find_options => {:conditions => ["1 = ?", 1]}, :id => :some_id}, session.scope) end def test_build binary_logic = companies(:binary_logic) ben = users(:ben) session = binary_logic.user_sessions.build(ben) assert_equal ben, session.unauthorized_record assert_equal({:find_options => {:conditions => "\"users\".company_id = #{binary_logic.id}"}, :id => nil}, session.scope) end end end
Version data entries
16 entries across 16 versions & 1 rubygems