Created
November 21, 2012 10:57
-
-
Save takai/4124293 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'foreman/engine/cli' | |
procfile = File.expand_path('../../Procfile', __FILE__) | |
envfile = File.expand_path('../../.env', __FILE__) | |
foreman = Foreman::Engine::CLI.new | |
foreman.load_procfile(procfile) | |
foreman.load_env(envfile) if File.exist? envfile | |
RSpec.configure do |config| | |
config.before(:all) do | |
Thread.new do | |
foreman.startup | |
foreman.__send__ :spawn_processes | |
foreman.__send__ :watch_for_output | |
end | |
sleep 0.1 # wait for server to start | |
end | |
config.after(:all) do | |
running = foreman.instance_variable_get(:@running) | |
running.keys.each do |pid| | |
Process.kill 'TERM', pid | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment