-
Notifications
You must be signed in to change notification settings - Fork 16
/
Rakefile
57 lines (46 loc) · 1.5 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
# frozen_string_literal: true
require 'rake/midi-smtp-server-testtask'
desc 'Run all the Rubocop rules on source files'
task :rubocop do
sh('rubocop lib/ test/ examples/ cookbook/ Rakefile')
end
# ALL FOR TESTING
namespace :test do
# prepare test tasks
# drop all from before our test:name from ARGV
until ARGV.empty?
found = ARGV[0].match?(/^test:/)
ARGV.delete_at(0)
break if found
end
# setup TESTOPTS from given parameters
testopts = +''
until ARGV.empty?
testopts << ' -v' if ARGV[0].match?(/^v=(1|y|yes|t|true)$/i)
testopts << ' --name="/' << ARGV[0][2..] << '/"' if ARGV[0].match?(/^T=.+$/i)
ARGV.delete_at(0)
end
ENV['TESTOPTS'] = testopts
# template to describe the test tasks
desc_template = 'Run %s tests, [V=1|y] verbose output, [T=FilterTests] regex method names to test'
Rake::MidiSmtpServerTestTask.new(:all) do |t|
t.desc = format(desc_template, t.name)
t.add_test_files(['specs', 'unit', 'integration', 'stress'])
end
Rake::MidiSmtpServerTestTask.new(:specs) do |t|
t.desc = format(desc_template, t.name)
t.add_test_files('specs')
end
Rake::MidiSmtpServerTestTask.new(:unit) do |t|
t.desc = format(desc_template, t.name)
t.add_test_files('unit')
end
Rake::MidiSmtpServerTestTask.new(:integration) do |t|
t.desc = format(desc_template, t.name)
t.add_test_files('integration')
end
Rake::MidiSmtpServerTestTask.new(:stress) do |t|
t.desc = format(desc_template, t.name)
t.add_test_files('stress')
end
end