提交 766fb54c 编写于 作者: J Jeremy Kemper

Fix indentation

上级 082c3779
......@@ -1298,30 +1298,28 @@ def setup_request_method_routes_for(method)
end
def test_recognize_array_of_methods
begin
Object.const_set(:BooksController, Class.new(ActionController::Base))
rs.draw do |r|
r.connect '/match', :controller => 'books', :action => 'get_or_post', :conditions => { :method => [:get, :post] }
r.connect '/match', :controller => 'books', :action => 'not_get_or_post'
end
@request = ActionController::TestRequest.new
@request.env["REQUEST_METHOD"] = 'POST'
@request.request_uri = "/match"
assert_nothing_raised { rs.recognize(@request) }
assert_equal 'get_or_post', @request.path_parameters[:action]
# have to recreate or else the RouteSet uses a cached version:
@request = ActionController::TestRequest.new
@request.env["REQUEST_METHOD"] = 'PUT'
@request.request_uri = "/match"
assert_nothing_raised { rs.recognize(@request) }
assert_equal 'not_get_or_post', @request.path_parameters[:action]
ensure
Object.send(:remove_const, :BooksController) rescue nil
end
Object.const_set(:BooksController, Class.new(ActionController::Base))
rs.draw do |r|
r.connect '/match', :controller => 'books', :action => 'get_or_post', :conditions => { :method => [:get, :post] }
r.connect '/match', :controller => 'books', :action => 'not_get_or_post'
end
@request = ActionController::TestRequest.new
@request.env["REQUEST_METHOD"] = 'POST'
@request.request_uri = "/match"
assert_nothing_raised { rs.recognize(@request) }
assert_equal 'get_or_post', @request.path_parameters[:action]
# have to recreate or else the RouteSet uses a cached version:
@request = ActionController::TestRequest.new
@request.env["REQUEST_METHOD"] = 'PUT'
@request.request_uri = "/match"
assert_nothing_raised { rs.recognize(@request) }
assert_equal 'not_get_or_post', @request.path_parameters[:action]
ensure
Object.send(:remove_const, :BooksController) rescue nil
end
def test_subpath_recognized
Object.const_set(:SubpathBooksController, Class.new(ActionController::Base))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册