Sha256: 049b2e6b47dcdf171ceabffe68a5a1cc2175a3e427ccc6c272c5ebb803e619ef

Contents?: true

Size: 847 Bytes

Versions: 3

Compression:

Stored size: 847 Bytes

Contents

require 'spec_helper'

describe Notifiable::Batch do
  let(:user1) { FactoryGirl.create(:user) }
  let(:notification) { Notifiable::Notification.new(:message => "Test message")}
  
  it "configures the provider" do  
    FactoryGirl.create(:mock_token, :provider => :configurable_mock, :user_id => user1.id)
      
    config = {:configurable_mock => {:use_sandbox => true}}
    
    b = Notifiable::Batch.new(config)
    b.add(notification, user1)

    b.notifiers[:configurable_mock].env.should eql Rails.env
    b.notifiers[:configurable_mock].use_sandbox.should == true
  end
  
end

class ConfigurableMockNotifier < Notifiable::NotifierBase
  attr_accessor :use_sandbox
  
  def enqueue(notification, device_token)
    processed(notification, device_token)
  end
end

Notifiable.notifier_classes[:configurable_mock] = ConfigurableMockNotifier

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
notifiable-rails-0.5.1 spec/batch_spec.rb
notifiable-rails-0.5.0 spec/batch_spec.rb
notifiable-rails-0.4.0 spec/batch_spec.rb