Browse files

modernizing spec_helper and Rakefile

  • Loading branch information...
1 parent 14f296c commit 4aaf427843402d4763a3d32246744313ab3fab94 Philip (flip) Kromer committed Aug 12, 2012
Showing with 27 additions and 25 deletions.
  1. +2 −0 .rspec
  2. +21 −20 Rakefile
  3. +4 −5 spec/spec_helper.rb
View
2 .rspec
@@ -0,0 +1,2 @@
+--color
+--format documentation
View
41 Rakefile
@@ -1,14 +1,27 @@
require 'rubygems' unless defined?(Gem)
-require 'bundler'
-begin
- Bundler.setup(:default, :development)
-rescue Bundler::BundlerError => e
- $stderr.puts e.message
- $stderr.puts "Run `bundle install` to install missing gems"
- exit e.status_code
-end
+require 'bundler/setup'
+Bundler.setup(:default, :development)
require 'rake'
+task :default => :rspec
+
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:rspec) do |spec|
+ Bundler.setup(:default, :development, :test)
+ spec.pattern = FileList['spec/**/*_spec.rb']
+end
+
+desc "Run RSpec with code coverage"
+task :cov do
+ ENV['WUKONG_COV'] = "yep"
+ Rake::Task["spec"].execute
+end
+
+require 'yard'
+YARD::Rake::YardocTask.new do
+ Bundler.setup(:default, :development, :docs)
+end
+
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "wukong"
@@ -29,15 +42,3 @@ DESC
gem.files = FileList["\w*", "**/*.textile", "{bin,docpages,examples,lib,spec,utils}/**/*"]
end
Jeweler::RubygemsDotOrgTasks.new
-
-require 'rspec/core'
-require 'rspec/core/rake_task'
-RSpec::Core::RakeTask.new(:spec) do |spec|
- Bundler.setup(:default, :development, :test)
- spec.pattern = FileList['spec/**/*_spec.rb']
-end
-
-require 'yard'
-YARD::Rake::YardocTask.new do
- Bundler.setup(:default, :development, :docs)
-end
View
9 spec/spec_helper.rb
@@ -1,10 +1,9 @@
+require 'bundler/setup' ; Bundler.require(:default, :development, :test)
+require 'rspec/autorun'
+
if ENV['WUKONG_COV']
require 'simplecov'
- SimpleCov.start do
- add_filter '/gorillib/'
- add_filter '/away/'
- add_group 'Hanuman', '/hanuman/'
- end
+ SimpleCov.start
end
require 'wukong'

0 comments on commit 4aaf427

Please sign in to comment.