aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-02-20 09:44:09 -0700
committerSean Griffin <sean@seantheprogrammer.com>2015-02-20 09:44:09 -0700
commitf3186093d816675344c4f93c82c96fe8e94caafa (patch)
tree9fa9f4340da59c03349eceace8e117b7d6f7cbaf /actionpack/test
parente0f29c51b9bbb41f4235d0948103194096d92cd9 (diff)
parent6cf671b61e35a94ec8e6acad0aaef85822c93eb0 (diff)
downloadrails-f3186093d816675344c4f93c82c96fe8e94caafa.tar.gz
rails-f3186093d816675344c4f93c82c96fe8e94caafa.tar.bz2
rails-f3186093d816675344c4f93c82c96fe8e94caafa.zip
Merge pull request #18665 from sgrif/sg-test-route-all
Allow `method: "all"` as a valid routing test option
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/resources_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb
index 02e7614ba2..f3da2df3ef 100644
--- a/actionpack/test/controller/resources_test.rb
+++ b/actionpack/test/controller/resources_test.rb
@@ -1047,6 +1047,28 @@ class ResourcesTest < ActionController::TestCase
end
end
+ def test_assert_routing_accepts_all_as_a_valid_method
+ with_routing do |set|
+ set.draw do
+ match "/products", to: "products#show", via: :all
+ end
+
+ assert_routing({ method: "all", path: "/products" }, { controller: "products", action: "show" })
+ end
+ end
+
+ def test_assert_routing_fails_when_not_all_http_methods_are_recognized
+ with_routing do |set|
+ set.draw do
+ match "/products", to: "products#show", via: [:get, :post, :put]
+ end
+
+ assert_raises(Minitest::Assertion) do
+ assert_routing({ method: "all", path: "/products" }, { controller: "products", action: "show" })
+ end
+ end
+ end
+
def test_singleton_resource_name_is_not_singularized
with_singleton_resources(:preferences) do
assert_singleton_restful_for :preferences