Sha256: 27dcda65d6fbdd3c288511d792cf2c9a57446df7acea51daf13c975e5b03729d

Contents?: true

Size: 941 Bytes

Versions: 2

Compression:

Stored size: 941 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) do 
        Notifiable.find_notifier_class_proc = nil
        Notifiable.notifier_classes[:mock] = MockNotifier
      end
      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_proc = proc do |notification, device|
          ConfigurableMockNotifier
        end
      end
      it { expect(Notifiable.notifier_class(notification, device)).to eq ConfigurableMockNotifier }
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
notifiable-rails-0.30.4 spec/notifiable_spec.rb
notifiable-rails-0.30.3 spec/notifiable_spec.rb