Permalink
Browse files

Add the options method to action_controller testcase.

Signed-off-by: François de Metz <francois@stormz.me>
  • Loading branch information...
francois2metz committed Jul 4, 2012
1 parent b5a2f24 commit 0303c2325fab253adf5e4a0b738cb469c048f008
Showing with 12 additions and 2 deletions.
  1. +7 −2 actionpack/lib/action_controller/test_case.rb
  2. +5 −0 actionpack/test/controller/test_case_test.rb
@@ -430,8 +430,13 @@ def delete(action, *args)
end
# Executes a request simulating HEAD HTTP method and set/volley the response
- def head(action, parameters = nil, session = nil, flash = nil)
- process(action, "HEAD", parameters, session, flash)
+ def head(action, *args)
+ process(action, "HEAD", *args)
+ end
+
+ # Executes a request simulating OPTIONS HTTP method and set/volley the response
+ def options(action, *args)
+ process(action, "OPTIONS", *args)
end
def xml_http_request(request_method, action, parameters = nil, session = nil, flash = nil)
@@ -197,6 +197,11 @@ def test_head_params_as_sting
assert_raise(NoMethodError) { head :test_params, "document body", :id => 10 }
end
+ def test_options
+ options :test_params
+ assert_equal 200, @response.status
+ end
+
def test_process_without_flash
process :set_flash
assert_equal '><', flash['test']

1 comment on commit 0303c23

@jeremy

This comment has been minimized.

Show comment
Hide comment
@jeremy

jeremy May 16, 2013

Member

This is going to conflict with a lot of test cases. I'm not sure it's worth it for an uncommon HTTP method. Better to call process directly.

Member

jeremy commented on 0303c23 May 16, 2013

This is going to conflict with a lot of test cases. I'm not sure it's worth it for an uncommon HTTP method. Better to call process directly.

Please sign in to comment.