Sha256: a77b7e9aaf988f6b6b09a8cf72804e3c71dfcb81962f48e588acea6704db5a35

Contents?: true

Size: 971 Bytes

Versions: 7

Compression:

Stored size: 971 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

7 entries across 7 versions & 1 rubygems

Version Path
uniform_notifier-1.16.0 spec/uniform_notifier/terminal_notifier_spec.rb
uniform_notifier-1.15.0 spec/uniform_notifier/terminal_notifier_spec.rb
uniform_notifier-1.14.2 spec/uniform_notifier/terminal_notifier_spec.rb
uniform_notifier-1.14.1 spec/uniform_notifier/terminal_notifier_spec.rb
uniform_notifier-1.14.0 spec/uniform_notifier/terminal_notifier_spec.rb
uniform_notifier-1.13.2 spec/uniform_notifier/terminal_notifier_spec.rb
uniform_notifier-1.13.1 spec/uniform_notifier/terminal_notifier_spec.rb