From 071976914d534b601a0fae1c66426ea5ca6ac0cc Mon Sep 17 00:00:00 2001 From: Jonas Arvidsson Date: Sun, 20 Jan 2013 07:16:47 +0100 Subject: [PATCH] Added coverage task, which runs simplecov. --- Rakefile | 7 ++++--- spec/spec_helper.rb | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) 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'