Rails 2.3.5 incompatibility #76

Closed
knapo opened this Issue Dec 2, 2009 · 4 comments

Projects

None yet

4 participants

@knapo
knapo commented Dec 2, 2009

After upgrading to Rails 2.3.5 lot of tests fail on:

Message: NoMethodError: protected method `cookies' 
called for #<ActionView::TestCase::TestController:0x7f385cfeb1e0>
vendor/bundler_gems/gems/authlogic-2.1.3/lib/authlogic/session/cookies.rb:101:in
`cookie_credentials' vendor/bundler_gems/gems/authlogic-2.1.3/lib/authlogic/session/cookies.rb:106:in `persist_by_cookie' 
@spob
spob commented Dec 23, 2009

I'm getting the same problem running with AuthLogic 2.1.3.

@knapo
knapo commented Jan 4, 2010

Because Rails 2.3.5 introduces lot of changes in tests (mostly in ActionView::TestCase) the controler method from Authlogic::TestCase no longer works and (sometimes) returns regular test controller instead of Authlogic mocked one.

I fixed it with a small change in lib/authlogic/test_case.rb (actually by adding it to my test_helper, as we need to require 'authlogic/test_case' anyway):

def activate_authlogic
  Authlogic::Session::Base.controller = (@request && Authlogic::TestCase::RailsRequestAdapter.new(@request)) || mock_controller
end

def mock_controller
  @mock_controller ||= Authlogic::TestCase::MockController.new
end
@elisehuard

many thanks, that seems to help !

@jaredbeck
Collaborator
jaredbeck commented Dec 25, 2016 edited

Closing, as authlogic no longer supports rails 2.

@jaredbeck jaredbeck closed this Dec 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment