aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/integration_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller/integration_test.rb')
-rw-r--r--actionpack/test/controller/integration_test.rb58
1 files changed, 54 insertions, 4 deletions
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb
index 3bea949867..7ef7865df4 100644
--- a/actionpack/test/controller/integration_test.rb
+++ b/actionpack/test/controller/integration_test.rb
@@ -132,14 +132,64 @@ class SessionTest < Test::Unit::TestCase
@session.head(path,params,headers)
end
- def test_xml_http_request
+ def test_xml_http_request_deprecated_call
path = "/index"; params = "blah"; headers = {:location => 'blah'}
headers_after_xhr = headers.merge(
"X-Requested-With" => "XMLHttpRequest",
"Accept" => "text/javascript, text/html, application/xml, text/xml, */*"
)
- @session.expects(:post).with(path,params,headers_after_xhr)
- @session.xml_http_request(path,params,headers)
+ @session.expects(:process).with(:post,path,params,headers_after_xhr)
+ assert_deprecated { @session.xml_http_request(path,params,headers) }
+ end
+
+ def test_xml_http_request_get
+ path = "/index"; params = "blah"; headers = {:location => 'blah'}
+ headers_after_xhr = headers.merge(
+ "X-Requested-With" => "XMLHttpRequest",
+ "Accept" => "text/javascript, text/html, application/xml, text/xml, */*"
+ )
+ @session.expects(:process).with(:get,path,params,headers_after_xhr)
+ @session.xml_http_request(:get,path,params,headers)
+ end
+
+ def test_xml_http_request_post
+ path = "/index"; params = "blah"; headers = {:location => 'blah'}
+ headers_after_xhr = headers.merge(
+ "X-Requested-With" => "XMLHttpRequest",
+ "Accept" => "text/javascript, text/html, application/xml, text/xml, */*"
+ )
+ @session.expects(:process).with(:post,path,params,headers_after_xhr)
+ @session.xml_http_request(:post,path,params,headers)
+ end
+
+ def test_xml_http_request_put
+ path = "/index"; params = "blah"; headers = {:location => 'blah'}
+ headers_after_xhr = headers.merge(
+ "X-Requested-With" => "XMLHttpRequest",
+ "Accept" => "text/javascript, text/html, application/xml, text/xml, */*"
+ )
+ @session.expects(:process).with(:put,path,params,headers_after_xhr)
+ @session.xml_http_request(:put,path,params,headers)
+ end
+
+ def test_xml_http_request_delete
+ path = "/index"; params = "blah"; headers = {:location => 'blah'}
+ headers_after_xhr = headers.merge(
+ "X-Requested-With" => "XMLHttpRequest",
+ "Accept" => "text/javascript, text/html, application/xml, text/xml, */*"
+ )
+ @session.expects(:process).with(:delete,path,params,headers_after_xhr)
+ @session.xml_http_request(:delete,path,params,headers)
+ end
+
+ def test_xml_http_request_head
+ path = "/index"; params = "blah"; headers = {:location => 'blah'}
+ headers_after_xhr = headers.merge(
+ "X-Requested-With" => "XMLHttpRequest",
+ "Accept" => "text/javascript, text/html, application/xml, text/xml, */*"
+ )
+ @session.expects(:process).with(:head,path,params,headers_after_xhr)
+ @session.xml_http_request(:head,path,params,headers)
end
end
@@ -150,7 +200,7 @@ class IntegrationTestTest < Test::Unit::TestCase
@test.class.stubs(:fixture_table_names).returns([])
@session = @test.open_session
end
-
+
def test_opens_new_session
@test.class.expects(:fixture_table_names).times(2).returns(['foo'])