1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
# frozen_string_literal: true
require_relative "support/coverage"
require "pathname"
require "fileutils"
require "securerandom"
begin
require "byebug"
rescue LoadError
end
SPEC_ROOT = Pathname(__FILE__).dirname
RELATIVE_TMP = File.join(".", "tmp")
FileUtils.mkdir_p(RELATIVE_TMP)
TMP = SPEC_ROOT.join("..", RELATIVE_TMP).realpath
require_relative "support/rspec"
require "dry/logger"
Dir.glob(Pathname.new(__dir__).join("support", "**", "*.rb")).sort.each do |file|
require_relative file
end
Dir.glob(Pathname.new(__dir__).join("shared", "**", "*.rb")).sort.each do |file|
require_relative file
end
RSpec.configure do |config|
global_registries = %i[formatters templates].to_h { |reg| [reg, Dry::Logger.__send__(reg)] }
config.around do |example|
example.run
ensure
global_registries.each do |reg, val|
Dry::Logger.instance_variable_set("@#{reg}", val)
end
end
config.after do
Dry::Logger::ExecutionContext.clear
end
end
|