spec/app/app_spec.rb in cumuli-0.3.2 vs spec/app/app_spec.rb in cumuli-0.3.4
- old
+ new
@@ -1,35 +1,46 @@
require 'spec_helper'
describe Cumuli::App do
- describe '#start' do
- let(:opts) {
- {
- env: 'test',
- wait: false,
- log_dir: log_dir,
- app_dir: app_set_dir
- }
+ let(:opts) {
+ {
+ env: 'test',
+ wait: false,
+ log_dir: log_dir,
+ app_dir: app_set_dir
}
- let(:app) { Cumuli::App.new(opts) }
- let(:logs) { File.readlines("#{log_dir}/test.log") }
+ }
+ let(:app) { Cumuli::App.new(opts) }
+ let(:logs) { File.readlines("#{log_dir}/test.log") }
+ describe '#start' do
before do
clear_logs
app.start
- app.wait_for_app(2323)
+ app.wait_for_apps
end
after do
app.stop
end
+ it "stores a list of subprocesses" do
+ app.process_pids.size.should == 9
+ end
+
it "launches subprocesses with the foreman command" do
- ps_line = Cumuli::PS.new.matching.detect{|line| line.match(/foreman: master/) }
- ps_line.should_not be_nil
+ ps_line = Cumuli::PS.new.foremans
+ ps_line.size.should == 3
end
it "redirects subprocess output to the logs" do
logs.detect {|line| line.match(/started with pid/) }
+ end
+ end
+
+ describe '#stop' do
+ before do
+ app.start
+ app.wait_for_apps
end
end
end