aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrançois de Metz <francois@2metz.fr>2012-07-04 14:57:31 +0200
committerFrançois de Metz <francois@2metz.fr>2012-07-04 15:00:00 +0200
commit0303c2325fab253adf5e4a0b738cb469c048f008 (patch)
treeb0abd62e42781fa15961337286d07594b589a928
parentb5a2f24b6b2b466a5692f0d46b4a2b8154ee0e53 (diff)
downloadrails-0303c2325fab253adf5e4a0b738cb469c048f008.tar.gz
rails-0303c2325fab253adf5e4a0b738cb469c048f008.tar.bz2
rails-0303c2325fab253adf5e4a0b738cb469c048f008.zip
Add the options method to action_controller testcase.
Signed-off-by: François de Metz <francois@stormz.me>
-rw-r--r--actionpack/lib/action_controller/test_case.rb9
-rw-r--r--actionpack/test/controller/test_case_test.rb5
2 files changed, 12 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index a1f29ea1bc..555f4de3ac 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -430,8 +430,13 @@ module ActionController
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)
diff --git a/actionpack/test/controller/test_case_test.rb b/actionpack/test/controller/test_case_test.rb
index 49137946fe..f868451678 100644
--- a/actionpack/test/controller/test_case_test.rb
+++ b/actionpack/test/controller/test_case_test.rb
@@ -197,6 +197,11 @@ XML
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']