summaryrefslogtreecommitdiffstats
path: root/test/net_test.rb
diff options
context:
space:
mode:
authorZack Hobson2013-12-26 17:11:34 -0800
committerZack Hobson2013-12-26 17:11:34 -0800
commit087da79f8c4135acc19a71822295c328c0d57a5a (patch)
treefcc625a0f38ea992be92288996a24ab10274f8ba /test/net_test.rb
parentee5c39963760ba3883189266aa4544ef0e838129 (diff)
downloadhcl-087da79f8c4135acc19a71822295c328c0d57a5a.tar.bz2
test_helper: fakeweb test helper
Diffstat (limited to 'test/net_test.rb')
-rw-r--r--test/net_test.rb20
1 files changed, 8 insertions, 12 deletions
diff --git a/test/net_test.rb b/test/net_test.rb
index e00d16a..882a09f 100644
--- a/test/net_test.rb
+++ b/test/net_test.rb
@@ -10,11 +10,10 @@ class NetTest < HCl::TestCase
end
def test_http_deep_unescape
- FakeWeb.register_uri(:get, "https://bob:secret@bobclock.harvestapp.com/foo",
- :body => Yajl::Encoder.encode({
+ register_uri(:get, "/foo", {
status:'gotten &amp; got!',
comparisons:['burrito &gt; taco', 'rain &lt; sun']
- }))
+ })
body = HCl::Net.get 'foo'
assert_equal 'gotten & got!', body[:status]
assert_equal 'burrito > taco', body[:comparisons][0]
@@ -22,23 +21,20 @@ class NetTest < HCl::TestCase
end
def test_http_get
- FakeWeb.register_uri(:get, "https://bob:secret@bobclock.harvestapp.com/foo",
- :body => 'gotten!'.inspect)
+ register_uri(:get, "/foo", {message:'gotten!'})
body = HCl::Net.get 'foo'
- assert_equal 'gotten!', body
+ assert_equal 'gotten!', body[:message]
end
def test_http_post
- FakeWeb.register_uri(:post, "https://bob:secret@bobclock.harvestapp.com/foo",
- :body => 'posted!'.inspect)
+ register_uri(:post, "/foo", {message:'posted!'})
body = HCl::Net.post 'foo', {pizza:'taco'}
- assert_equal 'posted!', body
+ assert_equal 'posted!', body[:message]
end
def test_http_delete
- FakeWeb.register_uri(:delete, "https://bob:secret@bobclock.harvestapp.com/foo",
- :body => 'wiped!'.inspect)
+ register_uri(:delete, "/foo", {message:'wiped!'})
body = HCl::Net.delete 'foo'
- assert_equal 'wiped!', body
+ assert_equal 'wiped!', body[:message]
end
end