From bd50d82f701c55d89b891ebd216ec84008b486c1 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Sun, 29 Apr 2007 03:14:36 +0000 Subject: Add support for setting custom headers per ActiveResource model [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6624 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activeresource/test/base_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activeresource/test/base_test.rb') diff --git a/activeresource/test/base_test.rb b/activeresource/test/base_test.rb index 51e1dd3c04..2c823e8e69 100644 --- a/activeresource/test/base_test.rb +++ b/activeresource/test/base_test.rb @@ -13,6 +13,7 @@ class BaseTest < Test::Unit::TestCase ActiveResource::HttpMock.respond_to do |mock| mock.get "/people/1.xml", {}, @matz mock.get "/people/2.xml", {}, @david + mock.get "/people/3.xml", {'key' => 'value'}, nil, 404 mock.put "/people/1.xml", {}, nil, 204 mock.delete "/people/1.xml", {}, nil, 200 mock.delete "/people/2.xml", {}, nil, 400 @@ -198,6 +199,13 @@ class BaseTest < Test::Unit::TestCase assert_equal "Matz", matz.name end + def test_custom_header + Person.custom_headers['key'] = 'value' + assert_raises(ActiveResource::ResourceNotFound) { Person.find(3) } + ensure + Person.custom_headers.delete('key') + end + def test_find_by_id_not_found assert_raises(ActiveResource::ResourceNotFound) { Person.find(99) } assert_raises(ActiveResource::ResourceNotFound) { StreetAddress.find(1) } -- cgit v1.2.3