Sha256: 76adf2132d67ce5e5ef171220f91b4a393a42986a935f05aecb6ef088c65219a

Contents?: true

Size: 1.04 KB

Versions: 35

Compression:

Stored size: 1.04 KB

Contents

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

if SWIFTIPLY_PATH.empty?
  warn "Ignoring Server on Swiftiply specs, gem install swiftiply to run"
else
  describe Server, 'on Swiftiply' do
    before do
      @swiftiply = fork do
        exec "#{SWIFTIPLY_PATH} -c #{File.dirname(__FILE__)}/swiftiply.yml"
      end
      wait_for_socket('0.0.0.0', 3333)
      sleep 2 # HACK ooh boy, I wish I knew how to make those specs more stable...
      start_server('0.0.0.0', 5555, :backend => Backends::SwiftiplyClient, :wait_for_socket => false) do |env|
        body = env.inspect + env['rack.input'].read
        [200, { 'Content-Type' => 'text/html' }, 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
end

Version data entries

35 entries across 35 versions & 6 rubygems

Version Path
grockit-thin-0.8.2 spec/server/swiftiply_spec.rb
macournoyer-thin-1.0.1 spec/server/swiftiply_spec.rb
macournoyer-thin-1.1.0 spec/server/swiftiply_spec.rb
michaelyta-thin-1.2.2 spec/server/swiftiply_spec.rb
thin-1.2.11 spec/server/swiftiply_spec.rb
thin-1.2.11-x86-mswin32 spec/server/swiftiply_spec.rb
thin-1.2.11-x86-mingw32 spec/server/swiftiply_spec.rb
thin-1.2.10 spec/server/swiftiply_spec.rb
thin-1.2.10-x86-mswin32 spec/server/swiftiply_spec.rb
thin-1.2.10-x86-mingw32 spec/server/swiftiply_spec.rb
thin-1.2.9 spec/server/swiftiply_spec.rb
thin-1.2.9-x86-mswin32 spec/server/swiftiply_spec.rb
thin-1.2.9-x86-mingw32 spec/server/swiftiply_spec.rb
thin-1.2.8 spec/server/swiftiply_spec.rb
thin-1.2.8-x86-mswin32 spec/server/swiftiply_spec.rb
thin-1.2.8-x86-mingw32 spec/server/swiftiply_spec.rb
steamcannon-thin-1.2.8 spec/server/swiftiply_spec.rb
thin-1.2.7 spec/server/swiftiply_spec.rb
thin-1.2.7-x86-mswin32 spec/server/swiftiply_spec.rb
thin-1.2.7-x86-mingw32 spec/server/swiftiply_spec.rb