test/unit/test_examples.rb in fakeweb-1.1.0 vs test/unit/test_examples.rb in fakeweb-1.1.1
- old
+ new
@@ -13,12 +13,17 @@
def test_request_with_response
FakeWeb.register_uri('http://www.google.com/', :response => `curl -is http://www.google.com/`)
Net::HTTP.start('www.google.com') do |req|
response = req.get('/')
- assert_equal "200", response.code
- assert_equal "OK", response.message
- assert response.body.include?('<title>Google')
+ if response.code == 200
+ assert_equal "OK", response.message
+ assert response.body.include?('<title>Google')
+ elsif response.code == 302
+ # Google redirects foreign sites to ccTLDs.
+ assert_equal "Found", response.message
+ assert response.body.include?('The document has moved')
+ end
end
end
def test_request_with_custom_status
FakeWeb.register_uri('http://example.com/', :string => "Nothing to be found 'round here",