Sha256: 05d75f41e8e9eedf2041f6d8ebf0ecfebc32f058fa766100a858ae34bbb9e9de
Contents?: true
Size: 1.23 KB
Versions: 17
Compression:
Stored size: 1.23 KB
Contents
require "rubygems" require "timeout" require "lsof" dir = File.dirname(__FILE__) $LOAD_PATH.unshift "#{dir}/../../lib" require "screw_unit" require "nokogiri" module WaitFor extend self def wait_for(time=5) Timeout.timeout(time) do loop do value = yield return value if value end end end end class FunctionalSpecServerStarter class << self include WaitFor def call(threaded=true) return if $screw_unit_server_started Lsof.kill(8080) wait_for do !Lsof.running?(8080) end dir = File.dirname(__FILE__) Dir.chdir("#{dir}/../../") do Thread.start do start_thin_server end end wait_for do Lsof.running?(8080) end $screw_unit_server_started = true end def start_thin_server system("bin/screw_unit_server #{spec_root_path} #{public_path}") at_exit do Lsof.kill(8080) end end def spec_root_path File.expand_path("#{dir}/../example_specs") end def public_path File.expand_path("#{dir}/../example_public") end def dir dir = File.dirname(__FILE__) end end end if $0 == __FILE__ FunctionalSpecServerStarter.call(false) end
Version data entries
17 entries across 17 versions & 4 rubygems