Sha256: a8d743e05ea89467dbaee56298e76f29fbff47a31458301f8f86f870b00ee79f

Contents?: true

Size: 690 Bytes

Versions: 2

Compression:

Stored size: 690 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'
require 'eac_config/envvars_node'

module EacConfig
  module Rspec
    module Setup
      def self.extended(obj)
        obj.rspec_config.around do |example|
          obj.on_envvars_load_path_clean(example)
        end
      end

      def on_envvars_load_path_clean(example)
        old_value = envvars_load_path_entry.value
        begin
          envvars_load_path_entry.value = old_value = []
          example.run
        ensure
          envvars_load_path_entry.value = old_value
        end
      end

      def envvars_load_path_entry
        ::EacConfig::EnvvarsNode.new.load_path.entry
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
eac_config-0.5.3 lib/eac_config/rspec/setup.rb
avm-tools-0.113.2 sub/eac_config/lib/eac_config/rspec/setup.rb