Sha256: f21018474c428506f9becf9fa6b5005599265b49b66116e2f0644e19339e9aa6

Contents?: true

Size: 1.25 KB

Versions: 74

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

RSpec.describe Blacklight::LinkAlternatePresenter do
  let(:view_context) { double }
  let(:document) { SolrDocument.new(id: 9999) }
  let(:options) { {} }
  let(:config) { Blacklight::Configuration.new }
  let(:parameter_class) { ActionController::Parameters }
  let(:params) { parameter_class.new }
  let(:controller) { double }
  let(:search_state) { Blacklight::SearchState.new(params, config, controller) }

  let(:presenter) { described_class.new(view_context, document, options) }

  before do
    allow(view_context).to receive(:search_state).and_return(search_state)
    allow(view_context).to receive(:polymorphic_url) do |doc, opts|
      "http://test.host/catalog/#{doc.to_param}.#{opts[:format]}"
    end
  end

  describe "#render" do
    subject { presenter.render }

    let(:expected_html) do
      '<link rel="alternate" title="xml" type="application/xml" href="http://test.host/catalog/9999.xml" />' \
      '<link rel="alternate" title="dc_xml" type="text/xml" href="http://test.host/catalog/9999.dc_xml" />' \
      '<link rel="alternate" title="oai_dc_xml" type="text/xml" href="http://test.host/catalog/9999.oai_dc_xml" />'
    end

    it { is_expected.to be_equivalent_to expected_html }
  end
end

Version data entries

74 entries across 74 versions & 2 rubygems

Version Path
blacklight-7.40.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.39.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.38.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.37.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.36.2 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.36.1 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.36.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.35.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.34.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.33.1 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.33.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.32.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.31.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.30.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.29.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.28.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.27.1 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.27.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.26.1 spec/presenters/blacklight/link_alternate_presenter_spec.rb