Sha256: c73774d93f7a5602b97be8262891e025eb4ee54f708a6c74a9e0419c3a2168d6
Contents?: true
Size: 1.53 KB
Versions: 1
Compression:
Stored size: 1.53 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Hatetepe::Server::KeepAlive do let(:config) { double('config') } let(:server) { double('server') } let(:connection) { double('connection') } let(:object) { described_class.new(config, server, connection) } let(:request) do double('request', http_version: http_version, headers: { 'Connection' => header }) end let(:served) { double('served', value: response) } let(:response) { double('response', headers: { 'Connection' => header }) } describe '#close_connection?' do before { object.serve(request, served) } let(:subject) { object.send(:close_connection?, request) } describe 'with HTTP/1.0 request' do let(:http_version) { 1.0 } describe 'and no header' do let(:header) { nil } it { should be(true) } end describe 'and Connection: close' do let(:header) { 'close' } it { should be(true) } end describe 'and Connection: keep-alive' do let(:header) { 'keep-alive' } it { should be(false) } end end describe 'with HTTP/1.1 request' do let(:http_version) { 1.1 } describe 'and no header' do let(:header) { nil } it { should be(false) } end describe 'and Connection: close' do let(:header) { 'close' } it { should be(true) } end describe 'and Connection: keep-alive' do let(:header) { 'keep-alive' } it { should be(false) } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hatetepe-0.6.0.pre.1 | spec/unit/server/keep_alive_spec.rb |