Sha256: b7e641017b649fe1d0a4f01aee17bda427ad2edf65322ba966fee55a5b345674

Contents?: true

Size: 917 Bytes

Versions: 5

Compression:

Stored size: 917 Bytes

Contents

require 'unit_spec_helper'

describe Rpush, 'push' do
  before do
    Rpush::Daemon::Synchronizer.stub(sync: nil)
    Rpush::Daemon::AppRunner.stub(wait: nil)
    Rpush::Daemon::Feeder.stub(start: nil)
  end

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

  it 'initializes the daemon' do
    Rpush::Daemon.should_receive(:common_init)
    Rpush.push
  end

  it 'syncs' do
    Rpush::Daemon::Synchronizer.should_receive(:sync)
    Rpush.push
  end

  it 'starts the feeder' do
    Rpush::Daemon::Feeder.should_receive(:start)
    Rpush.push
  end

  it 'stops on the app runner' do
    Rpush::Daemon::AppRunner.should_receive(:stop)
    Rpush.push
  end

  it 'overrides the default config options with those given as a hash' do
    Rpush.config.batch_size = 20
    expect { Rpush.push(batch_size: 10) }.to change(Rpush.config, :batch_size).to(10)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rpush-2.3.1-java spec/unit/push_spec.rb
rpush-2.3.1 spec/unit/push_spec.rb
rpush-2.3.0-java spec/unit/push_spec.rb
rpush-2.3.0 spec/unit/push_spec.rb
rpush-2.3.0.rc1 spec/unit/push_spec.rb