aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/test
diff options
context:
space:
mode:
authorEdgar J. Suarez <edgar.js@gmail.com>2008-09-17 15:24:26 -0500
committerMichael Koziarski <michael@koziarski.com>2008-09-18 11:15:48 +0200
commit790ebf8eab39da1b4d62146fe10f4a77f5daca8c (patch)
tree172cd40c0be6e68305bc59ce23c0d167f2fcb40f /activeresource/test
parent7ecb9689b03335ec28958c506b083390f4212d45 (diff)
downloadrails-790ebf8eab39da1b4d62146fe10f4a77f5daca8c.tar.gz
rails-790ebf8eab39da1b4d62146fe10f4a77f5daca8c.tar.bz2
rails-790ebf8eab39da1b4d62146fe10f4a77f5daca8c.zip
HTTP Accept header
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'activeresource/test')
-rw-r--r--activeresource/test/connection_test.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/activeresource/test/connection_test.rb b/activeresource/test/connection_test.rb
index 06f31f1b57..84bcf69219 100644
--- a/activeresource/test/connection_test.rb
+++ b/activeresource/test/connection_test.rb
@@ -168,12 +168,20 @@ class ConnectionTest < Test::Unit::TestCase
assert_equal 200, response.code
end
- uses_mocha('test_timeout') do
+ uses_mocha('test_timeout, test_accept_http_header') do
def test_timeout
@http = mock('new Net::HTTP')
@conn.expects(:http).returns(@http)
@http.expects(:get).raises(Timeout::Error, 'execution expired')
- assert_raises(ActiveResource::TimeoutError) { @conn.get('/people_timeout.xml') }
+ assert_raise(ActiveResource::TimeoutError) { @conn.get('/people_timeout.xml') }
+ end
+
+ def test_accept_http_header
+ @http = mock('new Net::HTTP')
+ @conn.expects(:http).returns(@http)
+ path = '/people/1.xml'
+ @http.expects(:get).with(path, {'Accept' => 'application/xhtml+xml'}).returns(ActiveResource::Response.new(@matz, 200, {'Content-Type' => 'text/xhtml'}))
+ assert_nothing_raised(Mocha::ExpectationError) { @conn.get(path, {'Accept' => 'application/xhtml+xml'}) }
end
end