Sha256: 4031b53d10c2de49e502e5e493b400f1fd56533ff2c7af43641e86d870b0c3c3

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 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]
    })

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
test_notifier-0.3.5 test/test_notifier_test.rb
test_notifier-0.3.5.rc.4 test/test_notifier_test.rb
test_notifier-0.3.5.rc.3 test/test_notifier_test.rb