File: persistent_spec.rb

package info (click to toggle)
thin 1.2.4-1.1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,252 kB
  • ctags: 531
  • sloc: ruby: 4,529; ansic: 725; sh: 21; makefile: 16
file content (35 lines) | stat: -rw-r--r-- 1,186 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require File.dirname(__FILE__) + '/../spec_helper'

describe Request, 'persistent' do
  before do
    @request = Request.new
  end
  
  it "should not assume that a persistent connection is maintained for HTTP version 1.0" do
    @request.env['HTTP_VERSION'] = 'HTTP/1.0'
    @request.should_not be_persistent
  end

  it "should assume that a persistent connection is maintained for HTTP version 1.0 when specified" do
    @request.env['HTTP_VERSION'] = 'HTTP/1.0'
    @request.env['HTTP_CONNECTION'] = 'Keep-Alive'
    @request.should be_persistent
  end
  
  it "should maintain a persistent connection for HTTP/1.1 client" do
    @request.env['HTTP_VERSION'] = 'HTTP/1.1'
    @request.env['HTTP_CONNECTION'] = 'Keep-Alive'
    @request.should be_persistent
  end

  it "should maintain a persistent connection for HTTP/1.1 client by default" do
    @request.env['HTTP_VERSION'] = 'HTTP/1.1'
    @request.should be_persistent
  end

  it "should not maintain a persistent connection for HTTP/1.1 client when Connection header include close" do
    @request.env['HTTP_VERSION'] = 'HTTP/1.1'
    @request.env['HTTP_CONNECTION'] = 'close'
    @request.should_not be_persistent
  end
end