diff --git a/Rakefile b/Rakefile index 8bb27d3510e..0f7b9d323dc 100644 --- a/Rakefile +++ b/Rakefile @@ -31,9 +31,10 @@ RSpec::Core::RakeTask.new(:spec) do |spec| spec.pattern = FileList['spec/**/*_spec.rb'] end -RSpec::Core::RakeTask.new(:rcov) do |spec| - spec.pattern = 'spec/**/*_spec.rb' - spec.rcov = true +desc 'Run RSpec with code coverage' +task :coverage do + ENV['COVERAGE'] = 'true' + Rake::Task['spec'].execute end task :default => :spec diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5fa11e0b582..befd60b3d4c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,10 @@ # encoding: utf-8 +if ENV['COVERAGE'] + require 'simplecov' + SimpleCov.start +end + $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'rspec'