flowerbox-delivery/features/step_definitions/given/i_have_existing_service.rb

16 lines
342 B
Ruby
Raw Permalink Normal View History

require 'thread'
require 'rack'
Given /^I have an existing service running on port "([^"]*)"$/ do |port|
@running_server = Thread.new do
Rack::Handler::WEBrick.run(lambda { |env| [ 200, {}, [] ] }, :Port => port) { |server|
Thread.current[:server] = server
}
end
while !@running_server[:server]
sleep 0.1
end
end