diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2013-04-24 13:04:05 +0100 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2013-04-24 13:05:25 +0100 |
commit | 00e5453e20c24eedb8bf7cc61145b953210395e3 (patch) | |
tree | 1f2380b8b2699fc449f89d0a4843a4d3004b7eaf /actionpack/test | |
parent | e58f11683003ec1515113103895e18a8c9003aa3 (diff) | |
download | rails-00e5453e20c24eedb8bf7cc61145b953210395e3.tar.gz rails-00e5453e20c24eedb8bf7cc61145b953210395e3.tar.bz2 rails-00e5453e20c24eedb8bf7cc61145b953210395e3.zip |
Add test for `format: false` with resources - closes #10323
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index afd456e8e5..5b42ca0f21 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -1124,6 +1124,35 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest assert_equal "Not Found", @response.body end + def test_resources_with_format_false_from_scope + draw do + scope format: false do + resources :posts + resource :user + end + end + + get "/posts" + assert_response :success + assert_equal "posts#index", @response.body + assert_equal "/posts", posts_path + + get "/posts.html" + assert_response :not_found + assert_equal "Not Found", @response.body + assert_equal "/posts?format=html", posts_path(format: "html") + + get "/user" + assert_response :success + assert_equal "users#show", @response.body + assert_equal "/user", user_path + + get "/user.html" + assert_response :not_found + assert_equal "Not Found", @response.body + assert_equal "/user?format=html", user_path(format: "html") + end + def test_index draw do get '/info' => 'projects#info', :as => 'info' |