From 83c1b399468ddbe51b9c1b2decd09a4a6bb0342a Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 27 Feb 2017 16:34:26 +0100 Subject: [PATCH] Use `around` hook for shared "integration test" context. --- .../spec/shared_context/integration_test.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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