Sha256: dc6403fdc561006aeb0d7d50e5955e6ef4e1b08ea12c27d8168034856716469b

Contents?: true

Size: 761 Bytes

Versions: 41

Compression:

Stored size: 761 Bytes

Contents

require 'unit_spec_helper'

describe Rpush::Reflectable do
  class TestReflectable
    include Rpush::Reflectable
  end

  let(:logger) { double(error: nil) }
  let(:test_reflectable) { TestReflectable.new }

  before do
    allow(Rpush.reflection_stack[0]).to receive(:__dispatch)
    allow(Rpush).to receive_messages(logger: logger)
  end

  it 'dispatches the given reflection' do
    expect(Rpush.reflection_stack[0]).to receive(:__dispatch).with(:error)
    test_reflectable.reflect(:error)
  end

  it 'logs errors raised by the reflection' do
    error = StandardError.new
    allow(Rpush.reflection_stack[0]).to receive(:__dispatch).and_raise(error)
    expect(Rpush.logger).to receive(:error).with(error)
    test_reflectable.reflect(:error)
  end
end

Version data entries

41 entries across 41 versions & 2 rubygems

Version Path
rpush-9.1.0 spec/unit/reflectable_spec.rb
rpush-9.0.0 spec/unit/reflectable_spec.rb
rpush-8.0.0 spec/unit/reflectable_spec.rb
rpush-7.0.1 spec/unit/reflectable_spec.rb
rpush-7.0.0 spec/unit/reflectable_spec.rb
rpush-6.0.1 spec/unit/reflectable_spec.rb
rpush-6.0.0 spec/unit/reflectable_spec.rb
rpush-5.4.0 spec/unit/reflectable_spec.rb
rpush-5.3.0 spec/unit/reflectable_spec.rb
rpush-5.2.0 spec/unit/reflectable_spec.rb
rpush-5.1.0 spec/unit/reflectable_spec.rb
rpush-5.0.0 spec/unit/reflectable_spec.rb
rpush-4.2.0 spec/unit/reflectable_spec.rb
rpush-4.1.1 spec/unit/reflectable_spec.rb
rpush-4.1.0 spec/unit/reflectable_spec.rb
rpush-4.0.1 spec/unit/reflectable_spec.rb
rpush-4.0.0 spec/unit/reflectable_spec.rb
rpush-3.3.1 spec/unit/reflectable_spec.rb
rpush-3.3.0 spec/unit/reflectable_spec.rb
rpush_extended-3.2.6 spec/unit/reflectable_spec.rb