diff options
| author | Markus Reiter | 2017-03-05 03:46:48 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-03-05 04:38:30 +0100 |
| commit | e0e0233b2df895f8d915f7766639f8fb62d03ee4 (patch) | |
| tree | d198f1fbdbcbdc359ec45c8aa3341b3ddda04798 /Library | |
| parent | b7135eec493c1b2cad69b934bbf0d1aefbcbf8ab (diff) | |
| download | brew-e0e0233b2df895f8d915f7766639f8fb62d03ee4.tar.bz2 | |
Remove temporary files in `uninstall` and `zap` specs.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb | 39 | ||||
| -rw-r--r-- | Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb | 39 |
2 files changed, 52 insertions, 26 deletions
diff --git a/Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb b/Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb index e3595621d..4c09ea302 100644 --- a/Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb +++ b/Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb @@ -7,19 +7,32 @@ describe Hbc::Artifact::Uninstall do Hbc::Artifact::Uninstall.new(cask, command: Hbc::FakeSystemCommand) } - let(:absolute_path) { Pathname.new("#{TEST_TMPDIR}/absolute_path") } - let(:path_with_tilde) { Pathname.new("#{TEST_TMPDIR}/path_with_tilde") } - let(:glob_path1) { Pathname.new("#{TEST_TMPDIR}/glob_path1") } - let(:glob_path2) { Pathname.new("#{TEST_TMPDIR}/glob_path2") } - - before(:each) do - FileUtils.touch(absolute_path) - FileUtils.touch(path_with_tilde) - FileUtils.touch(glob_path1) - FileUtils.touch(glob_path2) - ENV["HOME"] = TEST_TMPDIR - shutup do - InstallHelper.install_without_artifacts(cask) + let(:dir) { TEST_TMPDIR } + let(:absolute_path) { Pathname.new("#{dir}/absolute_path") } + let(:path_with_tilde) { Pathname.new("#{dir}/path_with_tilde") } + let(:glob_path1) { Pathname.new("#{dir}/glob_path1") } + let(:glob_path2) { Pathname.new("#{dir}/glob_path2") } + + around(:each) do |example| + begin + ENV["HOME"] = dir + + paths = [ + absolute_path, + path_with_tilde, + glob_path1, + glob_path2, + ] + + FileUtils.touch paths + + shutup do + InstallHelper.install_without_artifacts(cask) + end + + example.run + ensure + FileUtils.rm_f paths end end diff --git a/Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb b/Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb index c49cebbb8..47090c99a 100644 --- a/Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb +++ b/Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb @@ -8,19 +8,32 @@ describe Hbc::Artifact::Zap do Hbc::Artifact::Zap.new(cask, command: Hbc::FakeSystemCommand) } - let(:absolute_path) { Pathname.new("#{TEST_TMPDIR}/absolute_path") } - let(:path_with_tilde) { Pathname.new("#{TEST_TMPDIR}/path_with_tilde") } - let(:glob_path1) { Pathname.new("#{TEST_TMPDIR}/glob_path1") } - let(:glob_path2) { Pathname.new("#{TEST_TMPDIR}/glob_path2") } - - before(:each) do - FileUtils.touch(absolute_path) - FileUtils.touch(path_with_tilde) - FileUtils.touch(glob_path1) - FileUtils.touch(glob_path2) - ENV["HOME"] = TEST_TMPDIR - shutup do - InstallHelper.install_without_artifacts(cask) + let(:dir) { TEST_TMPDIR } + let(:absolute_path) { Pathname.new("#{dir}/absolute_path") } + let(:path_with_tilde) { Pathname.new("#{dir}/path_with_tilde") } + let(:glob_path1) { Pathname.new("#{dir}/glob_path1") } + let(:glob_path2) { Pathname.new("#{dir}/glob_path2") } + + around(:each) do |example| + begin + ENV["HOME"] = dir + + paths = [ + absolute_path, + path_with_tilde, + glob_path1, + glob_path2, + ] + + FileUtils.touch paths + + shutup do + InstallHelper.install_without_artifacts(cask) + end + + example.run + ensure + FileUtils.rm_f paths end end |
