All pastes #922462 Raw Edit

Anonymous

public text v1 · immutable
#922462 ·published 2008-02-28 20:44 UTC
rendered paste body
I have wrote a functional test as follows: 
require File.dirname(__FILE__) + '/../test_helper'

class MainControllerTest < ActionController::TestCase

  def setup
    @controller = MainController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
  end

  def test_index
    get :index, {:lang => "en_US", :colors => "grey"}
    assert_response :success
  end
end


And it gets this error:



  1) Error:
test_index(MainControllerTest):
ActionController::RoutingError: No route matches {:lang=>"en_US", :colors=>"grey", :action=>"index", :controller=>"main"}
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/routing.rb:1408:in `generate'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/routing.rb:1344:in `generate_extras'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/routing.rb:1340:in `extra_keys'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/test_process.rb:99:in `assign_parameters'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/test_process.rb:388:in `process'
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/test_process.rb:364:in `get'
    ./test/functional/main_controller_test.rb:12:in `test_index'
    /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/testing/default.rb:7:in `run'

1 tests, 0 assertions, 0 failures, 1 errors


But defintly, accessing he site using this url: http://127.0.0.1:3000/en_US/grey/main works like a charm...
My routes are as follow:

  map.root :lang => "en_US", :color => "grey", :controller => "main", :action => "index"
  map.connect ':lang/:color/:controller/:action/:id'
  map.connect ':lang/:color/:controller/:action/:id.:format'



Any idea please ?