This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Rakefile
93 lines (71 loc) · 2.41 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#--
# Cloud Foundry 2012.02.03 Beta
# Copyright (c) [2009-2012] VMware, Inc. All Rights Reserved.
#
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
# You may not use this product except in compliance with the License.
#
# This product includes a number of subcomponents with
# separate copyright notices and license terms. Your use of these
# subcomponents is subject to the terms and conditions of the
# subcomponent's license, as noted in the LICENSE file.
#++
require "rake"
require "tempfile"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
SPEC_OPTS = %w(--format progress --colour)
require "rubygems"
require "bundler"
Bundler.setup(:default, :test)
require "rspec/core/rake_task"
require "ci/reporter/rake/rspec"
reports_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_reports"))
ENV["CI_REPORTS"] = reports_dir
task :spec => ["spec:all"]
namespace "spec" do
gemfile = "../Gemfile"
spec_opts = ["--format", "documentation", "--colour"]
desc "Run unit tests"
task "unit" => ["run_unit"]
desc "Run functional tests"
task "functional" => ["run_functional"]
task "all" => ["run_all"]
desc "Run specs for rcov"
task "rcov" => ["cleanup_coverage", "run_rcov"]
RSpec::Core::RakeTask.new("run_all") do |t|
#t.gemfile = gemfile
t.rspec_opts = spec_opts
t.pattern = "{unit,functional}/**/*_spec.rb"
end
RSpec::Core::RakeTask.new("run_unit") do |t|
#t.gemfile = gemfile
t.rspec_opts = spec_opts
t.pattern = "unit/**/*_spec.rb"
end
RSpec::Core::RakeTask.new("run_functional") do |t|
#t.gemfile = gemfile
t.rspec_opts = spec_opts
t.pattern = "functional/**/*_spec.rb"
end
RSpec::Core::RakeTask.new(:ci => ["ci:setup:rspec"]) do |t|
t.pattern = '**/*_spec.rb'
end
require 'simplecov'
require 'simplecov-rcov'
task :run_rcov => :cleanup_coverage do
SimpleCov.root('..')
SimpleCov.coverage_dir("spec_coverage")
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
SimpleCov.start do
require "rspec/core"
add_filter "/gems/"
unit_dir = File.expand_path("../unit", __FILE__)
func_dir = File.expand_path("../functional", __FILE__)
RSpec::Core::Runner.disable_autorun!
RSpec::Core::Runner.run([unit_dir, func_dir], STDERR, STDOUT)
end
end
task "cleanup_coverage" do
rm_rf "spec_coverage"
end
end