Sha256: 29f047913676b4c972a041676601eb34474be478732d39fe1162ef7865239cfc

Contents?: true

Size: 889 Bytes

Versions: 5

Compression:

Stored size: 889 Bytes

Contents

require 'unit_spec_helper'

describe Rpush::Plugin do
  include Rpush::Reflectable

  it 'can only be initialized once' do
    plugin = double(Rpush::Plugin, unload: nil)
    expect(Rpush::Plugin).to receive(:new).once.and_return(plugin)
    Rpush.plugin(:test)
    Rpush.plugin(:test)
  end

  it 'can be referenced' do
    plugin = Rpush.plugin(:test)
    expect(Rpush.plugins[:test]).to eq(plugin)
  end

  it 'can be configured' do
    plugin = Rpush.plugin(:test)
    plugin.configure do |config|
      config.is_configured = true
    end
    expect(Rpush.config.plugin.test.is_configured).to be_true
  end

  it 'can hook up reflections' do
    plugin = Rpush.plugin(:test)
    reflected_error = nil
    plugin.reflect do |on|
      on.error { |error| reflected_error = error }
    end
    error = double
    reflect(:error, error)
    expect(reflected_error).to eq(error)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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