resolve/refinerycms — Issue #1121: undefined method `authenticate' for nil:NilClass
Author: fedegl
Created: 2011-11-01 21:45:29+00:00
State: open

When trying to test the controllers of my main app, the error keeps coming up: "undefined method `authenticate' for nil:NilClass"

This is the backtrace

# /Users/fede/.rvm/gems/ruby-1.9.2-p290@kris/gems/activesupport-3.1.1/lib/active_support/whiny_nil.rb:48:in `method_missing'
# /Users/fede/.rvm/gems/ruby-1.9.2-p290@kris/gems/devise-1.4.9/lib/devise/controllers/helpers.rb:53:in `current_refinery_user'
# /Users/fede/.rvm/gems/ruby-1.9.2-p290@kris/gems/devise-1.4.9/lib/devise/controllers/helpers.rb:49:in `refinery_user_signed_in?'
# /Users/fede/.rvm/gems/ruby-1.9.2-p290@kris/bundler/gems/refinerycms-47948cf71ece/authentication/lib/refinery/authenticated_system.rb:35:in `refinery_user?'
# /Users/fede/.rvm/gems/ruby-1.9.2-p290@kris/bundler/gems/refinerycms-47948cf71ece/core/lib/refinery/application_controller.rb:30:in `block (2 levels) in '

It seems to be calling this method on a nil object

```ruby
send :after_filter, :store_current_location!,
:if => Proc.new {|c| send(:refinery_user?) }
```

If I try to stub refinery_user? or current_refinery_user I get a "SystemStackError: stack level too deep"
```ruby
controller.stub(:refinery_user?).and_return(false)
controller.stub(:current_refinery_user).and_return(Factory(:refinery_user))
```

I cannot find where the authenticate method is being called, because it doesn't exist in refinery.

Any ideas would help, thanks!