Sha256: a426971d559021a0c71806b52fc9a085b4f556c14d95931768fa0b323056fb1d

Contents?: true

Size: 1.91 KB

Versions: 5

Compression:

Stored size: 1.91 KB

Contents

require 'rails_helper'

describe NotifyOn::Configuration do

  # Reset the configuration to what the app was using after each spec here.
  after(:each) do
    NotifyOn.configure do |config|
      config.default_email = 'NotifyOn <noreply@example.com>'
      config.pusher_app_id = 'my_app_id'
      config.pusher_key = 'my_key'
      config.pusher_secret = 'my_secret'
    end
  end

  it 'sets the expected defaults' do
    NotifyOn.reset
    config = NotifyOn.configuration
    expect(config.default_email).to eq(nil)
    expect(config.default_pusher_channel).to eq(nil)
    expect(config.default_pusher_event).to eq(nil)
    expect(config.deliver_mail).to eq(:now)
    expect(config.mailer_class).to eq('NotifyOn::NotificationMailer')
    expect(config.pusher_app_id).to eq(nil)
    expect(config.pusher_key).to eq(nil)
    expect(config.pusher_secret).to eq(nil)
    expect(config.use_pusher_by_default).to eq(false)
  end

  it 'can be overridden' do
    NotifyOn.configure do |config|
      config.default_email = 'noreply@example.com'
      config.default_pusher_channel = 'presence-message-{id}'
      config.default_pusher_event = 'new_message'
      config.deliver_mail = :later
      config.mailer_class = 'NotificationMailer'
      config.pusher_app_id = 'my_app_id'
      config.pusher_key = 'my_key'
      config.pusher_secret = 'my_secret'
      config.use_pusher_by_default = true
    end
    config = NotifyOn.configuration
    expect(config.default_email).to eq('noreply@example.com')
    expect(config.default_pusher_channel).to eq('presence-message-{id}')
    expect(config.default_pusher_event).to eq('new_message')
    expect(config.deliver_mail).to eq(:later)
    expect(config.mailer_class).to eq('NotificationMailer')
    expect(config.pusher_app_id).to eq('my_app_id')
    expect(config.pusher_key).to eq('my_key')
    expect(config.pusher_secret).to eq('my_secret')
    expect(config.use_pusher_by_default).to eq(true)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
notify_on-1.0.5 spec/lib/notify_on/configuration_spec.rb
notify_on-1.0.4 spec/lib/notify_on/configuration_spec.rb
notify_on-1.0.3 spec/lib/notify_on/configuration_spec.rb
notify_on-1.0.2 spec/lib/notify_on/configuration_spec.rb
notify_on-1.0.1 spec/lib/notify_on/configuration_spec.rb