Sha256: cd24498602064666685f24cffe88b5cf2f0d878c9d08aa7e9e7f7da305fdccb8

Contents?: true

Size: 1020 Bytes

Versions: 74

Compression:

Stored size: 1020 Bytes

Contents

# frozen_string_literal: true

RSpec.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 "looks 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 "looks 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 "supports 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

Version data entries

74 entries across 74 versions & 2 rubygems

Version Path
blacklight-7.40.0 spec/controllers/blacklight/facet_spec.rb
blacklight-7.39.0 spec/controllers/blacklight/facet_spec.rb
blacklight-7.38.0 spec/controllers/blacklight/facet_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/spec/controllers/blacklight/facet_spec.rb
blacklight-7.37.0 spec/controllers/blacklight/facet_spec.rb
blacklight-7.36.2 spec/controllers/blacklight/facet_spec.rb
blacklight-7.36.1 spec/controllers/blacklight/facet_spec.rb
blacklight-7.36.0 spec/controllers/blacklight/facet_spec.rb
blacklight-7.35.0 spec/controllers/blacklight/facet_spec.rb
blacklight-7.34.0 spec/controllers/blacklight/facet_spec.rb
blacklight-7.33.1 spec/controllers/blacklight/facet_spec.rb
blacklight-7.33.0 spec/controllers/blacklight/facet_spec.rb
blacklight-7.32.0 spec/controllers/blacklight/facet_spec.rb
blacklight-7.31.0 spec/controllers/blacklight/facet_spec.rb
blacklight-7.30.0 spec/controllers/blacklight/facet_spec.rb
blacklight-7.29.0 spec/controllers/blacklight/facet_spec.rb
blacklight-7.28.0 spec/controllers/blacklight/facet_spec.rb
blacklight-7.27.1 spec/controllers/blacklight/facet_spec.rb
blacklight-7.27.0 spec/controllers/blacklight/facet_spec.rb
blacklight-7.26.1 spec/controllers/blacklight/facet_spec.rb