aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/routing_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-08-25 03:10:23 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-08-25 03:10:23 -0300
commitf3e68ec16a123dd08098608644451dbb338bfa7e (patch)
tree18222cf61913012e339799d18cb8e6f747a761dd /actionpack/test/controller/routing_test.rb
parent72f2dd49b17f88961e54e7eb069f5acc34415cef (diff)
parent854ab2e1e62e0a89ffcf4f49a1172d49fb80dcc9 (diff)
downloadrails-f3e68ec16a123dd08098608644451dbb338bfa7e.tar.gz
rails-f3e68ec16a123dd08098608644451dbb338bfa7e.tar.bz2
rails-f3e68ec16a123dd08098608644451dbb338bfa7e.zip
Merge pull request #21094 from aditya-kapoor/add-missing-ap-tests
add missing test for action regexp for routing
Diffstat (limited to 'actionpack/test/controller/routing_test.rb')
-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 c9554a0f58..4a2b02a003 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -336,6 +336,16 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
assert_equal({controller: 'content', action: 'translate', url: 'example'}, rs.recognize_path('/example'))
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\/.+/