Sha256: 9499485e0e07c4a3bcb32c64bf93763c277a39ef795613af6efdb40cd617c56e

Contents?: true

Size: 1.08 KB

Versions: 14

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe Localeapp::CLI::Daemon, "#execute(options)" do
  let(:output) { StringIO.new }
  let(:command) { Localeapp::CLI::Daemon.new(:output => output) }
  let(:interval) { 5 }

  before do
    command.stub(:update_loop)
  end

  it "exits when interval isn't greater than 0" do
    command.should_receive(:exit_now!)
    command.execute(:interval => -1)
  end

  it "runs the loop directly when not running in background" do
    command.should_receive(:update_loop).with(interval)
    command.execute(:interval => interval)
  end

  it "runs the loop in the background when background options set" do
    command.should_receive(:run_in_background).with(interval)
    command.execute(:interval => interval, :background => true)
  end
end

describe Localeapp::CLI::Daemon, "#do_update" do
  let(:output) { StringIO.new }
  let(:command) { Localeapp::CLI::Daemon.new(:output => output) }

  it "creates and executes and Updater" do
    stub = stub(:updater)
    stub.should_receive(:execute)
    Localeapp::CLI::Update.should_receive(:new).and_return(stub)
    command.do_update
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
localeapp-0.6.14 spec/localeapp/cli/daemon_spec.rb
localeapp-0.6.13 spec/localeapp/cli/daemon_spec.rb
localeapp-0.6.12 spec/localeapp/cli/daemon_spec.rb
localeapp-0.6.10 spec/localeapp/cli/daemon_spec.rb
localeapp-0.6.9 spec/localeapp/cli/daemon_spec.rb
localeapp-0.6.8 spec/localeapp/cli/daemon_spec.rb
localeapp-0.6.7 spec/localeapp/cli/daemon_spec.rb
localeapp-0.6.6 spec/localeapp/cli/daemon_spec.rb
localeapp-0.6.5 spec/localeapp/cli/daemon_spec.rb
localeapp-0.6.4 spec/localeapp/cli/daemon_spec.rb
localeapp-0.6.3 spec/localeapp/cli/daemon_spec.rb
localeapp-0.6.2 spec/localeapp/cli/daemon_spec.rb
localeapp-0.6.1 spec/localeapp/cli/daemon_spec.rb
localeapp-0.6.0 spec/localeapp/cli/daemon_spec.rb