forked from puppetlabs-toy-chest/beaker-testmode_switcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
36 lines (30 loc) · 712 Bytes
/
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
require "bundler/gem_tasks"
def beaker_command
cmd_parts = []
cmd_parts << "beaker"
cmd_parts << "--debug"
cmd_parts << "--test spec/test"
cmd_parts << "--load-path lib"
cmd_parts.flatten.join(" ")
end
if ENV['TEST_FRAMEWORK'] && ENV['TEST_FRAMEWORK'] == 'beaker'
task spec: [:beaker]
else
task spec: [:rspec]
end
task :rspec do
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
end
task :beaker do
abort "Beaker test failed" unless system(beaker_command) == true
end
task :rubocop do
require 'rubocop/rake_task'
RuboCop::RakeTask.new
end
begin
task default: [:spec, :rubocop]
rescue LoadError => error
raise "LoadError for default rake target. [#{error}] "
end