Sha256: e6484f5640048a7632f0a51d35ed09d6feb1481de0749901f46771d8eb1e7789

Contents?: true

Size: 805 Bytes

Versions: 2

Compression:

Stored size: 805 Bytes

Contents

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

describe Server, 'on Swiftiply' do
  before do
    @swiftiply = fork do
      exec "swiftiply -c #{File.dirname(__FILE__)}/swiftiply.yml"
    end
    sleep 0.5
    start_server(Connectors::SwiftiplyClient.new('0.0.0.0', 5555, nil)) do |env|
      body = env.inspect + env['rack.input'].read
      [200, { 'Content-Type' => 'text/html', 'Content-Length' => body.size.to_s }, body]
    end
  end
    
  it 'should GET from Net::HTTP' do
    Net::HTTP.get(URI.parse("http://0.0.0.0:3333/?cthis")).should include('cthis')
  end
  
  it 'should POST from Net::HTTP' do
    Net::HTTP.post_form(URI.parse("http://0.0.0.0:3333/"), :arg => 'pirate').body.should include('arg=pirate')
  end
  
  after do
    stop_server
    Process.kill(9, @swiftiply)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thin-0.7.0-x86-mswin32-60 spec/server/swiftiply_spec.rb
thin-0.7.0 spec/server/swiftiply_spec.rb