# frozen_string_literal: true RSpec.configure do |config| config.around(:each, :singletons => lambda { |v| !!v }) do |example| require 'singleton' options = example.metadata[:singletons] options = options.is_a?(TrueClass) ? described_class : options singletons_to_reset = Array(options) singletons_to_reset.each do |singleton| Singleton.__init__(singleton) end example.run singletons_to_reset.each do |singleton| Singleton.__init__(singleton) end end end