Sha256: 52ffd8802def5cae46219e0d64e658e597a8ad0d8abe94c7c6a8978489c093f5
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
require 'minitest/unit' require 'minitest/autorun' $:<< File.dirname(__FILE__) + "/../lib" require 'localjob' require "mocha/setup" require 'jobs' class LocaljobTestCase < MiniTest::Unit::TestCase protected # This is a method to make sure the logger is set right. def worker(queues = ["/localjob-test"]) Localjob::Worker.new(queues, logger: logger) end # This is a method to make sure all queues are registred and destroyed after # each teach run. def queue(name = "/localjob-test") @queues ||= [] queue = Localjob.new(name) @queues << queue queue end def teardown clear_queue end def logger return @logger if @logger output_file = ENV["DEBUG"] ? STDOUT : "/dev/null" @logger = Logger.new(output_file) end def clear_queue @queues.each(&:destroy) if @queues # This forces the GC to garbage collect, and thus close file descriptioners # in POSIX::Mqueue. Otherwise we'll get flooded with warnings. This is to # ensure a clean state everytime with a new message queue for each test. # It's slower. But safe. GC.start end def self.on_platform(platform) if RUBY_PLATFORM =~ /#{platform}/ yield end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
localjob-0.1.1 | test/test_helper.rb |
localjob-0.1.0 | test/test_helper.rb |
localjob-0.0.2 | test/test_helper.rb |