Sha256: 4eb551eb6cdcb0031c03de0f6ecfcd62e8bc1c4dce43915cbdde84b3b3307654

Contents?: true

Size: 965 Bytes

Versions: 2

Compression:

Stored size: 965 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Hatetepe::Response do
  describe '#initialize' do
    subject do
      Hatetepe::Response.new(200, { 'Key' => 'value' }, 'hello').freeze
    end

    its(:status) { should be(200) }
    its(:headers) { should eq('Key' => 'value') }

    specify { expect(subject.body.read).to eq('hello') }

    its(:status_name) { should eq('OK') }

    describe 'defaults' do
      subject { Hatetepe::Response.new(200) }

      its(:headers) { should eq({}) }
      its(:http_version) { should eq(1.1) }

      specify { expect(subject.body.read).to be_empty }
    end

    describe 'unknown status' do
      subject { Hatetepe::Response.new(-1) }

      its(:status) { should be(-1) }
      its(:status_name) { should eq('Unknown Status') }
    end
  end

  describe '#http_version=' do
    subject { Hatetepe::Response.new(200) }

    before { subject.http_version = 1.0 }

    its(:http_version) { should eq(1.0) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hatetepe-0.6.0.pre.2 spec/unit/response_spec.rb
hatetepe-0.6.0.pre.1 spec/unit/response_spec.rb