From 378ea96905e5f95be1a413b7bdd6fbb000265129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 20 May 2013 20:46:04 +0200 Subject: Add has_named_route? to the mapper API --- actionpack/test/dispatch/routing_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'actionpack/test') 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 -- cgit v1.2.3