Sha256: 5b9376a72060c8a283204932973ee16492cc0f759fba33315f6e1b5a27d64c8d

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'unit_spec_helper'

describe Rpush do
  let(:config) { double }

  before { Rpush.stub(:config => config) }

  it 'can yields a config block' do
    expect { |b| Rpush.configure(&b) }.to yield_with_args(config)
  end
end

describe Rpush::Configuration do
  let(:config) do
    Rpush::Deprecation.muted do
      Rpush::Configuration.new
    end
  end

  it 'can be updated' do
    Rpush::Deprecation.muted do
      new_config = Rpush::Configuration.new
      new_config.batch_size = 200
      expect { config.update(new_config) }.to change(config, :batch_size).to(200)
    end
  end

  it 'sets the pid_file relative if not absolute' do
    Rails.stub(:root => '/rails')
    config.pid_file = 'tmp/rpush.pid'
    config.pid_file.should eq '/rails/tmp/rpush.pid'
  end

  it 'does not alter an absolute pid_file path' do
    config.pid_file = '/tmp/rpush.pid'
    config.pid_file.should eq '/tmp/rpush.pid'
  end

  it 'does not allow foreground to be set to false if the platform is JRuby' do
    config.foreground = true
    Rpush.stub(:jruby? => true)
    config.foreground = false
    config.foreground.should be_true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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