I am trying to perform functional testing and must log in with Warden.
I did:
class ActionController::TestCase include Warden::Test::Helpers end
My test case is simple:
def test_access_admin_as_superuser login_as(Person.make(:superuser)) get :index assert_response :success assert_nil flash[:warning] end
I do a login_as(user) and it seems to work, except when I make get '/admin' fail:
1) Error: test_access_admin_as_superuser(AdminControllerTest): NoMethodError: undefined method `user' for nil:NilClass /home/silas/.rubygems/gems/gems/rails_warden-0.5.2/lib/rails_warden/controller_mixin.rb:21:in `current_user' app/controllers/application_controller.rb:100:in `require_user' test/functional/admin_controller_test.rb:20:in `test_access_admin_as_superuser'
any ideas?
Silas source share