Sha256: fb8ec358c643c37dd257c1bf7b81f8646e92402cd005b4bd12d86776f68f0e5a

Contents?: true

Size: 1020 Bytes

Versions: 23

Compression:

Stored size: 1020 Bytes

Contents

require 'spec_helper'

describe BlacklightHelper do
  describe "document_partial_name" do
    let(:field_name) { 'has_model_s' }

    let(:config) do
      Blacklight::Configuration.new.configure do |config|
        config.show.display_type_field = field_name
      end
    end

    before do
      allow(helper).to receive(:blacklight_config).and_return(config)
    end

    it "changes camel case to underscored lowercase" do
      expect(helper.document_partial_name('has_model_s' => ["Presentation"])).to eq "presentation"
      expect(helper.document_partial_name('has_model_s' => ["GenericContent"])).to eq "generic_content"
    end

    context "with a single valued field" do
      let(:field_name) { 'has_model_s' }
      it "should support single valued fields" do
        expect(helper.document_partial_name('has_model_s' => "Chicken")).to eq "chicken"
      end
    end

    it "handles periods" do
      expect(helper.document_partial_name('has_model_s' => ["text.PDF"])).to eq "text_pdf"
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
hydra-core-11.0.7 spec/helpers/blacklight_helper_spec.rb
hydra-core-11.0.6 spec/helpers/blacklight_helper_spec.rb
hydra-core-11.0.5 spec/helpers/blacklight_helper_spec.rb
hydra-core-11.0.4 spec/helpers/blacklight_helper_spec.rb
hydra-core-11.0.1 spec/helpers/blacklight_helper_spec.rb
hydra-core-11.0.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-11.0.0.rc2 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.7.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.6.2 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.6.1 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.6.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.5.1 spec/helpers/blacklight_helper_spec.rb
hydra-core-11.0.0.rc1 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.5.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.4.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.4.0.rc2 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.4.0.rc1 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.3.4 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.3.3 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.3.2 spec/helpers/blacklight_helper_spec.rb