Permalink
Browse files

trying to add some tests

Signed-off-by: Nathan Esquenazi <xgamerx10@gmail.com>
  • Loading branch information...
grosser authored and nesquena committed Feb 16, 2009
1 parent acff975 commit 6056abcb333267420ebf734dc33c55f5aedc3a6d
Showing with 41 additions and 22 deletions.
  1. +8 −7 Rakefile
  2. +2 −0 spec/cap/all/Capfile
  3. +2 −0 spec/cap/helper.rb
  4. +13 −0 spec/cap_recipes_spec.rb
  5. +16 −0 spec/spec_helper.rb
  6. +0 −5 test/cap_recipes_test.rb
  7. +0 −10 test/test_helper.rb
View
@@ -17,12 +17,6 @@ rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end
-Rake::TestTask.new do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = false
-end
-
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'cap-recipes'
@@ -41,4 +35,11 @@ begin
rescue LoadError
end
-task :default => :test
+desc "Run all specs in spec directory"
+task :spec do |t|
+ options = "--colour --format progress --loadby --reverse"
+ files = FileList['spec/**/*_spec.rb']
+ system("spec #{options} #{files}")
+end
+
+task :default => :spec
View
@@ -0,0 +1,2 @@
+require File.join(File.dirname(__FILE__),'..','helper')
+require 'cap_recipes'
View
@@ -0,0 +1,2 @@
+$LOAD_PATH << File.join(File.dirname(__FILE__),'..','..','lib')
+def current_path;end
View
@@ -0,0 +1,13 @@
+require File.expand_path("spec_helper", File.dirname(__FILE__))
+
+describe 'loading everything' do
+ def run_cap(folder,task)
+ folder = File.join(File.dirname(__FILE__),'cap',folder)
+ `cd #{folder} && #{task}`
+ end
+
+ it "finds all tasks" do
+ tasks = run_cap 'all', 'cap -T'
+ tasks.split("\n").size.should >= 20
+ end
+end
View
@@ -0,0 +1,16 @@
+# ---- requirements
+require 'rubygems'
+require 'spec'
+
+$LOAD_PATH << File.expand_path("../lib", File.dirname(__FILE__))
+
+# ---- bugfix
+#`exit?': undefined method `run?' for Test::Unit:Module (NoMethodError)
+#can be solved with require test/unit but this will result in extra test-output
+module Test
+ module Unit
+ def self.run?
+ true
+ end
+ end
+end
View
@@ -1,5 +0,0 @@
-require File.dirname(__FILE__) + '/test_helper'
-
-class CapRecipesTest < Test::Unit::TestCase
-
-end
View
@@ -1,10 +0,0 @@
-require 'rubygems'
-require 'test/unit'
-require 'shoulda'
-require 'mocha'
-
-$LOAD_PATH.unshift(File.dirname(__FILE__))
-require 'cap_recipes'
-
-class Test::Unit::TestCase
-end

0 comments on commit 6056abc

Please sign in to comment.