Sha256: 837163dc67d3bf49dd9dbb2a9e1e338e49c1b8db8a50510a3bc8b6c727e47823

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require 'unit_spec_helper'

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

  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

2 entries across 2 versions & 1 rubygems

Version Path
rpush-1.0.0-java spec/unit/embed_spec.rb
rpush-1.0.0 spec/unit/embed_spec.rb