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'
set_cookie' for nil:NilClass
This is the additional stack trace when running with gems unpack
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.
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.