Sha256: 662c8f210fb9a97a9f880a509a71045be64bfda69ca5e7c7476987d10becc852

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require "test_helper"

class TestNotifierTest < Test::Unit::TestCase
  def setup
    unsupport_all_notifiers
  end

  test "use default notifier" do
    Notifier::Growl.stubs(:supported?).returns(true)
    Notifier::Snarl.stubs(:supported?).returns(true)
    TestNotifier.default_notifier = :snarl

    assert_equal Notifier::Snarl, TestNotifier.notifier
  end

  test "output error message to $stderr when there's no supported notifier" do
    STDERR.expects(:<<).with(TestNotifier::NO_NOTIFIERS_MESSAGE).once
    Notifier::Placebo.expects(:supported?).returns(true)
    Notifier::Placebo.expects(:notify).once
    TestNotifier.notify :status => :fail, :message => "You have failed!"
  end

  test "send notification to supported notifier" do
    Notifier::Snarl.expects(:supported?).returns(true)
    Notifier::Snarl.expects(:notify).with({
      :status  => :fail,
      :message => "You have failed!",
      :title   => TestNotifier::TITLES[:fail],
      :image   => TestNotifier::IMAGES[:fail],
      :color   => TestNotifier::COLORS[:fail]
    })

    TestNotifier.notify :status => :fail, :message => "You have failed!"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
test_notifier-0.4.0 test/test_notifier_test.rb
test_notifier-0.3.6 test/test_notifier_test.rb