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.26.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.25.3 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.25.2 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.25.1 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.25.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.24.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.23.0.1 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.23.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.22.2 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.22.1 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.22.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.21.2 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.21.1 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.21.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.20.1 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.20.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.19.2 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.19.1 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.19.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.18.1 spec/presenters/blacklight/link_alternate_presenter_spec.rb