Browse Source
Just getting started of course, but this piggy backs on Homebrew's testing strategy to give us a platform for a fully featured test suite. Neato! And the tests provide value right away, as I added some better error handling to `Cask.load`. Big things ahead. Just you wait.
7 changed files with 79 additions and 1 deletions
@ -0,0 +1,5 @@ |
|||||
|
source :rubygems |
||||
|
|
||||
|
group :test do |
||||
|
gem 'purdytest' |
||||
|
end |
@ -0,0 +1,12 @@ |
|||||
|
GEM |
||||
|
remote: http://rubygems.org/ |
||||
|
specs: |
||||
|
minitest (2.12.1) |
||||
|
purdytest (1.0.0) |
||||
|
minitest (~> 2.2) |
||||
|
|
||||
|
PLATFORMS |
||||
|
ruby |
||||
|
|
||||
|
DEPENDENCIES |
||||
|
purdytest |
@ -0,0 +1,7 @@ |
|||||
|
require 'rake/testtask' |
||||
|
|
||||
|
Rake::TestTask.new do |t| |
||||
|
t.pattern = "spec/*_test.rb" |
||||
|
end |
||||
|
|
||||
|
task :default => :test |
@ -0,0 +1,17 @@ |
|||||
|
require_relative 'spec_helper' |
||||
|
|
||||
|
describe Cask do |
||||
|
describe "load" do |
||||
|
it "returns an instance of the cask with the given name" do |
||||
|
c = Cask.load("adium") |
||||
|
c.must_be_kind_of(Cask) |
||||
|
c.must_be_instance_of(Adium) |
||||
|
end |
||||
|
|
||||
|
it "raises an error when attempting to load a cask that doesn't exist" do |
||||
|
lambda { |
||||
|
Cask.load("notacask") |
||||
|
}.must_raise(CaskUnavailableError) |
||||
|
end |
||||
|
end |
||||
|
end |
@ -0,0 +1,34 @@ |
|||||
|
require 'bundler/setup' |
||||
|
require 'pp' |
||||
|
|
||||
|
# add cask lib to load path |
||||
|
brew_cask_path = Pathname.new(File.expand_path(__FILE__+'/../../')) |
||||
|
casks_path = brew_cask_path.join('casks') |
||||
|
lib_path = brew_cask_path.join('lib') |
||||
|
|
||||
|
$:.push(lib_path) |
||||
|
|
||||
|
# add vendored homebrew to load path |
||||
|
homebrew_path = brew_cask_path.join('spec', 'support', 'homebrew') |
||||
|
$:.push(homebrew_path.join('Library', 'Homebrew')) |
||||
|
|
||||
|
# require homebrew testing env |
||||
|
require 'test/testing_env' |
||||
|
|
||||
|
# add in HOMEBREW_LIBRARY constant, which is for some reason not set in testing_env |
||||
|
HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY/"Library" |
||||
|
|
||||
|
|
||||
|
# must be called after testing_env so at_exit hooks are in proper order |
||||
|
require 'minitest/spec' |
||||
|
require 'minitest/autorun' |
||||
|
require 'purdytest' |
||||
|
|
||||
|
# our baby |
||||
|
require 'cask' |
||||
|
|
||||
|
# "install" brew-cask into homebrew testing env |
||||
|
require 'cmd/tap' |
||||
|
shutup do |
||||
|
Homebrew.install_tap 'phinze', 'cask' |
||||
|
end |
Loading…
Reference in new issue