#169 new
Amiruddin Nagri

Getting undefined method set_cookie for nil:NilClass when running rspec

Reported by Amiruddin Nagri | June 7th, 2010 @ 02:31 AM

I am having a very simple test case for authlogic where it assigns the current user record to an instance variable inside a controller. When I wrote a spec for this functionality it started throwing the below error :

NoMethodError in 'UsersController edit should assign current user for edit'

undefined method set_cookie' for nil:NilClass



This is the additional stack trace when running with gems unpack

vendor/gems/authlogic-2.1.5/lib/authlogic/session/cookies.rb:117:in save_cookie'

vendor/gems/authlogic-2.1.5/lib/authlogic/session/callbacks.rb:83:in after_save'

vendor/gems/authlogic-2.1.5/lib/authlogic/session/existence.rb:71:in save'

vendor/gems/authlogic-2.1.5/lib/authlogic/session/existence.rb:86:in save!'

I debugged the spec, and it went through setting the controller for the current spec in Thread.current[:authlogic_controller] but when it was accessed again, it returns nil.

I have attached the git format-patch for the changes that needs to be done on a new rails application to reporduce the defect.

I am using Rails 2.3.5 with sqlite3 on Ubuntu 9.10 64 bit.


Amiruddin Nagri

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Object based authentication solution that handles all of the non sense for you. It's as easy as ActiveRecord is with a database.

People watching this ticket