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.7.pre8 spec/server/rack/http_response_header_spec.rb
volt-0.9.7.pre7 spec/server/rack/http_response_header_spec.rb
volt-0.9.7.pre6 spec/server/rack/http_response_header_spec.rb
volt-0.9.7.pre5 spec/server/rack/http_response_header_spec.rb
volt-0.9.7.pre3 spec/server/rack/http_response_header_spec.rb
volt-0.9.7.pre2 spec/server/rack/http_response_header_spec.rb
volt-0.9.6 spec/server/rack/http_response_header_spec.rb
volt-0.9.6.pre3 spec/server/rack/http_response_header_spec.rb
volt-0.9.6.pre2 spec/server/rack/http_response_header_spec.rb
volt-0.9.6.pre1 spec/server/rack/http_response_header_spec.rb
volt-0.9.5 spec/server/rack/http_response_header_spec.rb
volt-0.9.5.pre12 spec/server/rack/http_response_header_spec.rb
volt-0.9.5.pre11 spec/server/rack/http_response_header_spec.rb
volt-0.9.5.pre9 spec/server/rack/http_response_header_spec.rb
volt-0.9.5.pre8 spec/server/rack/http_response_header_spec.rb
volt-0.9.5.pre7 spec/server/rack/http_response_header_spec.rb
volt-0.9.5.pre6 spec/server/rack/http_response_header_spec.rb
volt-0.9.5.pre5 spec/server/rack/http_response_header_spec.rb
volt-0.9.5.pre4 spec/server/rack/http_response_header_spec.rb
volt-0.9.5.pre3 spec/server/rack/http_response_header_spec.rb