Skip to content

Commit

Permalink
Use let syntax. (Homebrew#23328)
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus authored and Jonathan Dahan committed Sep 24, 2016
1 parent ddd3999 commit 0e96057
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions test/cask/cli/uninstall_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,20 @@
end

describe "when Casks in Taps have been renamed or removed" do
let(:app) { Hbc.appdir.join("ive-been-renamed.app") }
let(:caskroom_path) { Hbc.caskroom.join("ive-been-renamed").tap(&:mkpath) }
let(:saved_caskfile) { caskroom_path.join(".metadata", "latest", "timestamp", "Casks").join("ive-been-renamed.rb") }

before do
@app = Hbc.appdir.join("ive-been-renamed.app").tap(&:mkpath)
@app.join("Contents").tap(&:mkpath)
.join("Info.plist").tap(&FileUtils.method(:touch))
app.tap(&:mkpath)
.join("Contents").tap(&:mkpath)
.join("Info.plist").tap(&FileUtils.method(:touch))

@caskroom_path = Hbc.caskroom.join("ive-been-renamed").tap(&:mkpath)
caskroom_path.mkpath

@saved_caskfile = @caskroom_path.join(".metadata", "latest", "timestamp", "Casks").tap(&:mkpath)
.join("ive-been-renamed.rb")
saved_caskfile.dirname.mkpath

IO.write @saved_caskfile, <<-EOF.undent
IO.write saved_caskfile, <<-EOF.undent
cask 'ive-been-renamed' do
version :latest
Expand All @@ -119,17 +122,17 @@
end

after do
@app.rmtree if @app.exist?
@caskroom_path.rmtree if @caskroom_path.exist?
app.rmtree if app.exist?
caskroom_path.rmtree if caskroom_path.exist?
end

it "can still uninstall those Casks" do
shutup do
Hbc::CLI::Uninstall.run("ive-been-renamed")
end

@app.wont_be :exist?
@caskroom_path.wont_be :exist?
app.wont_be :exist?
caskroom_path.wont_be :exist?
end
end

Expand Down

0 comments on commit 0e96057

Please sign in to comment.