From 854ab2e1e62e0a89ffcf4f49a1172d49fb80dcc9 Mon Sep 17 00:00:00 2001 From: Aditya Kapoor Date: Sun, 2 Aug 2015 13:39:40 +0530 Subject: add missing tests for action regexp --- actionpack/test/controller/routing_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'actionpack/test/controller/routing_test.rb') diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 9bbfb74e72..ef85e9fc6c 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -340,6 +340,16 @@ class LegacyRouteSetTests < ActiveSupport::TestCase end end + def test_route_with_regexp_for_action + rs.draw { get '/:controller/:action', action: /auth[-|_].+/ } + + assert_equal({ action: 'auth_google', controller: 'content' }, rs.recognize_path('/content/auth_google')) + assert_equal({ action: 'auth-facebook', controller: 'content' }, rs.recognize_path('/content/auth-facebook')) + + assert_equal '/content/auth_google', url_for(rs, { controller: "content", action: "auth_google" }) + assert_equal '/content/auth-facebook', url_for(rs, { controller: "content", action: "auth-facebook" }) + end + def test_route_with_regexp_for_controller rs.draw do get ':controller/:admintoken(/:action(/:id))', :controller => /admin\/.+/ -- cgit v1.2.3