Sha256: 064b8c2551cb561ad6b99f1509239db7baa4910c842c9fc7bccaf952ec201d97

Contents?: true

Size: 1.23 KB

Versions: 7066

Compression:

Stored size: 1.23 KB

Contents

module RSpec
  module Core
    # A sandbox isolates the enclosed code into an environment that looks 'new'
    # meaning globally accessed objects are reset for the duration of the
    # sandbox.
    #
    # @note This module is not normally available. You must require
    #   `rspec/core/sandbox` to load it.
    module Sandbox
      # Execute a provided block with RSpec global objects (configuration,
      # world) reset.  This is used to test RSpec with RSpec.
      #
      # When calling this the configuration is passed into the provided block.
      # Use this to set custom configs for your sandboxed examples.
      #
      # ```
      # Sandbox.sandboxed do |config|
      #   config.before(:context) { RSpec.current_example = nil }
      # end
      # ```
      def self.sandboxed
        orig_config  = RSpec.configuration
        orig_world   = RSpec.world
        orig_example = RSpec.current_example

        RSpec.configuration = RSpec::Core::Configuration.new
        RSpec.world         = RSpec::Core::World.new(RSpec.configuration)

        yield RSpec.configuration
      ensure
        RSpec.configuration   = orig_config
        RSpec.world           = orig_world
        RSpec.current_example = orig_example
      end
    end
  end
end

Version data entries

7,066 entries across 6,984 versions & 126 rubygems

Version Path
affixapi-1.1.102 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.0/lib/rspec/core/sandbox.rb
mux_ruby-3.20.0 vendor/bundle/ruby/3.2.0/gems/rspec-core-3.11.0/lib/rspec/core/sandbox.rb
cybrid_api_bank_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_organization_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_id_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_bank_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_organization_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_id_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_id_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_bank_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_organization_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_organization_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_id_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_bank_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
ory-client-1.15.12 vendor/bundle/ruby/3.1.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_bank_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_id_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_organization_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_bank_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb
cybrid_api_organization_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-core-3.13.2/lib/rspec/core/sandbox.rb