Sha256: 71d19109896ed829c687beeabff073fca232961284fabd31cddcc3d01d483516

Contents?: true

Size: 814 Bytes

Versions: 2

Compression:

Stored size: 814 Bytes

Contents

require 'spec_helper'

describe LogMe::NetHttpFormatter do
  describe "#format_request" do
    let(:request) do
      double "Net::HTTP::Post", method: "POST", body: "param1=value1&param2=value2"
    end
    let(:url) { "http://prodis.blog.br" }

    it "formats request message" do
      expected_message = "Request:\nPOST #{url}\nparam1=value1&param2=value2\n"
      expect(subject.format_request(request, url)).to eq expected_message
    end
  end

  describe "#format_response" do
    let(:response) do
      double "Net::HTTP::OK", http_version: "1.1", code: "200", message: "OK", body: "<xml><fake />"
    end

    it "formats response message" do
      expected_message = "Response:\nHTTP/1.1 200 OK\n<xml><fake />\n"
      expect(subject.format_response(response)).to eq expected_message
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
log-me-0.0.7 spec/logme/net_http_formatter_spec.rb
log-me-0.0.6 spec/logme/net_http_formatter_spec.rb