Sha256: 6868bad5c60e692f4181ef745fbf11ccb11151e329ae5e939f338f5c007cf20c

Contents?: true

Size: 1.26 KB

Versions: 8

Compression:

Stored size: 1.26 KB

Contents

require 'unit_spec_helper'

describe Rpush do
  let(:config) { Rpush.config }

  before do
    Rpush.stub(require: nil)
    Rpush.stub(config: config)
  end

  it 'yields a configure 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
    config.pid_file = 'tmp/rpush.pid'
    config.pid_file.should eq '/tmp/rails_root/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

  it 'delegate redis_options to Modis' do
    Rpush.config.redis_options = { hi: :mom }
    Modis.redis_options.should eq(hi: :mom)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rpush-2.0.1-java spec/unit/configuration_spec.rb
rpush-2.0.1 spec/unit/configuration_spec.rb
rpush-2.0.0-java spec/unit/configuration_spec.rb
rpush-2.0.0 spec/unit/configuration_spec.rb
rpush-2.0.0.rc1-java spec/unit/configuration_spec.rb
rpush-2.0.0.rc1 spec/unit/configuration_spec.rb
rpush-2.0.0.beta2 spec/unit/configuration_spec.rb
rpush-2.0.0.beta1 spec/unit/configuration_spec.rb