Sha256: b6a07d3d7836ce4543be63f237de3f3a43cb4e98b818b99d2a2cfbbd3a123ab3

Contents?: true

Size: 870 Bytes

Versions: 7135

Compression:

Stored size: 870 Bytes

Contents

# frozen_string_literal: true

# RuboCop can be run in contexts where unexpected other libraries are included,
# which may interfere with its normal behavior. In order to test those
# situations, it may be necessary to require another library for the duration
# of one spec
module HostEnvironmentSimulatorHelper
  def in_its_own_process_with(*files)
    if ::Process.respond_to?(:fork)
      pid = ::Process.fork do
        # Need to write coverage result under different name
        if defined?(SimpleCov)
          SimpleCov.command_name "rspec-fork-#{Process.pid}"
          SimpleCov.pid = Process.pid
        end

        files.each { |file| require file }
        yield
      end
      ::Process.wait(pid)

      # assert that the block did not fail
      expect($CHILD_STATUS).to be_success
    else
      warn 'Process.fork is not available.'
    end
  end
end

Version data entries

7,135 entries across 7,098 versions & 49 rubygems

Version Path
talon_one-2.0.0 vendor/bundle/ruby/2.3.0/gems/rubocop-0.66.0/lib/rubocop/rspec/host_environment_simulation_helper.rb
talon_one-2.0.0 vendor/bundle/ruby/2.7.0/gems/rubocop-0.66.0/lib/rubocop/rspec/host_environment_simulation_helper.rb
rubocop-0.81.0 lib/rubocop/rspec/host_environment_simulation_helper.rb
rubocop-0.80.1 lib/rubocop/rspec/host_environment_simulation_helper.rb
rubocop-0.80.0 lib/rubocop/rspec/host_environment_simulation_helper.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/rubocop-0.79.0/lib/rubocop/rspec/host_environment_simulation_helper.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.79.0/lib/rubocop/rspec/host_environment_simulation_helper.rb
rubocop-0.79.0 lib/rubocop/rspec/host_environment_simulation_helper.rb
rubocop-0.78.0 lib/rubocop/rspec/host_environment_simulation_helper.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rubocop-0.76.0/lib/rubocop/rspec/host_environment_simulation_helper.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rubocop-0.77.0/lib/rubocop/rspec/host_environment_simulation_helper.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rubocop-0.75.1/lib/rubocop/rspec/host_environment_simulation_helper.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rubocop-0.72.0/lib/rubocop/rspec/host_environment_simulation_helper.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rubocop-0.74.0/lib/rubocop/rspec/host_environment_simulation_helper.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/rubocop-0.75.0/lib/rubocop/rspec/host_environment_simulation_helper.rb
rubocop-0.77.0 lib/rubocop/rspec/host_environment_simulation_helper.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/rubocop-0.74.0/lib/rubocop/rspec/host_environment_simulation_helper.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/rubocop-0.72.0/lib/rubocop/rspec/host_environment_simulation_helper.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/rubocop-0.75.0/lib/rubocop/rspec/host_environment_simulation_helper.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/rubocop-0.76.0/lib/rubocop/rspec/host_environment_simulation_helper.rb