Sha256: e757dfa53111c054a37ef19b4b5b32d426693eb2b15aab633e46da496852a23d
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
require "#{File.dirname(__FILE__)}/test_helper" require 'httparty' module Messenger class WebTest < Test::Unit::TestCase context "Web notification" do setup do @success_response = stub("response", :code => 200) @failure_response = stub("response", :code => 500) 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 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 end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
messenger-0.0.3 | test/test_web.rb |
messenger-0.0.2 | test/test_web.rb |
messenger-0.0.1 | test/test_web.rb |