-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup comment cruft and style considerations
- Loading branch information
1 parent
88aab47
commit 2845fb5
Showing
7 changed files
with
43 additions
and
42 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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
# Characterizes the file at 'filepath' if available, otherwise, pulls a copy from the repository | ||
# and runs characterization on that file. | ||
|
||
class CharacterizeJob < Hyrax::ApplicationJob | ||
queue_as Hyrax.config.ingest_queue_name | ||
|
||
def perform(work) | ||
Hyrax::Characterizer.for(source: work).characterize | ||
def perform(file_set) | ||
Hyrax::Characterizer.for(source: file_set).characterize | ||
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
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,34 +1,32 @@ | ||
RSpec.describe CharacterizeJob do | ||
context 'when the work is an ActiveFedora FileSet' do | ||
let(:file_set_id) { 'abc12345' } | ||
let(:filename) { Rails.root.join('tmp', 'uploads', 'ab', 'c1', '23', '45', 'abc12345', 'picture.png').to_s } | ||
let(:file_set) do | ||
FileSet.new(id: file_set_id).tap do |fs| | ||
allow(fs).to receive(:original_file).and_return(file) | ||
allow(fs).to receive(:update_index) | ||
end | ||
let(:file_set_id) { 'abc12345' } | ||
let(:filename) { Rails.root.join('tmp', 'uploads', 'ab', 'c1', '23', '45', 'abc12345', 'picture.png').to_s } | ||
let(:file_set) do | ||
FileSet.new(id: file_set_id).tap do |fs| | ||
allow(fs).to receive(:original_file).and_return(file) | ||
allow(fs).to receive(:update_index) | ||
end | ||
let(:file) do | ||
Hydra::PCDM::File.new.tap do |f| | ||
f.content = 'foo' | ||
f.original_name = 'picture.png' | ||
f.save! | ||
allow(f).to receive(:save!) | ||
end | ||
end | ||
let(:file) do | ||
Hydra::PCDM::File.new.tap do |f| | ||
f.content = 'foo' | ||
f.original_name = 'picture.png' | ||
f.save! | ||
allow(f).to receive(:save!) | ||
end | ||
end | ||
|
||
context "when the file set's work is in a collection" do | ||
let(:work) { build(:generic_work) } | ||
let(:collection) { build(:collection_lw) } | ||
context "when the file set's work is in a collection" do | ||
let(:work) { build(:generic_work) } | ||
let(:collection) { build(:collection_lw) } | ||
|
||
before do | ||
allow(file_set).to receive(:parent).and_return(work) | ||
allow(work).to receive(:in_collections).and_return([collection]) | ||
end | ||
it "reindexes the collection" do | ||
expect(collection).to receive(:update_index) | ||
described_class.perform_now(file_set) | ||
end | ||
before do | ||
allow(file_set).to receive(:parent).and_return(work) | ||
allow(work).to receive(:in_collections).and_return([collection]) | ||
end | ||
it "reindexes the collection" do | ||
expect(collection).to receive(:update_index) | ||
described_class.perform_now(file_set) | ||
end | ||
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