Sha256: bfd31145bfd72164c4737ceedd0fbcb8d09cfff654827966b733144d7d7a4551

Contents?: true

Size: 1.08 KB

Versions: 9

Compression:

Stored size: 1.08 KB

Contents

require 'rubygems'
require 'bundler/setup'
require 'simplecov' if ENV['COVERAGE'] == '1'

require 'minitest/autorun'
require 'minitest/libnotify'

require 'libnotify'

module LibnotifyAssertions
  def assert_timeout(expected, value, message)
    assert_value_set :timeout, expected, value, message
  end

  def assert_icon_path(expected, value, message)
    assert_value_set :icon_path, expected, value, message
  end

  def assert_value_set(attribute, expected, value, message)
    libnotify.send("#{attribute}=", value)
    got = libnotify.send(attribute)
    case expected
    when Regexp
      assert_match expected, got, message
    else
      assert_equal expected, got, message
    end
  end

  def fixture_file(path)
    File.expand_path(File.join(File.dirname(__FILE__), "fixtures", path))
  end
end

class LibnotifyTestCase < MiniTest::Spec
  include LibnotifyAssertions

  class << self
    alias :test :it
    alias :context :describe
    alias :setup :before
    alias :teardown :after
  end

  def libnotify(options={}, &block)
    @libnotify ||= Libnotify::API.new(options, &block)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
libnotify-0.9.4 test/helper.rb
libnotify-0.9.3 test/helper.rb
libnotify-0.9.2 test/helper.rb
libnotify-0.9.1 test/helper.rb
libnotify-0.9.0 test/helper.rb
libnotify-0.8.4 test/helper.rb
libnotify-0.8.3 test/helper.rb
libnotify-0.8.2 test/helper.rb
libnotify-0.8.1 test/helper.rb