Sha256: 0b5c28fdb6f880f55f2aa4f07cb55cba9947a9c36eed7aad16d3923e5d240f2c
Contents?: true
Size: 742 Bytes
Versions: 62
Compression:
Stored size: 742 Bytes
Contents
############################################################################## # Singleton Plugin ############################################################################## RSpec.configure do |config| config.around(:each, :singletons => lambda { |v| !!v }) do |example| require 'singleton' options = example.metadata[:singletons] options = options.is_a?(TrueClass) ? subject.class : options singletons_to_reset = options.respond_to?(:each) ? options : [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
Version data entries
62 entries across 62 versions & 1 rubygems