Browse Source

build fixes

phinze 12 years ago
parent
commit
7bc2db2979
  1. 2
      test/cask_test.rb
  2. 8
      test/cli/install_test.rb
  3. 16
      test/cli/uninstall_test.rb
  4. 8
      test/test_helper.rb

2
test/cask_test.rb

@ -1,6 +1,6 @@
require 'test_helper'
describe Cask do
describe "Cask" do
describe "load" do
it "returns an instance of the cask with the given name" do
c = Cask.load("adium")

8
test/cli/install_test.rb

@ -11,12 +11,8 @@ describe Cask::CLI::Install do
end
it "properly handles casks that are not present" do
out, err = capture_subprocess_io do
TestHelper.must_output(self, lambda {
Cask::CLI::Install.run('what-the-balls')
end
(out+err).must_equal <<-OUTPUT.gsub(/^ */, '')
Error: No available cask for what-the-balls
OUTPUT
}, 'Error: No available cask for what-the-balls')
end
end

16
test/cli/uninstall_test.rb

@ -2,23 +2,15 @@ require 'test_helper'
describe Cask::CLI::Uninstall do
it "shows an error when a bad cask is provided" do
out, err = capture_subprocess_io do
TestHelper.must_output(self, lambda {
Cask::CLI::Uninstall.run('notacask')
end
(out+err).must_equal <<-OUTPUT.gsub(/^ */, '')
Error: No available cask for notacask
OUTPUT
}, 'Error: No available cask for notacask')
end
it "shows an error when a cask is provided that's not installed" do
out, err = capture_subprocess_io do
TestHelper.must_output(self, lambda {
Cask::CLI::Uninstall.run('anvil')
end
(out+err).must_equal <<-OUTPUT.gsub(/^ */, '')
Error: anvil is not installed
OUTPUT
}, 'Error: anvil is not installed')
end
it "can uninstall multiple casks at once" do

8
test/test_helper.rb

@ -46,6 +46,14 @@ class TestHelper
def self.fake_response_for(*args)
Cask::FakeFetcher.fake_response_for(*args)
end
def self.must_output(test, lambda, expected)
out, err = test.capture_subprocess_io do
lambda.call
end
(out+err).chomp.must_equal expected.gsub(/^ */, '')
end
end
require 'support/fake_fetcher'

Loading…
Cancel
Save