Sha256: b4c6f16a11d6a7b1fc41c6c57e5c6ec550005455841b30de6de1555bcccb835a

Contents?: true

Size: 874 Bytes

Versions: 3

Compression:

Stored size: 874 Bytes

Contents

require "spec_helper"
require "httpi/response"

describe HTTPI::Response do
  let(:response) { HTTPI::Response.new 200, { "Content-Encoding" => "gzip" }, Fixture.gzip }

  describe "#code" do
    it "should return the HTTP response code" do
      response.code.should == 200
    end

    it "should always return an Integer" do
      response = HTTPI::Response.new "200", {}, ""
      response.code.should == 200
    end
  end

  describe "#headers" do
    it "should return the HTTP response headers" do
      response.headers.should == { "Content-Encoding" => "gzip" }
    end
  end

  describe "#body" do
    it "should return the (gzip decoded) HTTP response body" do
      response.body.should == Fixture.xml
    end
  end

  describe "#raw_body" do
    it "should return the raw HTML response body" do
      response.raw_body.should == Fixture.gzip
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
httpi-0.6.1 spec/httpi/response_spec.rb
httpi-0.6.0 spec/httpi/response_spec.rb
httpi-0.5.0 spec/httpi/response_spec.rb