diff options
author | Brian Hahn <brian.hahn@crowdflower.com> | 2013-09-04 16:43:36 -0700 |
---|---|---|
committer | Brian Hahn <brian.hahn@crowdflower.com> | 2013-09-06 11:08:41 -0700 |
commit | 03ac291526b04586a0f0db0f531f18f14be792c6 (patch) | |
tree | 0a9e5bf5973002ce97c85dc75fbe84358edf977e /actionpack/test/dispatch/routing_assertions_test.rb | |
parent | 59a35610459da7368e79179c9d33bc6e4697adb1 (diff) | |
download | rails-03ac291526b04586a0f0db0f531f18f14be792c6.tar.gz rails-03ac291526b04586a0f0db0f531f18f14be792c6.tar.bz2 rails-03ac291526b04586a0f0db0f531f18f14be792c6.zip |
pass the extra params to the rack test environment so that routes with block constraints have access
Diffstat (limited to 'actionpack/test/dispatch/routing_assertions_test.rb')
-rw-r--r-- | actionpack/test/dispatch/routing_assertions_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_assertions_test.rb b/actionpack/test/dispatch/routing_assertions_test.rb index 423eeda92c..1ca0895da9 100644 --- a/actionpack/test/dispatch/routing_assertions_test.rb +++ b/actionpack/test/dispatch/routing_assertions_test.rb @@ -3,6 +3,7 @@ require 'controller/fake_controllers' class SecureArticlesController < ArticlesController; end class BlockArticlesController < ArticlesController; end +class QueryArticlesController < ArticlesController; end class RoutingAssertionsTest < ActionController::TestCase @@ -18,6 +19,10 @@ class RoutingAssertionsTest < ActionController::TestCase scope 'block', :constraints => lambda { |r| r.ssl? } do resources :articles, :controller => 'block_articles' end + + scope 'query', :constraints => lambda { |r| r.params[:use_query] == 'true' } do + resources :articles, :controller => 'query_articles' + end end end @@ -62,6 +67,13 @@ class RoutingAssertionsTest < ActionController::TestCase assert_recognizes({ :controller => 'block_articles', :action => 'index' }, 'https://test.host/block/articles') end + def test_assert_recognizes_with_query_constraint + assert_raise(ActionController::RoutingError) do + assert_recognizes({ :controller => 'query_articles', :action => 'index', :use_query => 'false' }, '/query/articles', { :use_query => 'false' }) + end + assert_recognizes({ :controller => 'query_articles', :action => 'index', :use_query => 'true' }, '/query/articles', { :use_query => 'true' }) + end + def test_assert_routing assert_routing('/articles', :controller => 'articles', :action => 'index') end |