Sha256: 207c8709c07b783fa1414c7b782427dd40e25fb8c1ee376149e29189e7d473a8

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true
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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-6.2.0 spec/controllers/blacklight/facet_spec.rb
blacklight-6.1.0 spec/controllers/blacklight/facet_spec.rb
blacklight-6.0.2 spec/controllers/blacklight/facet_spec.rb
blacklight-6.0.1 spec/controllers/blacklight/facet_spec.rb
blacklight-6.0.0 spec/controllers/blacklight/facet_spec.rb