Sha256: a9126e427250f86d4fe815b75e6121756624332f9e178fcfe3a8e51603342078

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require 'unit_spec_helper'

describe Rpush, 'embed' do
  before do
    Rpush::Daemon.stub(start: nil, shutdown: nil)
    Kernel.stub(:at_exit)
  end

  after { Rpush.shutdown }

  it 'sets the embedded config option to true' do
    Rpush.embed
    Rpush.config.embedded.should be_true
  end

  it 'starts the daemon' do
    Rpush::Daemon.should_receive(:start)
    Rpush.embed
  end

  it 'overrides the default config options with those given as a hash' do
    Rpush.config.push_poll = 4
    expect { Rpush.embed(push_poll: 2) }.to change(Rpush.config, :push_poll).to(2)
  end
end

describe Rpush, 'shutdown' do
  before { Rpush.config.embedded = true }

  it 'shuts down the daemon' do
    Rpush::Daemon.should_receive(:shutdown)
    Rpush.shutdown
  end
end

describe Rpush, 'sync' do
  before { Rpush.config.embedded = true }

  it 'syncs the AppRunner' do
    Rpush::Daemon::AppRunner.should_receive(:sync)
    Rpush.sync
  end
end

describe Rpush, 'debug' do
  before { Rpush.config.embedded = true }

  it 'debugs the AppRunner' do
    Rpush::Daemon::AppRunner.should_receive(:debug)
    Rpush.debug
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rpush-2.0.0.beta1 spec/unit/embed_spec.rb