-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
70 lines (54 loc) · 1.53 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
require 'rubygems'
require 'require_relative'
require_relative 'trade/test/ModelTests/test_require'
require 'rspec/core/rake_task'
require 'rcov/rcovtask'
require 'rake/testtask'
task :default => [:models_rcov]
def file_list(t)
t.test_files = FileList["trade/test/ModelTests/*_test.rb", "trade/test/ModelTests/*_spec.rb"]
end
def file_list_controller(t)
t.test_files = FileList["trade/test/ControllerTests/*_test.rb"]
end
def exclude_controller(t)
t.rcov_opts << "--exclude \"/gems/,/models/,spec,/helpers/,/*Tests/,init.rb,require.rb\""
end
def exclude(t)
t.rcov_opts << "--exclude \"/gems/,/controllers/,spec,/helpers/,/*Tests/,init.rb,require.rb\""
end
def lib(t)
t.libs << "trade/test/ModelTests"
end
def lib_controller(t)
t.libs << "trade/test/ControllerTests"
end
Rcov::RcovTask.new :models_rcov do |t|
lib(t)
file_list(t)
exclude(t)
end
Rcov::RcovTask.new :models_missing do |t|
lib(t)
file_list(t)
exclude(t)
t.rcov_opts << "--threshold 50"
end
Rake::TestTask.new :models_test do |t|
lib(t)
t.test_files = FileList["trade/test/ModelTests/*_test.rb"]
end
RSpec::Core::RakeTask.new :models_rspec do |t|
directory = File.join(File.dirname(__FILE__), '/trade/test/ModelTests')
t.rspec_opts = "-I#{directory}"
t.pattern = Dir["trade/test/ModelTests/*_spec.rb"]
end
Rake::TestTask.new :controllers_test do |t|
lib_controller(t)
t.test_files = FileList["trade/test/ControllerTests/*_test.rb"]
end
Rcov::RcovTask.new :controllers_rcov do |t|
lib_controller(t)
file_list_controller(t)
exclude_controller(t)
end