Sha256: 1350c8efab6d615d7a5d63df62e11aa49b5cd2e332b4e974a6a7475f240a1605

Contents?: true

Size: 849 Bytes

Versions: 3

Compression:

Stored size: 849 Bytes

Contents

require 'spec_helper'

describe Notifiable do
  
  describe '.notifier_class' do
    context 'no override' do
      let(:notification) { create(:notification) }
      let(:device) { create(:device_token, provider: :mock) }
      before(:each) { Notifiable.notifier_classes[:mock] = MockNotifier }
      it { expect(Notifiable.notifier_class(notification, device)).to eq MockNotifier }
    end
    
    context 'override' do
      let(:notification) { create(:notification) }
      let(:device) { create(:device_token, provider: :mock) }
      before(:each) do 
        Notifiable.notifier_classes[:mock] = MockNotifier
        Notifiable.find_notifier_class do |notification, device|
          ConfigurableMockNotifier
        end
      end
      it { expect(Notifiable.notifier_class(notification, device)).to eq MockNotifier }
    end
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
notifiable-rails-0.30.2 spec/notifiable_spec.rb
notifiable-rails-0.30.1 spec/notifiable_spec.rb
notifiable-rails-0.30.0 spec/notifiable_spec.rb