From 83c1b399468ddbe51b9c1b2decd09a4a6bb0342a Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Mon, 27 Feb 2017 16:34:26 +0100 Subject: Use `around` hook for shared "integration test" context. --- .../helper/spec/shared_context/integration_test.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'Library') 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 2eb98826a..671ffe73c 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 - - after(:each) do - FileUtils.rm HOMEBREW_PREFIX/"bin/brew" - FileUtils.rmdir HOMEBREW_PREFIX/"bin" + around(:each) do |example| + begin + (HOMEBREW_PREFIX/"bin").mkpath + FileUtils.touch HOMEBREW_PREFIX/"bin/brew" + + example.run + ensure + FileUtils.rm HOMEBREW_PREFIX/"bin/brew" + FileUtils.rmdir HOMEBREW_PREFIX/"bin" + end end # Generate unique ID to be able to -- cgit v1.2.3