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' require 'test_helper'
describe Cask do describe "Cask" do
describe "load" do describe "load" do
it "returns an instance of the cask with the given name" do it "returns an instance of the cask with the given name" do
c = Cask.load("adium") c = Cask.load("adium")

8
test/cli/install_test.rb

@ -11,12 +11,8 @@ describe Cask::CLI::Install do
end end
it "properly handles casks that are not present" do 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') Cask::CLI::Install.run('what-the-balls')
end }, 'Error: No available cask for what-the-balls')
(out+err).must_equal <<-OUTPUT.gsub(/^ */, '')
Error: No available cask for what-the-balls
OUTPUT
end end
end end

16
test/cli/uninstall_test.rb

@ -2,23 +2,15 @@ require 'test_helper'
describe Cask::CLI::Uninstall do describe Cask::CLI::Uninstall do
it "shows an error when a bad cask is provided" 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') Cask::CLI::Uninstall.run('notacask')
end }, 'Error: No available cask for notacask')
(out+err).must_equal <<-OUTPUT.gsub(/^ */, '')
Error: No available cask for notacask
OUTPUT
end end
it "shows an error when a cask is provided that's not installed" do 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') Cask::CLI::Uninstall.run('anvil')
end }, 'Error: anvil is not installed')
(out+err).must_equal <<-OUTPUT.gsub(/^ */, '')
Error: anvil is not installed
OUTPUT
end end
it "can uninstall multiple casks at once" do 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) def self.fake_response_for(*args)
Cask::FakeFetcher.fake_response_for(*args) Cask::FakeFetcher.fake_response_for(*args)
end 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 end
require 'support/fake_fetcher' require 'support/fake_fetcher'

Loading…
Cancel
Save