1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00
mperham--sidekiq/test/helper.rb

40 lines
724 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'bundler/setup'
Bundler.require(:default, :test)
2019-09-10 18:22:30 -04:00
require 'minitest/pride'
require 'minitest/autorun'
$TESTING = true
# disable minitest/parallel threads
ENV["N"] = "0"
if ENV["COVERAGE"]
2012-01-24 01:07:21 -05:00
require 'simplecov'
2013-04-12 16:57:24 -04:00
SimpleCov.start do
2020-01-31 13:19:20 -05:00
enable_coverage :branch
2013-04-12 16:57:24 -04:00
add_filter "/test/"
add_filter "/myapp/"
2013-04-12 16:57:24 -04:00
end
2012-01-24 01:07:21 -05:00
end
ENV['REDIS_URL'] ||= 'redis://localhost/15'
Sidekiq.logger = ::Logger.new(STDOUT)
Sidekiq.logger.level = Logger::ERROR
def capture_logging(lvl=Logger::INFO)
old = Sidekiq.logger
begin
out = StringIO.new
logger = ::Logger.new(out)
logger.level = lvl
Sidekiq.logger = logger
yield
out.string
ensure
Sidekiq.logger = old
end
end