0
assert_equal 200, @session.follow_redirect!
0
- def test_get_via_redirect
0
- path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
0
+ def test_request_via_redirect_uses_given_method
0
+ path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"}
0
+ @session.expects(:put).with(path, args, headers)
0
+ @session.stubs(:redirect?).returns(false)
0
+ @session.request_via_redirect(:put, path, args, headers)
0
- @session.expects(:get).with(path,args,headers)
0
+ def test_request_via_redirect_follows_redirects
0
+ path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"}
0
@session.stubs(:redirect?).returns(true, true, false)
0
@session.expects(:follow_redirect!).times(2)
0
+ @session.request_via_redirect(:get, path, args, headers)
0
+ def test_request_via_redirect_returns_status
0
+ path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue"}
0
+ @session.stubs(:redirect?).returns(false)
0
@session.stubs(:status).returns(200)
0
- assert_equal 200, @session.
get_via_redirect(path, args, headers)
0
+ assert_equal 200, @session.
request_via_redirect(:get, path, args, headers)
0
+ def test_get_via_redirect
0
+ path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
0
+ @session.expects(:request_via_redirect).with(:get, path, args, headers)
0
+ @session.get_via_redirect(path, args, headers)
0
def test_post_via_redirect
0
path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
0
+ @session.expects(:request_via_redirect).with(:post, path, args, headers)
0
+ @session.post_via_redirect(path, args, headers)
0
- @session.expects(:post).with(path,args,headers)
0
+ def test_put_via_redirect
0
+ path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
0
+ @session.expects(:request_via_redirect).with(:put, path, args, headers)
0
+ @session.put_via_redirect(path, args, headers)
0
- @session.stubs(:redirect?).returns(true, true, false)
0
- @session.expects(:follow_redirect!).times(2)
0
- @session.stubs(:status).returns(200)
0
- assert_equal 200, @session.post_via_redirect(path, args, headers)
0
+ def test_delete_via_redirect
0
+ path = "/somepath"; args = {:id => '1'}; headers = {"X-Test-Header" => "testvalue" }
0
+ @session.expects(:request_via_redirect).with(:delete, path, args, headers)
0
+ @session.delete_via_redirect(path, args, headers)
0
def test_url_for_with_controller
0
@session.expects(:process).with(:head,path,params,headers_after_xhr)
0
@session.xml_http_request(:head,path,params,headers)
0
+ def test_xml_http_request_override_accept
0
+ path = "/index"; params = "blah"; headers = {:location => 'blah', "Accept" => "application/xml"}
0
+ headers_after_xhr = headers.merge(
0
+ "X-Requested-With" => "XMLHttpRequest"
0
+ @session.expects(:process).with(:post,path,params,headers_after_xhr)
0
+ @session.xml_http_request(:post,path,params,headers)