diff options
| author | Markus Reiter | 2017-02-20 14:52:12 +0100 |
|---|---|---|
| committer | GitHub | 2017-02-20 14:52:12 +0100 |
| commit | afb66d0c69bb7cf691125d082d9e45724d479723 (patch) | |
| tree | c42231b59b8aa43c0d4afb98adb1ab4faef63a13 /Library/Homebrew/cask/spec | |
| parent | e097d77577243ab593c0e7fee9c8d54e5a3980d7 (diff) | |
| parent | 92fe130cbb1faef375c6cb86bae02551882fd72d (diff) | |
| download | brew-afb66d0c69bb7cf691125d082d9e45724d479723.tar.bz2 | |
Merge pull request #2042 from mxl/expand-glob
Expand glob patterns.
Diffstat (limited to 'Library/Homebrew/cask/spec')
| -rw-r--r-- | Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb | 36 | ||||
| -rw-r--r-- | Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb | 36 |
2 files changed, 58 insertions, 14 deletions
diff --git a/Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb b/Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb index a38ed903e..e3595621d 100644 --- a/Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb +++ b/Library/Homebrew/cask/spec/cask/artifact/uninstall_spec.rb @@ -7,7 +7,17 @@ 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) end @@ -233,8 +243,10 @@ describe Hbc::Artifact::Uninstall do it "can uninstall" do Hbc::FakeSystemCommand.expects_command( sudo(%w[/bin/rm -rf --], - Pathname.new("/permissible/absolute/path"), - Pathname.new("~/permissible/path/with/tilde").expand_path), + absolute_path, + path_with_tilde, + glob_path1, + glob_path2), ) subject @@ -247,8 +259,10 @@ describe Hbc::Artifact::Uninstall do it "can uninstall" do Hbc::FakeSystemCommand.expects_command( sudo(%w[/bin/rm -rf --], - Pathname.new("/permissible/absolute/path"), - Pathname.new("~/permissible/path/with/tilde").expand_path), + absolute_path, + path_with_tilde, + glob_path1, + glob_path2), ) subject @@ -257,15 +271,23 @@ describe Hbc::Artifact::Uninstall do context "when using rmdir" do let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-rmdir.rb") } - let(:dir_pathname) { Pathname.new("#{TEST_FIXTURE_DIR}/cask/empty_directory") } + let(:empty_directory_path) { Pathname.new("#{TEST_TMPDIR}/empty_directory_path") } + + before(:each) do + empty_directory_path.mkdir + end + + after(:each) do + empty_directory_path.rmdir + end it "can uninstall" do Hbc::FakeSystemCommand.expects_command( - sudo(%w[/bin/rm -f --], dir_pathname.join(".DS_Store")), + sudo(%w[/bin/rm -f --], empty_directory_path/".DS_Store"), ) Hbc::FakeSystemCommand.expects_command( - sudo(%w[/bin/rmdir --], dir_pathname), + sudo(%w[/bin/rmdir --], empty_directory_path), ) subject diff --git a/Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb b/Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb index 50e132bfa..c49cebbb8 100644 --- a/Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb +++ b/Library/Homebrew/cask/spec/cask/artifact/zap_spec.rb @@ -8,7 +8,17 @@ 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) end @@ -234,8 +244,10 @@ describe Hbc::Artifact::Zap do it "can zap" do Hbc::FakeSystemCommand.expects_command( sudo(%w[/bin/rm -rf --], - Pathname.new("/permissible/absolute/path"), - Pathname.new("~/permissible/path/with/tilde").expand_path), + absolute_path, + path_with_tilde, + glob_path1, + glob_path2), ) subject @@ -248,8 +260,10 @@ describe Hbc::Artifact::Zap do it "can zap" do Hbc::FakeSystemCommand.expects_command( sudo(%w[/bin/rm -rf --], - Pathname.new("/permissible/absolute/path"), - Pathname.new("~/permissible/path/with/tilde").expand_path), + absolute_path, + path_with_tilde, + glob_path1, + glob_path2), ) subject @@ -258,15 +272,23 @@ describe Hbc::Artifact::Zap do context "when using rmdir" do let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-zap-rmdir.rb") } - let(:dir_pathname) { Pathname.new("#{TEST_FIXTURE_DIR}/cask/empty_directory") } + let(:empty_directory_path) { Pathname.new("#{TEST_TMPDIR}/empty_directory_path") } + + before(:each) do + empty_directory_path.mkdir + end + + after(:each) do + empty_directory_path.rmdir + end it "can zap" do Hbc::FakeSystemCommand.expects_command( - sudo(%w[/bin/rm -f --], dir_pathname.join(".DS_Store")), + sudo(%w[/bin/rm -f --], empty_directory_path/".DS_Store"), ) Hbc::FakeSystemCommand.expects_command( - sudo(%w[/bin/rmdir --], dir_pathname), + sudo(%w[/bin/rmdir --], empty_directory_path), ) subject |
