Sha256: 0c13f7e0ffdd6a34a6e1c9faac5622c35bd8ca2f3672f1927a7649b00e1b6805

Contents?: true

Size: 1.06 KB

Versions: 52

Compression:

Stored size: 1.06 KB

Contents

require 'volt/server/rack/http_response_header'

describe Volt::HttpResponseHeader do
  it 'it should headerize the keys' do
    header = Volt::HttpResponseHeader.new
    header[:content_type] = 'test'
    expect(header['Content-Type']).to eq('test')
    expect(header['content-type']).to eq('test')
    expect(header['content_type']).to eq('test')
    expect(header[:content_type]).to eq('test')
    expect(header.keys).to eq(['Content-Type'])
  end

  it 'should delete keys' do
    header = Volt::HttpResponseHeader.new
    header[:content_type] = 'test'
    expect(header.delete(:content_type)).to eq('test')
    expect(header.size).to eq 0
  end

  it 'should merge other plain hashes and headerize their keys' do
    header = Volt::HttpResponseHeader.new
    header[:content_type] = 'test'

    hash = {}
    hash[:transfer_encoding] = 'encoding'

    expect(header.merge(hash)).to be_a(Volt::HttpResponseHeader)
    expect(header.merge(hash)['Transfer-Encoding']).to eq('encoding')

    header.merge!(hash)
    expect(header['Transfer-Encoding']).to eq('encoding')
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
volt-0.9.1.pre1 spec/server/rack/http_response_header_spec.rb
volt-0.9.0 spec/server/rack/http_response_header_spec.rb
volt-0.9.0.pre7 spec/server/rack/http_response_header_spec.rb
volt-0.9.0.pre6 spec/server/rack/http_response_header_spec.rb
volt-0.9.0.pre5 spec/server/rack/http_response_header_spec.rb
volt-0.9.0.pre4 spec/server/rack/http_response_header_spec.rb
volt-0.9.0.pre3 spec/server/rack/http_response_header_spec.rb
volt-0.9.0.pre2 spec/server/rack/http_response_header_spec.rb
volt-0.9.0.pre1 spec/server/rack/http_response_header_spec.rb
volt-0.8.27.beta9 spec/server/rack/http_response_header_spec.rb
volt-0.8.27.beta8 spec/server/rack/http_response_header_spec.rb
volt-0.8.27.beta7 spec/server/rack/http_response_header_spec.rb