aboutsummaryrefslogtreecommitdiffstats
path: root/Rakefile
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-08-10 19:49:32 -0700
committerCarl Lerche <carllerche@mac.com>2010-08-10 19:50:05 -0700
commit6cc134ca437c0c92df240c1a5fb4ee65973a0a30 (patch)
treeecaf68a84ce88ebfa6ba219c51981ebda7d82c2d /Rakefile
parent62d9fc9d9ce3c5a0933c6091e3eb3d8530908d5f (diff)
downloadbundler-6cc134ca437c0c92df240c1a5fb4ee65973a0a30.tar.gz
Add a task that runs the specs including sudo specs
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile27
1 files changed, 24 insertions, 3 deletions
diff --git a/Rakefile b/Rakefile
index 0d01295f..ea8ef303 100644
--- a/Rakefile
+++ b/Rakefile
@@ -12,11 +12,13 @@ def gemspec
end
end
+def sudo?
+ ENV['BUNDLER_SUDO_TESTS']
+end
+
begin
require 'rspec/core/rake_task'
-rescue LoadError
- raise 'Run `gem install rspec` to be able to run specs'
-else
+
task :clear_tmp do
FileUtils.rm_rf(File.expand_path("../tmp", __FILE__))
end
@@ -27,6 +29,25 @@ else
t.warning = true
end
task :spec
+
+ namespace :spec do
+ task :sudo do
+ ENV['BUNDLER_SUDO_TESTS'] = '1'
+ end
+
+ task :clean do
+ if sudo?
+ system "sudo rm -rf #{File.expand_path('../tmp', __FILE__)}"
+ else
+ rm_rf 'tmp'
+ end
+ end
+
+ desc "Run the full spec suite including SUDO tests"
+ task :full => ["sudo", "clean", "spec"]
+ end
+rescue LoadError
+ raise 'Run `gem install rspec` to be able to run specs'
end