Sha256: 8ef41fd8fad70e7be871e174c31c1456e32d5d24bea91a2c8bffa47f3ded680e

Contents?: true

Size: 1.11 KB

Versions: 34

Compression:

Stored size: 1.11 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe Headers do
  before do
    @headers = Headers.new
  end
  
  it 'should allow duplicate on some fields' do
    @headers['Set-Cookie'] = 'twice'
    @headers['Set-Cookie'] = 'is cooler the once'
    
    @headers.to_s.should == "Set-Cookie: twice\r\nSet-Cookie: is cooler the once\r\n"
  end
  
  it 'should overwrite value on non duplicate fields' do
    @headers['Host'] = 'this is unique'
    @headers['Host'] = 'so is this'

    @headers.to_s.should == "Host: this is unique\r\n"
  end
  
  it 'should output to string' do
    @headers['Host'] = 'localhost:3000'
    @headers['Set-Cookie'] = 'twice'
    @headers['Set-Cookie'] = 'is cooler the once'
    
    @headers.to_s.should == "Host: localhost:3000\r\nSet-Cookie: twice\r\nSet-Cookie: is cooler the once\r\n"
  end

  it 'should ignore nil values' do
    @headers['Something'] = nil
    @headers.to_s.should_not include('Something: ')
  end

  it 'should format Time values correctly' do
    time = Time.now
    @headers['Modified-At'] = time
    @headers.to_s.should include("Modified-At: #{time.httpdate}")
  end
end

Version data entries

34 entries across 34 versions & 5 rubygems

Version Path
macournoyer-thin-1.0.1 spec/headers_spec.rb
macournoyer-thin-1.1.0 spec/headers_spec.rb
michaelyta-thin-1.2.2 spec/headers_spec.rb
thin-1.2.11 spec/headers_spec.rb
thin-1.2.11-x86-mswin32 spec/headers_spec.rb
thin-1.2.11-x86-mingw32 spec/headers_spec.rb
thin-1.2.10 spec/headers_spec.rb
thin-1.2.10-x86-mswin32 spec/headers_spec.rb
thin-1.2.10-x86-mingw32 spec/headers_spec.rb
thin-1.2.9 spec/headers_spec.rb
thin-1.2.9-x86-mswin32 spec/headers_spec.rb
thin-1.2.9-x86-mingw32 spec/headers_spec.rb
thin-1.2.8 spec/headers_spec.rb
thin-1.2.8-x86-mswin32 spec/headers_spec.rb
thin-1.2.8-x86-mingw32 spec/headers_spec.rb
steamcannon-thin-1.2.8 spec/headers_spec.rb
thin-1.2.7 spec/headers_spec.rb
thin-1.2.7-x86-mswin32 spec/headers_spec.rb
thin-1.2.7-x86-mingw32 spec/headers_spec.rb
thin-1.2.6 spec/headers_spec.rb