Skip to content

Instantly share code, notes, and snippets.

@saturnflyer
Created August 16, 2011 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saturnflyer/1149452 to your computer and use it in GitHub Desktop.
Save saturnflyer/1149452 to your computer and use it in GitHub Desktop.
Testing named routes in Rails 3
require 'test_helper'
class RoutesTest < ActionController::TestCase
include Rails.application.routes.url_helpers
# standard Rails stuff without testing the named helpers
test 'should route the unusual path to the something custom action' do
assert_routing({ :method => 'get', :path => '/unusual/path' }, { :controller => "something", :action => "custom" })
end
# Test your named paths
test 'should route my_custom_path to "/unusual/path"' do
assert_equal '/unusual/path', my_custom_path
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment