Skip to content

Commit

Permalink
Coerce facet values to strings
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Feb 15, 2022
1 parent 31a3990 commit 599f636
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/presenters/blacklight/facet_item_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def label
localization_options = facet_config.date == true ? {} : facet_config.date
I18n.l(Time.zone.parse(label_value), **localization_options)
else
label_value
label_value.to_s
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/presenters/blacklight/facet_item_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
end

describe '#label' do
it "is the facet value for an ordinary facet" do
it "is the stringified facet value for an ordinary facet" do
allow(facet_config).to receive_messages(query: nil, date: nil, helper_method: nil, url_method: nil)
expect(presenter.label).to eq facet_item
expect(presenter.label).to eq facet_item.to_s
end

it "allows you to pass in a :helper_method argument to the configuration" do
Expand Down

0 comments on commit 599f636

Please sign in to comment.