-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(disable-hiseq-submission-template): moves logging to Rails logge…
…r and updates tests
- Loading branch information
1 parent
dd48091
commit 898c753
Showing
2 changed files
with
12 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,6 @@ | |
Rails.application.load_tasks if Rake::Task.tasks.empty? | ||
|
||
describe 'support:disable_hiseq_submission_templates', type: :task do | ||
let(:task_invoke) { Rake::Task[self.class.top_level_description].invoke } | ||
|
||
context 'when the disable_hiseq_submission_templates task is invoked' do | ||
it 'updates all hiseq submissions to have a superceded_by_id of -2' do | ||
Check failure on line 10 in spec/tasks/support/disable_hiseq_submission_templates_spec.rb GitHub Actions / rspec_tests (3, 2)
Check failure on line 10 in spec/tasks/support/disable_hiseq_submission_templates_spec.rb GitHub Actions / rspec_tests (3, 2)
|
||
# Create unused submission templates | ||
|
@@ -19,7 +17,11 @@ | |
create(:submission_template, name: "Some other hiseq #{i}") | ||
end | ||
|
||
expect { task_invoke }.to output("Disabled 10 HiSeq submission templates.\n").to_stdout | ||
allow(Rails.logger).to receive(:info) | ||
|
||
Rake::Task['support:disable_hiseq_submission_templates'].invoke | ||
|
||
expect(Rails.logger).to have_received(:info).with('Disabled 10 HiSeq submission templates.') | ||
# Expect all hiseq submissions to have a superceded_by_id of -2 | ||
expect(SubmissionTemplate.where('name LIKE ?', '%hiseq%').all? { |st| st.superceded_by_id == -2 }).to be true | ||
# Expect all other submissions to have a superceded_by_id of -1 | ||
|
@@ -38,9 +40,11 @@ | |
create(:submission_template, name: "Some other hiseq #{i}", superceded_by_id: -2) | ||
end | ||
|
||
expect { Rake::Task['support:enable_hiseq_submission_templates'].invoke }.to output( | ||
"Enabled 10 HiSeq submission templates.\n" | ||
).to_stdout | ||
allow(Rails.logger).to receive(:info) | ||
|
||
Rake::Task['support:enable_hiseq_submission_templates'].invoke | ||
|
||
expect(Rails.logger).to have_received(:info).with('Enabled 10 HiSeq submission templates.') | ||
# Expect all hiseq submissions to have a superceded_by_id of -1 | ||
expect(SubmissionTemplate.where('name LIKE ?', '%hiseq%').all? { |st| st.superceded_by_id == -1 }).to be true | ||
end | ||
|