Skip to content
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
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
@@ -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
Copy link
Member

@jeremy jeremy commented on 0303c23 May 16, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.