aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2013-09-10 13:23:57 -0700
committerSteve Klabnik <steve@steveklabnik.com>2013-09-10 13:23:57 -0700
commitcff8d1d24da1237a2f4d44e46f5ec486cd6ba32d (patch)
tree5ca90edd845be7afa673991cfa7084cc71174aa1 /actionpack/test
parent143e00954619f3ce86e08f72ba7927c6f8991062 (diff)
parent03ac291526b04586a0f0db0f531f18f14be792c6 (diff)
downloadrails-cff8d1d24da1237a2f4d44e46f5ec486cd6ba32d.tar.gz
rails-cff8d1d24da1237a2f4d44e46f5ec486cd6ba32d.tar.bz2
rails-cff8d1d24da1237a2f4d44e46f5ec486cd6ba32d.zip
Merge pull request #9368 from CrowdFlower/3-2-stable
PR #5219 backported to 3-2
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/routing_assertions_test.rb12
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