Sha256: 62e909f38c7294acfb9a0ee48477bbe1cb598889a2e9c466581dcac0472bb3a0
Contents?: true
Size: 1.1 KB
Versions: 5
Compression:
Stored size: 1.1 KB
Contents
require 'net/http' require 'unfuddle_my_email' require 'test/unit' require 'flexmock/test_unit' require 'shoulda' class PosterTest < Test::Unit::TestCase include UnfuddleMyEmail context "a Poster class" do should "return a Net::HTTP instance when http called" do http = Poster.http('example.com') assert http.is_a?(Net::HTTP) end should "set SSL mode" do http = Poster.http('example.com', ssl = true) assert http.use_ssl? end should "post content" do post_i = flexmock('post_i') post_i.should_receive(:basic_auth).with(String, String) post_i.should_receive(:body=).with(String) post = flexmock('post') post.should_receive(:new).with(String).and_return(post_i) http_request = flexmock('request') http_request.should_receive(:request).and_return(Net::HTTPSuccess.new('','','')) http_lib = flexmock(Net::HTTP) http_lib.should_receive(:new).and_return(http_request) http_lib.should_receive(:post).and_return(post) assert Poster.post('example.com','/', false, 'user','password','test content') end end end
Version data entries
5 entries across 5 versions & 1 rubygems