Skip to content

Commit 0303c23

Browse files
committed
Add the options method to action_controller testcase.
Signed-off-by: François de Metz <francois@stormz.me>
1 parent b5a2f24 commit 0303c23

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Diff for: actionpack/lib/action_controller/test_case.rb

+7-2
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,13 @@ def delete(action, *args)
430430
end
431431

432432
# Executes a request simulating HEAD HTTP method and set/volley the response
433-
def head(action, parameters = nil, session = nil, flash = nil)
434-
process(action, "HEAD", parameters, session, flash)
433+
def head(action, *args)
434+
process(action, "HEAD", *args)
435+
end
436+
437+
# Executes a request simulating OPTIONS HTTP method and set/volley the response
438+
def options(action, *args)
439+
process(action, "OPTIONS", *args)
435440
end
436441

437442
def xml_http_request(request_method, action, parameters = nil, session = nil, flash = nil)

Diff for: actionpack/test/controller/test_case_test.rb

+5
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ def test_head_params_as_sting
197197
assert_raise(NoMethodError) { head :test_params, "document body", :id => 10 }
198198
end
199199

200+
def test_options
201+
options :test_params
202+
assert_equal 200, @response.status
203+
end
204+
200205
def test_process_without_flash
201206
process :set_flash
202207
assert_equal '><', flash['test']

0 commit comments

Comments
 (0)