Skip to content
This repository

Rails 2.3.5 incompatibility #76

Open
knapo opened this Issue December 02, 2009 · 3 comments

3 participants

Krzysztof Knapik Bob Sturim Elise Huard
Krzysztof Knapik

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' 
Bob Sturim

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

Krzysztof Knapik

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
Elise Huard

many thanks, that seems to help !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.