-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Blacklight::Facet to support both blacklight-keyed field names…
… and solr-keyed field names
- Loading branch information
Showing
4 changed files
with
50 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'spec_helper' | ||
|
||
describe Blacklight::Facet do | ||
subject do | ||
Class.new do | ||
include Blacklight::Facet | ||
attr_reader :blacklight_config | ||
|
||
def initialize blacklight_config | ||
@blacklight_config = blacklight_config | ||
end | ||
end.new(blacklight_config) | ||
end | ||
|
||
let(:blacklight_config) { Blacklight::Configuration.new } | ||
|
||
describe "#facet_configuration_for_field" do | ||
it "should look up fields by key" do | ||
blacklight_config.add_facet_field 'a' | ||
expect(subject.facet_configuration_for_field('a')).to eq blacklight_config.facet_fields['a'] | ||
end | ||
|
||
it "should look up fields by field name" do | ||
blacklight_config.add_facet_field 'a', field: 'b' | ||
expect(subject.facet_configuration_for_field('b')).to eq blacklight_config.facet_fields['a'] | ||
end | ||
|
||
it "should support both strings and symbols" do | ||
blacklight_config.add_facet_field 'a', field: :b | ||
expect(subject.facet_configuration_for_field('b')).to eq blacklight_config.facet_fields['a'] | ||
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