Sha256: 2cd145b2b3d686252016820afe74795d93bf801dfe72a25c86e36154736412a1

Contents?: true

Size: 957 Bytes

Versions: 2

Compression:

Stored size: 957 Bytes

Contents

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

2 entries across 2 versions & 1 rubygems

Version Path
uniform_notifier-1.11.0 spec/uniform_notifier/raise_spec.rb
uniform_notifier-1.10.0 spec/uniform_notifier/raise_spec.rb