Created
August 16, 2011 16:14
-
-
Save saturnflyer/1149452 to your computer and use it in GitHub Desktop.
Testing named routes in Rails 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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