Module: CircleCI::CoverageReporter::Sandbox

Defined in:
lib/circleci/coverage_reporter/sandbox.rb

Overview

Note:

This module is not normally available. You must require circleci/coverage_reporter/sandbox to load it.

A sandbox isolates the enclosed code into an environment that looks 'new' meaning globally accessed objects are reset for the duration of the sandbox.

Class Method Summary collapse

Class Method Details

.sandboxed {|Configuration| ... } ⇒ void

This method returns an undefined value.

Execute a provided block with CircleCI::CoverageReporter global objects( configuration, client) reset.

Yields:



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/circleci/coverage_reporter/sandbox.rb', line 18

def self.sandboxed
  orig_config = CoverageReporter.configuration
  orig_client = CoverageReporter.client

  CoverageReporter.configuration = Configuration.new
  CoverageReporter.client = Client.new

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