Skip to content

Instantly share code, notes, and snippets.

@cwoodcox
Created June 14, 2012 19:51
Show Gist options
  • Save cwoodcox/2932517 to your computer and use it in GitHub Desktop.
Save cwoodcox/2932517 to your computer and use it in GitHub Desktop.
Issue while testing a Rails Engine
Shim::Engine.routes.draw do
match "*id" => 'pages#show', :as => :page, :format => false
root :to => 'pages#show', :id => "index"
end
Run options:
# Running tests:
EE.
Finished tests in 0.268438s, 11.1758 tests/s, 3.7253 assertions/s.
1) Error:
test_index_route(RoutesTest):
ActionController::RoutingError: No route matches "/shim"
/Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@shim/gems/actionpack-3.2.5/lib/action_dispatch/routing/route_set.rb:633:in `recognize_path'
/Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@shim/gems/actionpack-3.2.5/lib/action_dispatch/testing/assertions/routing.rb:210:in `recognized_request_for'
/Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@shim/gems/actionpack-3.2.5/lib/action_dispatch/testing/assertions/routing.rb:42:in `assert_recognizes'
/Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@shim/gems/actionpack-3.2.5/lib/action_dispatch/testing/assertions/routing.rb:118:in `assert_routing'
/Users/cwoodcox/Projects/shim/test/integration/routing_test.rb:5:in `test_index_route'
2) Error:
test_page_route(RoutesTest):
ActionController::RoutingError: No route matches "/shim/some-page"
/Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@shim/gems/actionpack-3.2.5/lib/action_dispatch/routing/route_set.rb:633:in `recognize_path'
/Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@shim/gems/actionpack-3.2.5/lib/action_dispatch/testing/assertions/routing.rb:210:in `recognized_request_for'
/Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@shim/gems/actionpack-3.2.5/lib/action_dispatch/testing/assertions/routing.rb:42:in `assert_recognizes'
/Users/cwoodcox/.rvm/gems/ruby-1.9.3-p194@shim/gems/actionpack-3.2.5/lib/action_dispatch/testing/assertions/routing.rb:118:in `assert_routing'
/Users/cwoodcox/Projects/shim/test/integration/routing_test.rb:9:in `test_page_route'
3 tests, 1 assertions, 0 failures, 2 errors, 0 skips
rake aborted!
Command failed with status (2): [/Users/cwoodcox/.rvm/rubies/ruby-1.9.3-p19...]
Rails.application.routes.draw do
mount Shim::Engine => "/shim"
end
require 'test_helper'
class RoutesTest < ActionDispatch::IntegrationTest
def test_index_route
assert_routing "/shim", { :controller => "pages", :action => "show", :id => "index" }
end
def test_page_route
assert_routing "shim/some-page", { :controller => "pages", :action => "show", :id => "some-page" }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment