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
Andrew Babichev ea9b34a953 Add CLI Run Test - Write Pid, System Boot, Print Banner (#4039)
* Add appraisal

* Test CLI run (write pid, system boot, print banner)

* Cleanup test helper

* Set REDIS_URL to use non-default host in test env

* Move mintiest-focus to test bundle group
2018-12-07 08:59:42 -08:00

49 lines
892 B
Ruby

# frozen_string_literal: true
require 'bundler/setup'
Bundler.require(:default, :test)
require 'minitest/reporters'
require 'minitest/autorun'
MiniTest::Reporters.use! Minitest::Reporters::DefaultReporter.new
$TESTING = true
# disable minitest/parallel threads
ENV["N"] = "0"
if ENV["COVERAGE"]
require 'simplecov'
SimpleCov.start do
add_filter "/test/"
add_filter "/myapp/"
end
end
ENV['REDIS_URL'] ||= 'redis://localhost/15'
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
def with_logging(lvl=Logger::DEBUG)
old = Sidekiq.logger.level
begin
Sidekiq.logger.level = lvl
yield
ensure
Sidekiq.logger.level = old
end
end