Created
March 2, 2010 20:27
-
-
Save aanand/319884 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class FooController < ApplicationController | |
end |
This file contains hidden or 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 FooControllerTest < ActionController::TestCase | |
def test_route1 | |
assert_routing "/route1/abc/123", | |
:controller => 'foo', | |
:action => 'action1', | |
:first_part => 'abc', | |
:second_part => '123' | |
end | |
def test_route2 | |
assert_routing "/route2/abc/123", | |
:controller => 'foo', | |
:action => 'action2', | |
:first_part => 'abc', | |
:second_part => '123' | |
end | |
end |
This file contains hidden or 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
Rails3app::Application.routes.draw do |map| | |
match '/route1/:first_part/:second_part' => 'foo#action1', :constraints => { :first_part => /[a-z]+/ } | |
match '/route2/:first_part/:second_part' => 'foo#action2', :constraints => { :first_part => /[a-z]+/i } | |
end |
This file contains hidden or 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
$ rvm 1.9.1,1.8.7 rake test | |
ruby-1.9.1-p378: ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.2.0] | |
(in /Users/aanand/src/rails3bugtest/rails3app) | |
Loaded suite /Users/aanand/.rvm/gems/ruby-1.9.1-p378%global/gems/rake-0.8.7/lib/rake/rake_test_loader | |
Started | |
.. | |
Finished in 0.121878 seconds. | |
2 tests, 6 assertions, 0 failures, 0 errors, 0 skips | |
ruby-1.8.7-p249: ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10.2.0] | |
(in /Users/aanand/src/rails3bugtest/rails3app) | |
Loaded suite /Users/aanand/.rvm/gems/ruby-1.8.7-p249/gems/rake-0.8.7/lib/rake/rake_test_loader | |
Started | |
.F | |
Finished in 0.029549 seconds. | |
1) Failure: | |
test_route2(FooControllerTest) | |
[]: | |
The recognized options <{"action"=>"action2", "first_part"=>"abc", "controller"=>"foo"}> did not match <{"second_part"=>"123", | |
"action"=>"action2", | |
"first_part"=>"abc", | |
"controller"=>"foo"}>, difference: <{"second_part"=>"123"}> | |
2 tests, 4 assertions, 1 failures, 0 errors | |
Errors running test:functionals! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment