forked from Homebrew/homebrew-cask
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
7 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source :rubygems | ||
|
||
group :test do | ||
gem 'purdytest' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'rake/testtask' | ||
|
||
Rake::TestTask.new do |t| | ||
t.pattern = "spec/*_test.rb" | ||
end | ||
|
||
task :default => :test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Submodule homebrew
added at
c40cff