Sha256: 45aaf8009988138daafbf03a3c9173f266bf5ee2e0c42f6537c5361da5d9ed27

Contents?: true

Size: 1.24 KB

Versions: 24

Compression:

Stored size: 1.24 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

24 entries across 24 versions & 1 rubygems

Version Path
blacklight-6.25.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.24.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.23.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.22.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.21.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.20.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.19.2 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.19.1 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.19.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.18.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.17.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.16.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.15.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-7.0.0.rc1 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.14.1 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.14.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.13.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.12.0 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.11.2 spec/presenters/blacklight/link_alternate_presenter_spec.rb
blacklight-6.11.1 spec/presenters/blacklight/link_alternate_presenter_spec.rb