1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #21094 from aditya-kapoor/add-missing-ap-tests

add missing test for action regexp for routing
This commit is contained in:
Rafael Mendonça França 2015-08-25 03:10:23 -03:00
commit f3e68ec16a

View file

@ -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\/.+/