Revision b50ceaa2
Added by Thomas McKay over 6 years ago
Rakefile | ||
---|---|---|
1 |
require 'rake/testtask'
|
|
1 |
#!/usr/bin/env rake
|
|
2 | 2 |
require 'bundler/gem_tasks' |
3 |
#require 'ci/reporter/rake/minitest'
|
|
3 |
require 'rake/testtask'
|
|
4 | 4 |
|
5 |
Rake::TestTask.new do |t| |
|
6 |
t.libs << "lib" |
|
7 |
t.test_files = Dir['test/setup_test.rb'] + Dir.glob('test/**/*_test.rb') |
|
8 |
t.verbose = true |
|
5 |
def clear_cassettes |
|
6 |
`rm -rf test/fixtures/vcr_cassettes/*.yml` |
|
7 |
`rm -rf test/fixtures/vcr_cassettes/extensions/*.yml` |
|
8 |
`rm -rf test/fixtures/vcr_cassettes/support/*.yml` |
|
9 |
print "Cassettes cleared\n" |
|
9 | 10 |
end |
10 | 11 |
|
12 |
# Rake::TestTask.new do |t| |
|
13 |
# t.libs << "lib" |
|
14 |
# t.test_files = Dir['test/setup_test.rb'] + Dir.glob('test/**/*_test.rb') |
|
15 |
# t.verbose = true |
|
16 |
# end |
|
17 |
|
|
18 |
namespace :test do |
|
19 |
[:resources].each do |task_name| |
|
20 |
desc "Runs the #{task_name} tests" |
|
21 |
task task_name do |
|
22 |
options = {} |
|
23 |
|
|
24 |
options[:mode] = ENV['mode'] || 'none' |
|
25 |
options[:test_name] = ENV['test'] |
|
26 |
options[:auth_type] = ENV['auth_type'] |
|
27 |
options[:logging] = ENV['logging'] |
|
28 |
|
|
29 |
if !%w(new_episodes all none once).include?(options[:mode]) |
|
30 |
puts 'Invalid test mode' |
|
31 |
else |
|
32 |
require './test/test_runner' |
|
33 |
|
|
34 |
test_runner = CsvMiniTestRunner.new |
|
35 |
|
|
36 |
if options[:test_name] |
|
37 |
puts "Running tests for: #{options[:test_name]}" |
|
38 |
else |
|
39 |
puts "Running tests for: #{task_name}" |
|
40 |
end |
|
41 |
|
|
42 |
clear_cassettes if options[:mode] == 'all' && options[:test_name].nil? && ENV['record'] != 'false' |
|
43 |
test_runner.run_tests(task_name, options) |
|
44 |
end |
|
45 |
end |
|
46 |
end |
|
47 |
end |
|
48 |
|
|
49 |
|
|
11 | 50 |
begin |
12 | 51 |
require 'rubocop/rake_task' |
13 | 52 |
RuboCop::RakeTask.new |
... | ... | |
27 | 66 |
end |
28 | 67 |
end |
29 | 68 |
|
69 |
desc 'Clears out all cassette files' |
|
70 |
task :clear_cassettes do |
|
71 |
clear_cassettes |
|
72 |
end |
|
73 |
|
|
74 |
desc 'Runs all tests' |
|
75 |
task :test do |
|
76 |
Rake::Task['test:resources'].invoke |
|
77 |
end |
|
30 | 78 |
|
31 | 79 |
task :default do |
32 | 80 |
Rake::Task['rubocop'].execute |
81 |
Rake::Task['test'].execute |
|
33 | 82 |
end |
Also available in: Unified diff
fixes #15916 - infrastructure to switch tests to use vcr
Switching to VCR will allow both running against a live server (as the existing tests do now) or to run in pre-recorded mode.
Setting initial code coverage to 26%
Added default rake task to run rubocop and test