aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2013-05-20 20:46:04 +0200
committerJosé Valim <jose.valim@plataformatec.com.br>2013-05-20 20:46:04 +0200
commit378ea96905e5f95be1a413b7bdd6fbb000265129 (patch)
treeabba0e22fcb401556b61d2f6ca487591852bfd03 /actionpack/test/dispatch/routing_test.rb
parent97a607b32b69e79d074702cc44e70bf975a46f87 (diff)
downloadrails-378ea96905e5f95be1a413b7bdd6fbb000265129.tar.gz
rails-378ea96905e5f95be1a413b7bdd6fbb000265129.tar.bz2
rails-378ea96905e5f95be1a413b7bdd6fbb000265129.zip
Add has_named_route? to the mapper API
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 5b42ca0f21..16ba746b9c 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -2662,6 +2662,19 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_raises(ArgumentError) { routes.redirect Object.new }
end
+ def test_named_route_check
+ before, after = nil
+
+ draw do
+ before = has_named_route?(:hello)
+ get "/hello", as: :hello, to: "hello#world"
+ after = has_named_route?(:hello)
+ end
+
+ assert !before, "expected to not have named route :hello before route definition"
+ assert after, "expected to have named route :hello after route definition"
+ end
+
def test_explicitly_avoiding_the_named_route
draw do
scope :as => "routes" do