lib/rspeckled/plugins/hooks/singletons.rb in rspeckled-2.0.1 vs lib/rspeckled/plugins/hooks/singletons.rb in rspeckled-2.1.0
- old
+ new
@@ -1,12 +1,12 @@
# frozen_string_literal: true
RSpec.configure do |config|
- config.around(:each, :singletons => lambda { |v| !!v }) do |example|
+ config.around(:each, singletons: ->(v) { !v.nil? }) do |example|
config.rspeckled_logger.debug("Around Each - Start - #{__FILE__}")
options = example.metadata[:singletons]
- options = options.is_a?(::TrueClass) ? described_class : options
+ options = described_class if options.is_a?(::TrueClass)
singletons_to_reset = Array(options)
singletons_to_reset.each do |singleton|
::Singleton.__init__(singleton)
end