-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix test configuration to allow rake test coverage
The test coverage was getting reset for the rake tests because rake was being restarted constantly. This moves the start into the spec_helper, so it's only started once, based on reading: simplecov-ruby/simplecov#369 Also required moving the last_comment fix into the spec_helper since that's how production rake runs
- Loading branch information
Frank Duncan
committed
May 30, 2020
1 parent
9c4d92c
commit 9b81bb5
Showing
3 changed files
with
13 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
require "rake" | ||
|
||
shared_context "rake" do | ||
let(:rake) { Rake::Application.new } | ||
let(:task_name) { self.class.top_level_description } | ||
let(:task_path) { "lib/tasks/#{task_name.split(":").first}" } | ||
subject { rake[task_name] } | ||
subject { Rake.application[task_name] } | ||
|
||
def loaded_files_excluding_current_rake_file | ||
$".reject {|file| file == Rails.root.join("#{task_path}.rake").to_s } | ||
end | ||
|
||
before do | ||
Rake.application = rake | ||
Rake.application.rake_require(task_path, [Rails.root.to_s], loaded_files_excluding_current_rake_file) | ||
|
||
Rake::Task.define_task(:environment) | ||
subject.reenable | ||
end | ||
end |