Sha256: c87597669f89cb81a95728465199086e7a8e96c169b71e7d60995992df8dbc3a
Contents?: true
Size: 1.26 KB
Versions: 16
Compression:
Stored size: 1.26 KB
Contents
require 'test_helper' require 'roar/representer/transport/net_http' class NetHTTPTransportTest < MiniTest::Spec describe "Transport" do let(:url) { "http://roar.example.com/method" } let(:body) { "booty" } let(:as) { "application/xml" } before do @transport = Roar::Representer::Transport::NetHTTP.new end it "#get_uri returns response" do @transport.get_uri(url, as).must_match_net_response :get, url, as end it "#post_uri returns response" do @transport.post_uri(url, body, as).must_match_net_response :post, url, as, body end it "#put_uri returns response" do @transport.put_uri(url, body, as).must_match_net_response :put, url, as, body end it "#delete_uri returns response" do @transport.delete_uri(url, as).must_match_net_response :delete, url, as end it "#patch_uri returns response" do @transport.patch_uri(url, body, as).must_match_net_response :patch, url, as, body end end end module MiniTest::Assertions def assert_net_response(type, response, url, as, body = nil) # TODO: Assert headers assert_equal "<method>#{type}#{(' - ' + body) if body}</method>", response.body end end Net::HTTPOK.infect_an_assertion :assert_net_response, :must_match_net_response
Version data entries
16 entries across 16 versions & 1 rubygems