|
56 | 56 | # External gems that define tasks - add here! |
57 | 57 | require "kettle/dev" |
58 | 58 |
|
| 59 | +### SPEC TASKS |
| 60 | +# For coverage aggregation with SimpleCov merging: |
| 61 | +# - Each task uses a unique K_SOUP_COV_COMMAND_NAME so SimpleCov tracks them separately |
| 62 | +# - K_SOUP_COV_USE_MERGING=true must be set in .envrc for results to merge |
| 63 | +# - K_SOUP_COV_MERGE_TIMEOUT should be set long enough for all tasks to complete |
| 64 | +begin |
| 65 | + require "rspec/core/rake_task" |
| 66 | + |
| 67 | + # kettle-dev creates an RSpec::Core::RakeTask.new(:spec) which has both |
| 68 | + # prerequisites and actions. We will leave that, and the default test task, alone, |
| 69 | + # and use *magic* here. |
| 70 | + Rake::Task[:magic].clear if Rake::Task.task_defined?(:magic) |
| 71 | + desc("Run specs") |
| 72 | + RSpec::Core::RakeTask.new(:magic) do |t| |
| 73 | + t.pattern = "./spec/**/*_spec.rb" |
| 74 | + end |
| 75 | + |
| 76 | + desc("Set SimpleCov command name for remaining specs") |
| 77 | + task(:set_coverage_command_name) do |
| 78 | + ENV["K_SOUP_COV_COMMAND_NAME"] = "Test Coverage" |
| 79 | + end |
| 80 | + Rake::Task[:magic].enhance([:set_coverage_command_name]) |
| 81 | + |
| 82 | + Rake::Task[:coverage].clear if Rake::Task.task_defined?(:coverage) |
| 83 | + desc("Slap magic onto the main coverage task") |
| 84 | + task(:coverage => [:magic]) |
| 85 | +rescue LoadError |
| 86 | + desc("(stub) spec is unavailable") |
| 87 | + task(:spec) do # rubocop:disable Rake/DuplicateTask |
| 88 | + warn("NOTE: rspec isn't installed, or is disabled for #{RUBY_VERSION} in the current environment") |
| 89 | + end |
| 90 | + |
| 91 | + desc("(stub) test is unavailable") |
| 92 | + task(:test) do # rubocop:disable Rake/DuplicateTask |
| 93 | + warn("NOTE: rspec isn't installed, or is disabled for #{RUBY_VERSION} in the current environment") |
| 94 | + end |
| 95 | +end |
| 96 | + |
59 | 97 | ### RELEASE TASKS |
60 | 98 | # Setup stone_checksums |
61 | 99 | begin |
|
0 commit comments