Revert "Merge pull request #176 from rtyler/feature/156-foreman-stop-command"
Rewriting using a better Process API This reverts commitdbe51832b0, reversing changes made to69216b4c5e.
This commit is contained in:
@@ -21,7 +21,7 @@ describe "Foreman::CLI", :fakefs do
|
||||
|
||||
it "runs successfully" do
|
||||
dont_allow(subject).error
|
||||
mock.instance_of(Foreman::Engine).run
|
||||
mock.instance_of(Foreman::Engine).start
|
||||
subject.start
|
||||
end
|
||||
|
||||
|
||||
@@ -28,15 +28,14 @@ describe "Foreman::Engine", :fakefs do
|
||||
end
|
||||
end
|
||||
|
||||
describe "run" do
|
||||
describe "start" do
|
||||
it "forks the processes" do
|
||||
write_procfile
|
||||
mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./alpha", is_a(IO))
|
||||
mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./bravo", is_a(IO))
|
||||
mock(subject).watch_for_output
|
||||
mock(subject).watch_for_termination
|
||||
mock(subject).terminate_gracefully
|
||||
subject.run
|
||||
subject.start
|
||||
end
|
||||
|
||||
it "handles concurrency" do
|
||||
@@ -46,8 +45,7 @@ describe "Foreman::Engine", :fakefs do
|
||||
mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./bravo", is_a(IO)).never
|
||||
mock(engine).watch_for_output
|
||||
mock(engine).watch_for_termination
|
||||
mock(engine).terminate_gracefully
|
||||
engine.run
|
||||
engine.start
|
||||
end
|
||||
end
|
||||
|
||||
@@ -57,7 +55,7 @@ describe "Foreman::Engine", :fakefs do
|
||||
stub(Process).fork
|
||||
any_instance_of(Foreman::Engine) do |engine|
|
||||
stub(engine).info
|
||||
stub(engine).start
|
||||
stub(engine).spawn_processes
|
||||
stub(engine).watch_for_termination
|
||||
end
|
||||
end
|
||||
@@ -66,7 +64,7 @@ describe "Foreman::Engine", :fakefs do
|
||||
File.open("/tmp/env", "w") { |f| f.puts("FOO=baz") }
|
||||
engine = Foreman::Engine.new("Procfile", :env => "/tmp/env")
|
||||
engine.environment.should == {"FOO"=>"baz"}
|
||||
engine.run
|
||||
engine.start
|
||||
end
|
||||
|
||||
it "should read more than one if specified" do
|
||||
@@ -74,7 +72,7 @@ describe "Foreman::Engine", :fakefs do
|
||||
File.open("/tmp/env2", "w") { |f| f.puts("BAZ=qux") }
|
||||
engine = Foreman::Engine.new("Procfile", :env => "/tmp/env1,/tmp/env2")
|
||||
engine.environment.should == { "FOO"=>"bar", "BAZ"=>"qux" }
|
||||
engine.run
|
||||
engine.start
|
||||
end
|
||||
|
||||
it "should handle quoted values" do
|
||||
@@ -97,7 +95,7 @@ describe "Foreman::Engine", :fakefs do
|
||||
File.open(".env", "w") { |f| f.puts("FOO=qoo") }
|
||||
engine = Foreman::Engine.new("Procfile")
|
||||
engine.environment.should == {"FOO"=>"qoo"}
|
||||
engine.run
|
||||
engine.start
|
||||
end
|
||||
end
|
||||
|
||||
@@ -111,8 +109,7 @@ describe "Foreman::Engine", :fakefs do
|
||||
it "should spawn" do
|
||||
stub(subject).watch_for_output
|
||||
stub(subject).watch_for_termination
|
||||
stub(subject).terminate_gracefully
|
||||
subject.run
|
||||
subject.start
|
||||
Process.waitall
|
||||
mock(subject).info(/started with pid \d+/, "utf8.1", anything)
|
||||
mock(subject).info("\xff\x03\n", "utf8.1", anything)
|
||||
|
||||
Reference in New Issue
Block a user