-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rake tasks to re-import metadata based on Elasticsearch query #638
- Loading branch information
Martin Fenner
committed
Sep 20, 2020
1 parent
d1cb8c0
commit 52c6e7a
Showing
5 changed files
with
63 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ImportDoiJob < ActiveJob::Base | ||
queue_as :lupo_background | ||
|
||
def perform(doi_id, options={}) | ||
Doi.import_one(doi_id: doi_id) | ||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require "rails_helper" | ||
|
||
describe ImportDoiJob, type: :job do | ||
let(:doi) { create(:doi) } | ||
subject(:job) { ImportDoiJob.perform_later(doi.doi) } | ||
|
||
it "queues the job" do | ||
expect { job }.to have_enqueued_job(ImportDoiJob) | ||
.on_queue("test_lupo_background").at_least(1).times | ||
end | ||
|
||
after do | ||
clear_enqueued_jobs | ||
clear_performed_jobs | ||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require "rails_helper" | ||
|
||
describe UpdateDoiJob, type: :job do | ||
let(:doi) { create(:doi) } | ||
subject(:job) { UpdateDoiJob.perform_later(doi.doi) } | ||
|
||
it "queues the job" do | ||
expect { job }.to have_enqueued_job(UpdateDoiJob) | ||
.on_queue("test_lupo_background").at_least(1).times | ||
end | ||
|
||
after do | ||
clear_enqueued_jobs | ||
clear_performed_jobs | ||
end | ||
end |