test/test_web.rb in messenger-0.1.0 vs test/test_web.rb in messenger-0.1.1
- old
+ new
@@ -12,16 +12,18 @@
end
should "post a successful message" do
HTTParty.expects(:post).with("http://example.com", :body => '{ "key": "value" }', :headers => { "Content-Type" => "application/json" }).returns(@success_response)
result = Web.send("http://example.com", '{ "key": "value" }', :headers => { "Content-Type" => "application/json" })
- assert_equal [true, @success_response], result
+ assert result.success?
+ assert_equal @success_response, result.response
end
should "post a failed message" do
HTTParty.expects(:post).with("http://example.com", :body => '{ "key": "value" }', :headers => { "Content-Type" => "application/json" }).returns(@failure_response)
result = Web.send("http://example.com", '{ "key": "value" }', :headers => { "Content-Type" => "application/json" })
- assert_equal [false, @failure_response], result
+ assert_equal false, result.success?
+ assert_equal @failure_response, result.response
end
should "raise if trying to send to an invalid URL" do
assert_raises URLError do
Web.send("http://!", :body => "whatever")