module CircleCIReporter::Sandbox

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

`circleci_reporter/sandbox` to load it.

Public Class Methods

sandboxed() { |configuration| ... } click to toggle source

Execute a provided block with CircleCIReporter global objects( configuration, client) reset.

@yield [Configuration] @return [void]

# File lib/circleci_reporter/sandbox.rb, line 19
def self.sandboxed
  orig_config = CircleCIReporter.configuration
  orig_client = CircleCIReporter.client

  CircleCIReporter.configuration = Configuration.new
  CircleCIReporter.client = Client.new

  yield CircleCIReporter.configuration
ensure
  CircleCIReporter.configuration = orig_config
  CircleCIReporter.client = orig_client
end