Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

43 lines (33 sloc) 1.478 kb
require 'rake'
require 'tempfile'
require 'rubygems'
require 'bundler/setup'
Bundler.require(:default, :test)
require 'rspec/core/rake_task'
require 'ci/reporter/rake/rspec'
coverage_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_coverage"))
reports_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_reports"))
dump_file = File.join(Dir.tmpdir, "router.rcov")
ENV['CI_REPORTS'] = reports_dir
desc "Run specs using RCov"
task "spec:rcov" => ["ci:setup:rspec", "spec:rcov_internal", "convert_rcov_to_clover"]
RSpec::Core::RakeTask.new do |t|
t.pattern = "**/*_spec.rb"
t.rspec_opts = ["--format", "documentation", "--colour"]
end
ignore_pattern = 'spec,[.]bundle,[/]gems[/]'
desc "Run specs using RCov (internal, use spec:rcov instead)"
RSpec::Core::RakeTask.new("spec:rcov_internal") do |t|
FileUtils.rm_rf(dump_file)
t.pattern = "**/*_spec.rb"
t.rspec_opts = ["--format", "progress", "--colour"]
t.rcov = true
t.rcov_opts = ['--aggregate', dump_file, '--exclude', ignore_pattern, '--output', coverage_dir]
# t.rcov_opts = %W{--exclude osx\/objc,gems\/,spec\/,features\/ -o "#{coverage_dir}"}
end
task "convert_rcov_to_clover" do |t|
clover_output = File.join(coverage_dir, "clover.xml")
analyzer = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "tests", "common", "rcov_analyzer.rb"))
sh("ruby #{analyzer} #{dump_file} #{ignore_pattern} > #{clover_output}")
FileUtils.rm_rf(dump_file)
end
Jump to Line
Something went wrong with that request. Please try again.