Ruby on Rails Monday, November 1, 2010

I have routes that are constrained to the https prototcol.

scope :constraints => { :protocol => "https" } do   resource :user_session end

I have my functional tests set to use https.

require 'test_helper'  class UserSessionsControllerTest < ActionController::TestCase   def setup     request.env['HTTPS'] = 'on'   end    test "new" do     get :new     assert_response :success   end end
When I run this functional test by itself it works. When I run all tests via rake it fails with:

test_new(UserSessionsControllerTest): ActionController::RoutingError: No route matches {:controller=>"user_sessions", :action=>"new"}     actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'     actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:406:in `generate'     actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:453:in `generate'     actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:449:in `generate_extras'     actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:445:in `extra_keys'     actionpack (3.0.1) lib/action_controller/test_case.rb:136:in `assign_parameters'     actionpack (3.0.1) lib/action_controller/test_case.rb:395:in `process'     actionpack (3.0.1) lib/action_controller/test_case.rb:343:in `get'     /test/functional/user_sessions_controller_test.rb:14:in `test_new'     activesupport (3.0.1) lib/active_support/testing/setup_and_teardown.rb:67:in `__send__'     activesupport (3.0.1) lib/active_support/testing/setup_and_teardown.rb:67:in `run'     activesupport (3.0.1) lib/active_support/callbacks.rb:443:in `_run_setup_callbacks'     activesupport (3.0.1) lib/active_support/testing/setup_and_teardown.rb:65:in `run'

Any ideas?

Thanks.
--  Jack Christensen jackc@hylesanderson.edu 

No comments:

Post a Comment