aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/helper/env.rb
blob: 904a1d4c7123950b472e60908c13a1419beb78bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Test
  module Helper
    module Env
      def with_environment(partial_env)
        old = ENV.to_hash
        ENV.update partial_env
        begin
          yield
        ensure
          ENV.replace old
        end
      end
    end
  end
end