mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Support OPTIONS verb in route conditions [#1727 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
This commit is contained in:
parent
5c87e9addd
commit
5e0f6214d2
2 changed files with 9 additions and 1 deletions
|
@ -267,7 +267,7 @@ module ActionController
|
||||||
module Routing
|
module Routing
|
||||||
SEPARATORS = %w( / . ? )
|
SEPARATORS = %w( / . ? )
|
||||||
|
|
||||||
HTTP_METHODS = [:get, :head, :post, :put, :delete]
|
HTTP_METHODS = [:get, :head, :post, :put, :delete, :options]
|
||||||
|
|
||||||
ALLOWED_REQUIREMENTS_FOR_OPTIMISATION = [:controller, :action].to_set
|
ALLOWED_REQUIREMENTS_FOR_OPTIMISATION = [:controller, :action].to_set
|
||||||
|
|
||||||
|
|
|
@ -1865,6 +1865,14 @@ class RouteSetTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_route_requirements_with_options_method_condition_is_valid
|
||||||
|
assert_nothing_raised do
|
||||||
|
set.draw do |map|
|
||||||
|
map.connect 'valid/route', :controller => 'pages', :action => 'show', :conditions => {:method => :options}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_route_requirements_with_head_method_condition_is_invalid
|
def test_route_requirements_with_head_method_condition_is_invalid
|
||||||
assert_raises ArgumentError do
|
assert_raises ArgumentError do
|
||||||
set.draw do |map|
|
set.draw do |map|
|
||||||
|
|
Loading…
Reference in a new issue