Functional Tests Fail - No URL can be generated for hash

Hi,

I’m just learning Ruby and Rails. I have developed a Rails application,
but not using the creation scripts that come with the rails
distribution. Consequently, no test scaffolding is available to me, and
I’m trying to write my functional tests from scratch.

I have what might be considered a standard plain old controller
(dashboard_controller.rb) that I’m trying to test. There are many
actions, but one in particular simply forwards to an introduction page.

Here is the code for that action:

def intro
end

Real simple. Just returns and I should visit dashboard/intro.rhtml.

My unit test looks like:

require ‘dashboard_controller’
require ‘action_controller/test_process’
require ‘action_controller/assertions’

Raise errors beyond the default web-based presentation

class DashboardController; def rescue_action(e) raise e end; end

class DashboardControllerTest < Test::Unit::TestCase
def setup
@controller = DashboardController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end

let’s test our main page

def test_intro
get :intro
assert_response :success
end

end

And when I run the test via the suite, I get the following error:

Loaded suite rails-app/tests/functional/suite
Started
E
Finished in 0.054555 seconds.

  1. Error:
    test_intro(DashboardControllerTest):
    ActionController::RoutingError: No url can be generated for the hash
    {:controller=>“dashboard”, :action=>“intro”}
    generated_code/routing/generation.rb:5:in generate_default_path' /apollo/env/MerchantPortal/lib/ruby/site_ruby/1.8/action_controller/routing.rb:423:ingenerate_default_path’
    /apollo/env/MerchantPortal/lib/ruby/site_ruby/1.8/action_controller/routing.rb:419:in
    generate_path' /apollo/env/MerchantPortal/lib/ruby/site_ruby/1.8/action_controller/routing.rb:415:ingenerate’
    /apollo/env/MerchantPortal/lib/ruby/site_ruby/1.8/action_controller/routing.rb:602:in
    extra_keys' /apollo/env/MerchantPortal/lib/ruby/site_ruby/1.8/action_controller/test_process.rb:86:inassign_parameters’
    /apollo/env/MerchantPortal/lib/ruby/site_ruby/1.8/action_controller/test_process.rb:295:in
    process' /apollo/env/MerchantPortal/lib/ruby/site_ruby/1.8/action_controller/test_process.rb:307:inget’
    ./rails-app/tests/functional/tc_dummy_test.rb:18:in `test_intro’

1 tests, 0 assertions, 0 failures, 1 errors

I’ve looked at the rails code generating this error, but like I said I’m
new to this. This error is being thrown from some autogenerated code.
I’m looking through the code generator, but I haven’t been able to
figure out what I’m doing wrong. I’m hoping this is as simple as an
omitted “requires” statement.

Any ideas?