Sha256: 981297d6b6002b3e37bf98da796f8c837d4aa731e39e4b75743d0b8faa0cd4bc

Contents?: true

Size: 1.39 KB

Versions: 6

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

RSpec.describe Blacklight::Rendering::Pipeline do
  include Capybara::RSpecMatchers
  let(:document) { instance_double(SolrDocument) }
  let(:context) { double }
  let(:options) { double }
  let(:presenter) { described_class.new(values, field_config, document, context, options) }

  describe "render" do
    subject { presenter.render }

    let(:values) { %w[a b] }
    let(:field_config) { Blacklight::Configuration::NullField.new }

    it { is_expected.to eq "a and b" }

    context "when separator_options are in the config" do
      let(:values) { %w[c d] }
      let(:field_config) { Blacklight::Configuration::NullField.new(itemprop: nil, separator_options: { two_words_connector: '; ' }) }

      it { is_expected.to eq "c; d" }
    end

    context "when itemprop is in the config" do
      let(:values) { ['a'] }
      let(:field_config) { Blacklight::Configuration::NullField.new(itemprop: 'some-prop', separator_options: nil) }

      it { is_expected.to have_selector("span[@itemprop='some-prop']", text: "a") }
    end
  end

  describe "#operations" do
    subject { described_class.operations }

    it {
      expect(subject).to eq [Blacklight::Rendering::HelperMethod,
                             Blacklight::Rendering::LinkToFacet,
                             Blacklight::Rendering::Microdata,
                             Blacklight::Rendering::Join]
    }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
blacklight-7.2.0 spec/presenters/pipeline_spec.rb
blacklight-7.1.0 spec/presenters/pipeline_spec.rb
blacklight-7.1.0.alpha spec/presenters/pipeline_spec.rb
blacklight-7.0.1 spec/presenters/pipeline_spec.rb
blacklight-7.0.0 spec/presenters/pipeline_spec.rb
blacklight-7.0.0.rc2 spec/presenters/pipeline_spec.rb