test/test_fake_web.rb in chrisk-fakeweb-1.1.2.3 vs test/test_fake_web.rb in chrisk-fakeweb-1.1.2.4
- old
+ new
@@ -144,11 +144,26 @@
Net::HTTP.start('mock') do |http|
response = http.get('/test_example.txt')
assert_equal 'test example content', response.body
end
end
-
+
+ def test_mock_request_with_undocumented_full_uri_argument_style
+ Net::HTTP.start('mock') do |query|
+ response = query.get('http://mock/test_example.txt')
+ assert_equal 'test example content', response.body
+ end
+ end
+
+ def test_mock_request_with_undocumented_full_uri_argument_style_and_query
+ FakeWeb.register_uri('http://mock/test_example.txt?a=b', :string => 'test query content')
+ Net::HTTP.start('mock') do |query|
+ response = query.get('http://mock/test_example.txt?a=b')
+ assert_equal 'test query content', response.body
+ end
+ end
+
def test_mock_post
response = nil
Net::HTTP.start('mock') do |query|
response = query.post('/test_example.txt', '')
end
@@ -224,9 +239,18 @@
def test_real_http_request
resp = nil
Net::HTTP.start('images.apple.com') do |query|
resp = query.get('/main/rss/hotnews/hotnews.rss')
+ end
+ assert resp.body.include?('Apple')
+ assert resp.body.include?('News')
+ end
+
+ def test_real_http_request_with_undocumented_full_uri_argument_style
+ resp = nil
+ Net::HTTP.start('images.apple.com') do |query|
+ resp = query.get('http://images.apple.com/main/rss/hotnews/hotnews.rss')
end
assert resp.body.include?('Apple')
assert resp.body.include?('News')
end