Sha256: 4f08cd6db6c58d82ae7aa68a0990e8cdcf397fe6d73d157e7b2c022517a26294

Contents?: true

Size: 666 Bytes

Versions: 5

Compression:

Stored size: 666 Bytes

Contents

require 'spec_helper'
module Alf
  module Rack
    describe Response, 'initialize' do

      subject{ Response.new({"HTTP_ACCEPT" => accept}) }

      context 'when supported' do
        let(:accept){ "application/json" }

        it{ should be_a(Response) }

        it 'sets the Content-Type header immediately' do
          subject['Content-Type'].should eq(accept)
        end
      end

      context 'when not supported' do
        let(:accept){ "text/unknown" }

        it 'raises an AcceptError' do
          lambda{
            subject
          }.should raise_error(AcceptError, /Unsupported(.*?)`text\/unknown`/)
        end
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-rack-0.16.3 spec/response/test_initialize.rb
alf-rack-0.16.2 spec/response/test_initialize.rb
alf-rack-0.16.1 spec/response/test_initialize.rb
alf-rack-0.16.0 spec/response/test_initialize.rb
alf-rack-0.15.0 spec/response/test_initialize.rb