Sha256: 4ff97ee737ef2efc62cf10089948f264589d02e1570f7b453f16cbf5e48eff0b

Contents?: true

Size: 961 Bytes

Versions: 3

Compression:

Stored size: 961 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe UniformNotifier::TerminalNotifier do
  it 'should not notify terminal-notifier when disabled' do
    expect(UniformNotifier::TerminalNotifier.out_of_channel_notify(title: 'notify terminal')).to be_nil
  end

  it "should raise an exception when terminal-notifier gem isn't available" do
    UniformNotifier.terminal_notifier = true
    expect { UniformNotifier::TerminalNotifier.out_of_channel_notify(body: 'body', title: 'notify terminal') }.to raise_error(UniformNotifier::NotificationError, /terminal-notifier gem/)
  end

  it 'should notify terminal-notifier when enabled' do
    module TerminalNotifier
      # mock TerminalNotifier
    end

    expect(TerminalNotifier).to receive(:notify).with('body', title: 'notify terminal')

    UniformNotifier.terminal_notifier = true
    UniformNotifier::TerminalNotifier.out_of_channel_notify(body: 'body', title: 'notify terminal')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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