Sha256: b2c4f4fa2f51483bba19335c544a81c0686ae1ba6ea5d4a040eabf6149d72783

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe Blacklight::Rendering::Pipeline do
  include Capybara::RSpecMatchers
  let(:document) { double }
  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) { ['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) { ['c', 'd'] }
      let(:field_config) { Blacklight::Configuration::NullField.new(separator: nil, 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(separator: nil, itemprop: 'some-prop', separator_options: nil) } 
      it { is_expected.to have_selector("span[@itemprop='some-prop']", :text => "a") }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blacklight-6.3.1 spec/presenters/pipeline_spec.rb
blacklight-6.3.0 spec/presenters/pipeline_spec.rb