aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAditya Kapoor <adityakapoor.mait@gmail.com>2015-08-02 13:39:40 +0530
committerAditya Kapoor <adityakapoor.mait@gmail.com>2015-08-02 13:39:40 +0530
commit854ab2e1e62e0a89ffcf4f49a1172d49fb80dcc9 (patch)
treeada5ddb6b5a7ba14d672f5064fe17a2f9f8c310d /actionpack
parent722abe1722a8bcf1798fc7f7f9a8cf4dcfa28e88 (diff)
downloadrails-854ab2e1e62e0a89ffcf4f49a1172d49fb80dcc9.tar.gz
rails-854ab2e1e62e0a89ffcf4f49a1172d49fb80dcc9.tar.bz2
rails-854ab2e1e62e0a89ffcf4f49a1172d49fb80dcc9.zip
add missing tests for action regexp
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/test/controller/routing_test.rb10
1 files changed, 10 insertions, 0 deletions
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\/.+/