From 97b715b27de1b45849807ef63d0ebeffdc29ba03 Mon Sep 17 00:00:00 2001 From: phinze Date: Sun, 25 Nov 2012 15:32:21 -0600 Subject: [PATCH] demockify actions_tests --- lib/cask/actions.rb | 6 +++--- test/cask/actions_test.rb | 10 ++-------- test/support/fake_appdir.rb | 4 ++-- test/test_helper.rb | 4 ---- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/lib/cask/actions.rb b/lib/cask/actions.rb index 9d1be8213..1de53bad8 100644 --- a/lib/cask/actions.rb +++ b/lib/cask/actions.rb @@ -5,13 +5,13 @@ module Cask::Actions target = destination_path.join(app) if destination.symlink? # destination exists but is symlink; removing and relinking - puts "[#{self}] linking #{File.basename(destination)}" + ohai "[#{self}] linking #{File.basename(destination)}" destination.delete destination.make_symlink(target) elsif destination.directory? || destination.file? - puts "[#{self}] NOT linking #{File.basename(destination)} - already exists" + ohai "[#{self}] NOT linking #{File.basename(destination)} - already exists" else - puts "[#{self}] linking #{File.basename(destination)}" + ohai "[#{self}] linking #{File.basename(destination)}" destination.make_symlink(target) end end diff --git a/test/cask/actions_test.rb b/test/cask/actions_test.rb index eb30d36ea..3c4a84996 100644 --- a/test/cask/actions_test.rb +++ b/test/cask/actions_test.rb @@ -1,17 +1,11 @@ require 'test_helper' -require 'cmd/uninstall' describe Cask::Actions do describe 'linkapps' do before do - fake_appdir = HOMEBREW_PREFIX/"Applications" - fake_appdir.mkpath - Cask.stubs(:appdir).returns(fake_appdir) - @caffeine = Cask.load('local-caffeine') shutup { Cask::Installer.install(@caffeine) } - @appdir = HOMEBREW_CELLAR/'local-caffeine'/@caffeine.version - @app = @appdir/'Caffeine.app' + @app = @caffeine.destination_path/'Caffeine.app' end after do @@ -30,7 +24,7 @@ describe Cask::Actions do end it "works with an application in a subdir" do - appsubdir = @appdir/'subdir' + appsubdir = @caffeine.destination_path/'subdir' appsubdir.mkpath FileUtils.mv @app, appsubdir appinsubdir = appsubdir/'Caffeine.app' diff --git a/test/support/fake_appdir.rb b/test/support/fake_appdir.rb index 59cfd7b3a..46001dca6 100644 --- a/test/support/fake_appdir.rb +++ b/test/support/fake_appdir.rb @@ -10,10 +10,10 @@ module FakeAppdirHooks def after_teardown super - CANNED_APPDIR.rm_rf + FileUtils.rm_rf(CANNED_APPDIR) end end class MiniTest::Spec - include FakeFetcherHooks + include FakeAppdirHooks end diff --git a/test/test_helper.rb b/test/test_helper.rb index 9b576bdea..10e686c82 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -52,10 +52,6 @@ end require 'support/fake_fetcher' require 'support/fake_appdir' -# wire in a fake linkapps destination -canned_appdir = (HOMEBREW_REPOSITORY/"Applications").tap(&:mkdir) -Cask.set_appdir(canned_appdir) - # pretend like we installed the cask tap project_root = Pathname.new(File.expand_path("#{File.dirname(__FILE__)}/../")) taps_dest = HOMEBREW_LIBRARY/"Taps"