aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2014-01-25 07:38:29 +0000
committerAndrew White <andyw@pixeltrix.co.uk>2014-01-25 07:38:29 +0000
commita31a44a266ad2e2ad2b9ce5aa56cd5e1d108d48a (patch)
tree1c9b5ecf28e3b35de1c2120a29dae00e76640d12 /actionpack/test/dispatch/routing_test.rb
parent345555cd4cfd6fad68752292e5780387672e167e (diff)
downloadrails-a31a44a266ad2e2ad2b9ce5aa56cd5e1d108d48a.tar.gz
rails-a31a44a266ad2e2ad2b9ce5aa56cd5e1d108d48a.tar.bz2
rails-a31a44a266ad2e2ad2b9ce5aa56cd5e1d108d48a.zip
Add additional tests for #13824
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index ebea5a8792..26821bdb56 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -2932,6 +2932,32 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal '/about-us/index', about_us_index_path
end
+ def test_resource_routes_with_dashes_in_path
+ draw do
+ resources :photos, only: [:show] do
+ get 'user-favorites', on: :collection
+ get 'preview-photo', on: :member
+ get 'summary-text'
+ end
+ end
+
+ get '/photos/user-favorites'
+ assert_equal 'photos#user_favorites', @response.body
+ assert_equal '/photos/user-favorites', user_favorites_photos_path
+
+ get '/photos/1/preview-photo'
+ assert_equal 'photos#preview_photo', @response.body
+ assert_equal '/photos/1/preview-photo', preview_photo_photo_path('1')
+
+ get '/photos/1/summary-text'
+ assert_equal 'photos#summary_text', @response.body
+ assert_equal '/photos/1/summary-text', photo_summary_text_path('1')
+
+ get '/photos/1'
+ assert_equal 'photos#show', @response.body
+ assert_equal '/photos/1', photo_path('1')
+ end
+
private
def draw(&block)