Permalink
Browse files

Add test case for Person.delete with custom headers.

Tests the Person.delete method to make sure any custom headers added to
the class are passed in the request.
  • Loading branch information...
1 parent 766167c commit 3381e74f01472b0faf0becb421dd8c24551fe69d @geoffgarside geoffgarside committed May 5, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 test/cases/base_test.rb
View
@@ -945,6 +945,17 @@ def test_delete_with_410_gone
assert_raise(ActiveResource::ResourceGone) { Person.find(1) }
end
+ def test_delete_with_custom_header
+ Person.headers['key'] = 'value'
+ ActiveResource::HttpMock.respond_to do |mock|
+ mock.delete "/people/1.json", {}, nil, 200
+ mock.delete "/people/1.json", { 'key' => 'value' }, nil, 404
+ end
+ assert_raise(ActiveResource::ResourceNotFound) { Person.delete(1) }
+ ensure
+ Person.headers.delete('key')
+ end
+
########################################################################
# Tests the more miscellaneous helper methods
########################################################################

0 comments on commit 3381e74

Please sign in to comment.