summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormo <mo@mokhan.ca>2018-05-07 14:40:22 -0600
committermo <mo@mokhan.ca>2018-05-07 14:40:22 -0600
commitf7bf39e1872e3d8c7dd72b1756fd2c0891c8d46e (patch)
tree5e167d7b9a4e1897057e3173672ef8d06f7be6e6 /test
parentcd2a8d1908fd472ec6a704e8fd76a13ee969de24 (diff)
add test for body.
Diffstat (limited to 'test')
-rw-r--r--test/net/client_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/net/client_test.rb b/test/net/client_test.rb
index 1d06303..d4dee32 100644
--- a/test/net/client_test.rb
+++ b/test/net/client_test.rb
@@ -43,6 +43,19 @@ class Net::Hippie::ClientTest < Minitest::Test
assert_equal response.class, Net::HTTPCreated
end
+ def test_get_with_body
+ uri = URI.parse('https://haveibeenpwned.com/api/breaches')
+ body = { 'hello' => 'world' }
+ WebMock.stub_request(:get, uri.to_s)
+ .with(body: body.to_json)
+ .to_return(status: 201, body: {}.to_json)
+
+ response = subject.get(uri, body: body)
+
+ refute_nil response
+ assert_equal response.class, Net::HTTPCreated
+ end
+
def test_post
VCR.use_cassette("post_breaches") do
uri = URI.parse('https://haveibeenpwned.com/api/breaches')