Sha256: 87f025ab8066b67c8018e5c39124bb1209d6738a7662cbbe690510a2b721a334

Contents?: true

Size: 741 Bytes

Versions: 24

Compression:

Stored size: 741 Bytes

Contents

# frozen_string_literal: true

##############################################################################
#                            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) ? 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

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
rspeckled-0.0.54 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.53 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.52 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.51 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.50 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.49 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.48 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.47 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.46 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.45 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.44 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.43 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.42 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.41 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.40 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.39 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.38 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.37 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.36 lib/rspeckled/plugins/singleton.rb
rspeckled-0.0.35 lib/rspeckled/plugins/singleton.rb