Sha256: 8d8c8f66b898da4e8f44eb8e99d69ce2e6a050c2f07f6a0e883b64b4d773b3d6

Contents?: true

Size: 806 Bytes

Versions: 2

Compression:

Stored size: 806 Bytes

Contents

require 'spec_helper'

module Foreground
  describe CLI do
    before do
      Daemon.stub(:run)
      @argv = ['--pid_file', '/tmp/foreground_sample_daemon.pid', 'foreground_sample_daemon']
      @cli = CLI.new
    end

    describe '.run' do
      it 'should run a new instance' do
        cli = mock('cli')
        cli.should_receive(:run).with(@argv)
        CLI.should_receive(:new).and_return(cli)
        CLI.run(@argv)
      end
    end

    describe '#run' do
      it 'should parse argv' do
        @cli.should_receive(:parse_options).with(@argv).and_return(@argv)
        @cli.run(@argv)
      end

      it 'should run the daemon' do
        Daemon.should_receive(:run).with(['foreground_sample_daemon'], '/tmp/foreground_sample_daemon.pid')
        @cli.run(@argv)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreground-0.0.4 spec/foreground/cli_spec.rb
foreground-0.0.3 spec/foreground/cli_spec.rb