Skip to content

Commit

Permalink
Deprecate FileSetFixityCheckService#logged_fixity_status, use the Fix…
Browse files Browse the repository at this point in the history
…ityStatusPresenter
  • Loading branch information
jrochkind committed May 17, 2017
1 parent 3cde6e5 commit f2777f0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/presenters/hyrax/file_set_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def event_class
end

def fixity_check_status
fixity_check_service.logged_fixity_status
Hyrax::FixityStatusPresenter.new(id).render_file_set_status
end

def parent
Expand Down
3 changes: 1 addition & 2 deletions app/services/hyrax/file_set_fixity_check_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ def fixity_check

# Return current fixity status for this FileSet based on
# ChecksumAuditLog records on file.
# TODO: This method is on this class for legacy, callers
# should just use FixityStatusService directly.
def logged_fixity_status
Deprecation.warn(self, "logged_fixity_status is deprecated, use FixityStatusPresenter instead")
FixityStatusPresenter.new(file_set.id).render_file_set_status
end

Expand Down
24 changes: 16 additions & 8 deletions spec/services/hyrax/file_set_fixity_check_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@
end

describe '#logged_fixity_status' do
around do |example|
# Deprecation.silence is supposed to be a thing, but I can't get it to work
original = Deprecation.default_deprecation_behavior
Deprecation.default_deprecation_behavior = :silence
example.run
Deprecation.default_deprecation_behavior = original
end

context "with an object" do
subject { service_by_object.logged_fixity_status }

Expand Down Expand Up @@ -89,17 +97,17 @@
expect(subject).to include "passed"
end
end
end

context "with an id" do
subject { service_by_id.logged_fixity_status }
context "with an id" do
subject { service_by_id.logged_fixity_status }

before do
ChecksumAuditLog.create!(passed: true, file_set_id: f.id, checked_uri: f.original_file.versions.first.label, file_id: 'original_file')
end
before do
ChecksumAuditLog.create!(passed: true, file_set_id: f.id, checked_uri: f.original_file.versions.first.label, file_id: 'original_file')
end

it "records the fixity result" do
expect(subject).to include "passed"
it "records the fixity result" do
expect(subject).to include "passed"
end
end
end
end
Expand Down

0 comments on commit f2777f0

Please sign in to comment.