Sha256: 98a2c065cf790f365fb815586bdb80d7c7ffad88e9762e42f8d38051f560c7db

Contents?: true

Size: 869 Bytes

Versions: 3

Compression:

Stored size: 869 Bytes

Contents

require 'spec_helper'

describe Cumuli::Spawner::App do
  let(:opts) {
    {
      env: 'test',
      wait: false,
      log_dir: log_dir,
      app_dir: app_set_dir
    }
  }
  let(:app) { Cumuli::Spawner::App.new(opts) }
  let(:logs) { File.readlines("#{log_dir}/test.log") }

  describe '#start' do
    before do
      clear_logs
      app.start
      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.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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cumuli-0.5.0 spec/spawner/app_spec.rb
cumuli-0.4.1 spec/spawner/app_spec.rb
cumuli-0.4.0 spec/spawner/app_spec.rb