aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2012-02-19 19:31:35 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2012-02-19 19:31:35 -0700
commitad46884af567d6f8d6d8d777f372c39e81a560ba (patch)
tree9019995b1ebfd7e71bcf551ad78b290f30d9b3eb /actionpack/test/controller
parent6219bebb4942dcb8aa55b0143b94ebe1a25e326c (diff)
downloadrails-ad46884af567d6f8d6d8d777f372c39e81a560ba.tar.gz
rails-ad46884af567d6f8d6d8d777f372c39e81a560ba.tar.bz2
rails-ad46884af567d6f8d6d8d777f372c39e81a560ba.zip
Integration tests support the OPTIONS http method
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/integration_test.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb
index 99e1dc7966..64c4682015 100644
--- a/actionpack/test/controller/integration_test.rb
+++ b/actionpack/test/controller/integration_test.rb
@@ -105,6 +105,12 @@ class SessionTest < ActiveSupport::TestCase
@session.head(path,params,headers)
end
+ def test_options
+ path = "/index"; params = "blah"; headers = {:location => 'blah'}
+ @session.expects(:process).with(:options,path,params,headers)
+ @session.options(path,params,headers)
+ end
+
def test_xml_http_request_get
path = "/index"; params = "blah"; headers = {:location => 'blah'}
headers_after_xhr = headers.merge(
@@ -155,6 +161,16 @@ class SessionTest < ActiveSupport::TestCase
@session.xml_http_request(:head,path,params,headers)
end
+ def test_xml_http_request_options
+ path = "/index"; params = "blah"; headers = {:location => 'blah'}
+ headers_after_xhr = headers.merge(
+ "HTTP_X_REQUESTED_WITH" => "XMLHttpRequest",
+ "HTTP_ACCEPT" => "text/javascript, text/html, application/xml, text/xml, */*"
+ )
+ @session.expects(:process).with(:options,path,params,headers_after_xhr)
+ @session.xml_http_request(:options,path,params,headers)
+ end
+
def test_xml_http_request_override_accept
path = "/index"; params = "blah"; headers = {:location => 'blah', "HTTP_ACCEPT" => "application/xml"}
headers_after_xhr = headers.merge(
@@ -212,7 +228,7 @@ class IntegrationTestUsesCorrectClass < ActionDispatch::IntegrationTest
@integration_session.stubs(:generic_url_rewriter)
@integration_session.stubs(:process)
- %w( get post head put delete ).each do |verb|
+ %w( get post head put delete options ).each do |verb|
assert_nothing_raised("'#{verb}' should use integration test methods") { __send__(verb, '/') }
end
end