Sha256: 0ae730389c4c36664851601e5150b2c694d5cd5cc22badd42ef72eb5255991a6

Contents?: true

Size: 976 Bytes

Versions: 3

Compression:

Stored size: 976 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe UniformNotifier::Raise do
  it 'should not notify message' do
    expect(UniformNotifier::Raise.out_of_channel_notify(title: 'notification')).to be_nil
  end

  it 'should raise error of the default class' do
    UniformNotifier.raise = true
    expect {
      UniformNotifier::Raise.out_of_channel_notify(title: 'notification')
    }.to raise_error(UniformNotifier::Exception, 'notification')
  end

  it 'allows the user to override the default exception class' do
    klass = Class.new(Exception)
    UniformNotifier.raise = klass
    expect {
      UniformNotifier::Raise.out_of_channel_notify(title: 'notification')
    }.to raise_error(klass, 'notification')
  end

  it 'can be turned from on to off again' do
    UniformNotifier.raise = true
    UniformNotifier.raise = false

    expect {
      UniformNotifier::Raise.out_of_channel_notify(title: 'notification')
    }.not_to raise_error
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uniform_notifier-1.13.0 spec/uniform_notifier/raise_spec.rb
uniform_notifier-1.12.1 spec/uniform_notifier/raise_spec.rb
uniform_notifier-1.12.0 spec/uniform_notifier/raise_spec.rb