Sha256: 760360646af9537e33dee0e76408e152a613d825acf398460e588c6ecacce4ae

Contents?: true

Size: 1.11 KB

Versions: 39

Compression:

Stored size: 1.11 KB

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 "should lop off everything before the first colin after the slash" do
      expect(helper.document_partial_name('has_model_s' => ["info:fedora/afmodel:Presentation"])).to eq "presentation"
      expect(helper.document_partial_name('has_model_s' => ["info:fedora/hull-cModel:genericContent"])).to eq "generic_content"
    end

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

    it "should handle periods" do
      expect(helper.document_partial_name('has_model_s' => ["info:fedora/afmodel:text.PDF"])).to eq "text_pdf"
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
hydra-core-8.2.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.0.2 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.0.1 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.0.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.0.0.beta4 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.0.0.beta3 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.0.0.beta2 spec/helpers/blacklight_helper_spec.rb
hydra-core-10.0.0.beta1 spec/helpers/blacklight_helper_spec.rb
hydra-core-9.10.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-9.9.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-9.8.1 spec/helpers/blacklight_helper_spec.rb
hydra-core-9.8.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-9.7.1 spec/helpers/blacklight_helper_spec.rb
hydra-core-9.7.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-9.6.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-9.5.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-9.4.1 spec/helpers/blacklight_helper_spec.rb
hydra-core-9.4.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-9.3.0 spec/helpers/blacklight_helper_spec.rb
hydra-core-9.2.2 spec/helpers/blacklight_helper_spec.rb