-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename things in related classes and specs
- Loading branch information
Showing
13 changed files
with
80 additions
and
80 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
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
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,50 +1,50 @@ | ||
require 'rails_helper' | ||
|
||
describe ResultsRecorderJob, type: :job do | ||
let(:apc) { create(:archive_preserved_copy) } | ||
let(:druid) { apc.preserved_object.druid } | ||
let(:endpoint) { apc.archive_endpoint } | ||
let(:zmv) { create(:zipped_moab_version) } | ||
let(:druid) { zmv.preserved_object.druid } | ||
let(:endpoint) { zmv.archive_endpoint } | ||
|
||
before { apc.zip_parts.create(attributes_for(:zip_part)) } | ||
before { zmv.zip_parts.create(attributes_for(:zip_part)) } | ||
|
||
it 'descends from ApplicationJob' do | ||
expect(described_class.new).to be_an(ApplicationJob) | ||
end | ||
|
||
context 'when all parts for endpoint are replicated' do | ||
it 'sets the ArchivePreservedCopy status to ok' do | ||
described_class.perform_now(druid, apc.version, 'fake.zip', endpoint.delivery_class.to_s) | ||
expect(apc.reload).to be_ok | ||
it 'sets the ZippedMoabVersion status to ok' do | ||
described_class.perform_now(druid, zmv.version, 'fake.zip', endpoint.delivery_class.to_s) | ||
expect(zmv.reload).to be_ok | ||
end | ||
it 'sets part status to ok' do | ||
skip 'write test for individual part status' | ||
end | ||
end | ||
|
||
context 'when some parts for endpoint are replicated' do | ||
it 'does not set parent archive_preserved_copy status to ok' do | ||
skip 'write test for parent apc status' | ||
it 'does not set parent zipped_moab_version status to ok' do | ||
skip 'write test for parent zmv status' | ||
end | ||
end | ||
|
||
context 'when all endpoints are fulfilled' do | ||
it 'posts a message to replication.results queue' do | ||
hash = { druid: druid, version: apc.version, endpoints: [endpoint.endpoint_name] } | ||
hash = { druid: druid, version: zmv.version, endpoints: [endpoint.endpoint_name] } | ||
expect(Resque.redis.redis).to receive(:lpush).with('replication.results', hash.to_json) | ||
described_class.perform_now(druid, apc.version, 'fake.zip', endpoint.delivery_class.to_s) | ||
described_class.perform_now(druid, zmv.version, 'fake.zip', endpoint.delivery_class.to_s) | ||
end | ||
end | ||
|
||
context 'when other endpoints remain unreplicated' do | ||
let(:other_ep) { create(:archive_endpoint, delivery_class: 2) } | ||
|
||
before do | ||
create(:archive_preserved_copy, preserved_copy: apc.preserved_copy, archive_endpoint: other_ep) | ||
create(:zipped_moab_version, preserved_copy: zmv.preserved_copy, archive_endpoint: other_ep) | ||
end | ||
|
||
it 'does not send to replication.results queue' do | ||
expect(Resque.redis.redis).not_to receive(:lpush) | ||
described_class.perform_now(druid, apc.version, 'fake.zip', endpoint.delivery_class.to_s) | ||
described_class.perform_now(druid, zmv.version, 'fake.zip', endpoint.delivery_class.to_s) | ||
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
Oops, something went wrong.