diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb index 2eb98826aa..671ffe73ce 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb @@ -38,14 +38,16 @@ RSpec.shared_context "integration test" do end end - before(:each) do - (HOMEBREW_PREFIX/"bin").mkpath - FileUtils.touch HOMEBREW_PREFIX/"bin/brew" - end + around(:each) do |example| + begin + (HOMEBREW_PREFIX/"bin").mkpath + FileUtils.touch HOMEBREW_PREFIX/"bin/brew" - after(:each) do - FileUtils.rm HOMEBREW_PREFIX/"bin/brew" - FileUtils.rmdir HOMEBREW_PREFIX/"bin" + example.run + ensure + FileUtils.rm HOMEBREW_PREFIX/"bin/brew" + FileUtils.rmdir HOMEBREW_PREFIX/"bin" + end end # Generate unique ID to be able to