Sha256: 1e15f9a067667c2f820cf3339a45037ffeea6668e54de99a27b569fbee76aff3

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require "test_helper"

class TestNotifier::NotifierTest < Test::Unit::TestCase
  def setup
    unsupport_all_notifiers
  end

  test "retrieve list of supported notifiers" do
    TestNotifier::Notifier::Snarl.expects(:supported?).returns(true)
    TestNotifier::Notifier::Knotify.expects(:supported?).returns(true)

    assert_equal 2, TestNotifier::Notifier.supported_notifiers.size
  end

  test "retrieve list of all notifiers" do
    assert_equal 7, TestNotifier::Notifier.notifiers.size
  end

  test "return notifier by its name" do
    assert_equal TestNotifier::Notifier::OsdCat, TestNotifier::Notifier.from_name(:osd_cat)
    assert_equal TestNotifier::Notifier::NotifySend, TestNotifier::Notifier.from_name(:notify_send)
    assert_equal TestNotifier::Notifier::Growl, TestNotifier::Notifier.from_name(:growl)
  end

  test "return notifier by its name when supported" do
    TestNotifier::Notifier::Snarl.expects(:supported?).returns(true)

    assert_equal TestNotifier::Notifier::Snarl, TestNotifier::Notifier.supported_notifier_from_name(:snarl)
  end

  test "return nil when have supported notifiers" do
    assert_nil TestNotifier::Notifier.supported_notifier_from_name(:snarl)
  end

  test "return nil when an invalid notifier name is provided" do
    assert_nil TestNotifier::Notifier.from_name(:invalid)
    assert_nil TestNotifier::Notifier.supported_notifier_from_name(:invalid)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
test_notifier-0.3.5.rc.1 test/notifier_test.rb