Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Jon Thomas
8,916 PointsGetting a failed integration test on add_a_friend_test.rb
Here's the error I'm getting:
1) Error:
test_that_adding_a_friend_works(AddAFriendTest):
ActionController::RoutingError: uninitialized constant Devise::SessionController
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:230:in block in constantize'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:ineach'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in constantize'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:69:incontroller_reference'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:54:in controller'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:32:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/routing/mapper.rb:42:in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/journey-1.0.4/lib/journey/router.rb:68:inblock in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/journey-1.0.4/lib/journey/router.rb:56:in each'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/journey-1.0.4/lib/journey/router.rb:56:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:600:in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/warden-1.2.1/lib/warden/manager.rb:35:inblock in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/warden-1.2.1/lib/warden/manager.rb:34:in catch'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/warden-1.2.1/lib/warden/manager.rb:34:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/best_standards_support.rb:17:in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.4/lib/rack/etag.rb:23:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.4/lib/rack/conditionalget.rb:35:in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/head.rb:14:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/params_parser.rb:21:in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/flash.rb:242:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.4/lib/rack/session/abstract/id.rb:210:in context'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.4/lib/rack/session/abstract/id.rb:205:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/cookies.rb:339:in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/query_cache.rb:64:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:28:inblock in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in _run__1282491894527018075__call__1122171811832847018__callbacks'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in__run_callback'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in _run_call_callbacks'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:inrun_callbacks'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:27:in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/remote_ip.rb:31:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:16:in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/show_exceptions.rb:56:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/rack/logger.rb:26:in call_app'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/rack/logger.rb:16:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/request_id.rb:22:in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.4/lib/rack/methodoverride.rb:21:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.4/lib/rack/runtime.rb:17:in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/cache/strategy/local_cache.rb:72:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.4/lib/rack/lock.rb:15:in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/middleware/static.rb:62:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/engine.rb:479:in call'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/application.rb:223:incall'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-test-0.6.2/lib/rack/mock_session.rb:30:in request'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-test-0.6.2/lib/rack/test.rb:230:inprocess_request'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-test-0.6.2/lib/rack/test.rb:123:in request'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/testing/integration.rb:300:inprocess'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/testing/integration.rb:39:in post'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.8/lib/action_dispatch/testing/integration.rb:334:inblock (2 levels) in <module:Runner>'
test/integration/add_a_friend_test.rb:5:in sign_in_as'
test/integration/add_a_friend_test.rb:9:inblock in <class:AddAFriendTest>'
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/mocha-0.10.5/lib/mocha/integration/mini_test/version_230_to_262.rb:28:in `run'
1 tests, 0 assertions, 0 failures, 1 errors, 0 skips
2 Answers
Jon Thomas
8,916 PointsFigured it out:
In my routes file, I was using:
as :user do
get '/login' => 'devise/session#new', as: :new_user_session
post '/login' => 'devise/session#create', as: :user_session
delete '/logout' => 'devise/session#destroy', as: :destroy_user_session
end
I needed to add an 's' on session to make it devise/sessions
So, this works:
as :user do
get '/login' => 'devise/sessions#new', as: :new_user_session
post '/login' => 'devise/sessions#create', as: :user_session
delete '/logout' => 'devise/sessions#destroy', as: :destroy_user_session
end