1 require File.dirname(__FILE__) + '/../spec_helper'
3 if SWIFTIPLY_PATH.empty?
4 warn "Ignoring Server on Swiftiply specs, gem install swiftiply to run"
6 describe Server, 'on Swiftiply' do
9 exec "#{SWIFTIPLY_PATH} -c #{File.dirname(__FILE__)}/swiftiply.yml"
11 wait_for_socket('0.0.0.0', 3333)
12 sleep 2 # HACK ooh boy, I wish I knew how to make those specs more stable...
13 start_server('0.0.0.0', 5555, :backend => Backends::SwiftiplyClient, :wait_for_socket => false) do |env|
14 body = env.inspect + env['rack.input'].read
15 [200, { 'Content-Type' => 'text/html' }, body]
19 it 'should GET from Net::HTTP' do
20 Net::HTTP.get(URI.parse("http://0.0.0.0:3333/?cthis")).should include('cthis')
23 it 'should POST from Net::HTTP' do
24 Net::HTTP.post_form(URI.parse("http://0.0.0.0:3333/"), :arg => 'pirate').body.should include('arg=pirate')
29 Process.kill(9, @swiftiply)