Sha256: b8a22e3a11311739a8e80edc7dd28c7076e1a125ea7c5aefe574c1eaaff3f0a0

Contents?: true

Size: 999 Bytes

Versions: 3

Compression:

Stored size: 999 Bytes

Contents

require "notifier"

module TestNotifier
  class << self
    attr_accessor :default_notifier
  end

  extend self

  NO_NOTIFIERS_MESSAGE = "[TEST NOTIFIER] You have no supported notifiers installed. Please read documentation."

  IMAGES = {
    :fail    => File.dirname(__FILE__) + "/../resources/fail.png",
    :error   => File.dirname(__FILE__) + "/../resources/error.png",
    :success => File.dirname(__FILE__) + "/../resources/success.png"
  }

  TITLES = {
    :fail    => "Failed!",
    :success => "Passed!",
    :error   => "Error!"
  }

  def notify(options)
    options.merge!({
      :title => TITLES[options[:status]],
      :image => IMAGES[options[:status]]
    })

    notifier.notify(options)
  end

  def notifier
    Notifier.default_notifier = default_notifier
    notifier = Notifier.notifier
    STDERR << NO_NOTIFIERS_MESSAGE if notifier == Notifier::Placebo
    notifier
  end

  autoload :Runner,     "test_notifier/runner"
  autoload :Stats,      "test_notifier/stats"
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
test_notifier-0.3.5 lib/test_notifier.rb
test_notifier-0.3.5.rc.4 lib/test_notifier.rb
test_notifier-0.3.5.rc.3 lib/test_notifier.rb