Skip to content
This repository has been archived by the owner on Jul 10, 2018. It is now read-only.

Commit

Permalink
Add a test for some accidental functionality: you can register respon…
Browse files Browse the repository at this point in the history
…se headers using string option keys, too
  • Loading branch information
chrisk committed Jul 13, 2009
1 parent f22a310 commit fcc72d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/test_response_headers.rb
Expand Up @@ -2,13 +2,19 @@

class TestResponseHeaders < Test::Unit::TestCase

def test_content_type_when_registering_with_string_and_content_type_header
def test_content_type_when_registering_with_string_and_content_type_header_as_symbol_option
FakeWeb.register_uri(:get, "http://example.com/users.json", :body => '[{"username": "chrisk"}]', :content_type => "application/json")
response = Net::HTTP.start("example.com") { |query| query.get("/users.json") }
assert_equal '[{"username": "chrisk"}]', response.body
assert_equal "application/json", response['Content-Type']
end

def test_content_type_when_registering_with_string_and_content_type_header_as_string_option
FakeWeb.register_uri(:get, "http://example.com/users.json", :body => '[{"username": "chrisk"}]', 'Content-Type' => "application/json")
response = Net::HTTP.start("example.com") { |query| query.get("/users.json") }
assert_equal "application/json", response['Content-Type']
end

def test_content_type_when_registering_with_string_only
FakeWeb.register_uri(:get, "http://example.com/users.json", :body => '[{"username": "chrisk"}]')
response = Net::HTTP.start("example.com") { |query| query.get("/users.json") }
Expand Down

0 comments on commit fcc72d2

Please sign in to comment.