Sha256: 30a3dabfe95b9f7a81451b2e81c15c8e2003200633d29d89268a441d3c917e97
Contents?: true
Size: 1.25 KB
Versions: 4
Compression:
Stored size: 1.25 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 at_exit do Lsof.kill(8080) end system("bin/screw_unit_server --spec-path=#{spec_root_path} --root-path=#{public_path}") 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
4 entries across 4 versions & 2 rubygems