Skip to content

Commit

Permalink
Merge a818bab into 60c77eb
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Dec 17, 2018
2 parents 60c77eb + a818bab commit a73cc12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/presenters/blacklight/index_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def render_document_index_label(*args)
# @option options [String] :value
def field_value field_or_name, options = {}
field = case field_or_name
when String
Deprecation.warn(self, "You provided a String value to IndexPresenter#field_value " \
when String, Symbol
Deprecation.warn(self, "You provided a String or Symbol value to IndexPresenter#field_value " \
"Provide a Blacklight::Configuration::Field instead. field_value() will not accept " \
"strings in Blacklight 7")
"strings or symbols in Blacklight 7")
field_config(field_or_name)
else
field_or_name
Expand Down
9 changes: 9 additions & 0 deletions spec/presenters/index_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@
expect(Deprecation).to receive(:warn)
expect(subject).to eq 'document qwer value'
end

context 'with a name as a symbol' do
subject { presenter.field_value :qwer }

it 'raises a deprecation' do
expect(Deprecation).to receive(:warn)
expect(subject).to eq 'document qwer value'
end
end
end

context 'when an explicit value is provided' do
Expand Down

0 comments on commit a73cc12

Please sign in to comment.