Skip to content

Commit

Permalink
🐛 Fix issue of calling private solr_document method
Browse files Browse the repository at this point in the history
Prior to this commit, we had a private `#solr_document` method.  This
resulted in an error in the `Hyrax::Ability` as follows:

```
NoMethodError
private method `solr_document' called for #<Hyrax::IiifAv::IiifFileSetPresenter:0x00007ff118124808>
Did you mean?  solr_document=
```

With this commit, I'm making public two methods that might cause issues
being private.  (And adding a test verifying the interface)

Oh dear reviewer, were that I were able to duplicate the bug locally.  I
tried toggling on and off the feature flag.  I also tried toggling the
allow downloads.  But to no avail.  Alas, I cannot replicate but must
instead rely on addressing the specific error.

Related to:

- #659
- https://scientist-inc.sentry.io/issues/4368889816/?environment=production&project=6707374&referrer=project-issue-stream
  • Loading branch information
jeremyf committed Aug 17, 2023
1 parent 7f165af commit 9eae100
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ module IiifAv
# request.base_url => hostname
# also to remove #auth_service since it was not working for now
module DisplaysContentDecorator
private
def solr_document
defined?(super) ? super : object
end

def solr_document
defined?(super) ? super : object
end
def current_ability
defined?(super) ? super : @ability
end

private

def current_ability
defined?(super) ? super : @ability
end

Request = Struct.new(:base_url, keyword_init: true)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Hyrax::IiifAv::DisplaysContentDecorator do
# We're prepending the DisplaysContentDecorator to the Hyrax::IiifAv::DisplaysContent
describe Hyrax::IiifAv::DisplaysContent do
describe '.public_instance_methods' do
subject { Hyrax::IiifAv::DisplaysContent.public_instance_methods }

it { is_expected.to include(:solr_document) }
it { is_expected.to include(:current_ability) }
end
end
end

0 comments on commit 9eae100

Please sign in to comment.