Sha256: 095dc3bbce9315406bea4776372da9c0227cad4b3af259726d09532de5242978

Contents?: true

Size: 1.14 KB

Versions: 36

Compression:

Stored size: 1.14 KB

Contents

require 'unit_spec_helper'

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

  before do
    allow(Rpush).to receive_messages(require: nil)
    allow(Rpush).to receive_messages(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'
    expect(config.pid_file).to eq '/tmp/rails_root/tmp/rpush.pid'
  end

  it 'does not alter an absolute pid_file path' do
    config.pid_file = '/tmp/rpush.pid'
    expect(config.pid_file).to eq '/tmp/rpush.pid'
  end

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

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
rpush-7.0.1 spec/unit/configuration_spec.rb
rpush-7.0.0 spec/unit/configuration_spec.rb
rpush-6.0.1 spec/unit/configuration_spec.rb
rpush-6.0.0 spec/unit/configuration_spec.rb
rpush-5.4.0 spec/unit/configuration_spec.rb
rpush-5.3.0 spec/unit/configuration_spec.rb
rpush-5.2.0 spec/unit/configuration_spec.rb
rpush-5.1.0 spec/unit/configuration_spec.rb
rpush-5.0.0 spec/unit/configuration_spec.rb
rpush-4.2.0 spec/unit/configuration_spec.rb
rpush-4.1.1 spec/unit/configuration_spec.rb
rpush-4.1.0 spec/unit/configuration_spec.rb
rpush-4.0.1 spec/unit/configuration_spec.rb
rpush-4.0.0 spec/unit/configuration_spec.rb
rpush-3.3.1 spec/unit/configuration_spec.rb
rpush-3.3.0 spec/unit/configuration_spec.rb
rpush_extended-3.2.6 spec/unit/configuration_spec.rb
rpush_extended-3.2.5 spec/unit/configuration_spec.rb
rpush-3.2.4 spec/unit/configuration_spec.rb
rpush-3.2.3 spec/unit/configuration_spec.rb