Sha256: 526161bc619d390f1c35dcff35e4a58924b6d222df1b7a6c80b4a56ff8f8a91c

Contents?: true

Size: 1004 Bytes

Versions: 2

Compression:

Stored size: 1004 Bytes

Contents

require 'unit_spec_helper'

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

  it 'sets the push config option to true' do
    Rpush.push
    expect(Rpush.config.push).to eq(true)
  end

  it 'initializes the daemon' do
    expect(Rpush::Daemon).to receive(:common_init)
    Rpush.push
  end

  it 'syncs' do
    expect(Rpush::Daemon::Synchronizer).to receive(:sync)
    Rpush.push
  end

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

  it 'stops on the app runner' do
    expect(Rpush::Daemon::AppRunner).to 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

2 entries across 2 versions & 1 rubygems

Version Path
rpush-2.3.2-java spec/unit/push_spec.rb
rpush-2.3.2 spec/unit/push_spec.rb