Skip to content

Commit

Permalink
Fix setting and restoring RUBYZIP_V3_API_WARN in tests.
Browse files Browse the repository at this point in the history
Make sure that it is reset to its original value so that we can set it
up front for all tests.
  • Loading branch information
hainesr committed Apr 9, 2024
1 parent e05dc9b commit 6ff40f7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,18 @@ module ZipEntryData

module ZipV3Assertions
def assert_v3_api_warning
env_save = ENV['RUBYZIP_V3_API_WARN']
ENV['RUBYZIP_V3_API_WARN'] = '1'
assert_output('', /^You have called/) { yield }
ensure
ENV.delete('RUBYZIP_V3_API_WARN')
ENV['RUBYZIP_V3_API_WARN'] = env_save
end

def refute_v3_api_warning
env_save = ENV['RUBYZIP_V3_API_WARN']
ENV['RUBYZIP_V3_API_WARN'] = '1'
assert_output('', '') { yield }
ensure
ENV.delete('RUBYZIP_V3_API_WARN')
ENV['RUBYZIP_V3_API_WARN'] = env_save
end
end

0 comments on commit 6ff40f7

Please sign in to comment.