1 require File.dirname(__FILE__) + '/spec_helper'
8 it 'should allow duplicate on some fields' do
9 @headers['Set-Cookie'] = 'twice'
10 @headers['Set-Cookie'] = 'is cooler the once'
12 @headers.to_s.should == "Set-Cookie: twice\r\nSet-Cookie: is cooler the once\r\n"
15 it 'should overwrite value on non duplicate fields' do
16 @headers['Host'] = 'this is unique'
17 @headers['Host'] = 'so is this'
19 @headers.to_s.should == "Host: this is unique\r\n"
22 it 'should output to string' do
23 @headers['Host'] = 'localhost:3000'
24 @headers['Set-Cookie'] = 'twice'
25 @headers['Set-Cookie'] = 'is cooler the once'
27 @headers.to_s.should == "Host: localhost:3000\r\nSet-Cookie: twice\r\nSet-Cookie: is cooler the once\r\n"
30 it 'should ignore nil values' do
31 @headers['Something'] = nil
32 @headers.to_s.should_not include('Something: ')
35 it 'should format Time values correctly' do
37 @headers['Modified-At'] = time
38 @headers.to_s.should include("Modified-At: #{time.httpdate}")