Sha256: 3b1a29619f1668bd03b97447e9a069721f6af220ddcc3828c61abfb440c2e19e

Contents?: true

Size: 1.37 KB

Versions: 18

Compression:

Stored size: 1.37 KB

Contents

# frozen_string_literal: true

describe 'spotlight/sir_trevor/blocks/_solr_documents_block.html.erb', type: :view do
  let(:p) { 'spotlight/sir_trevor/blocks/solr_documents_block.html.erb' }
  let(:page) { double('Page') }
  let(:block) do
    SirTrevorRails::Blocks::SolrDocumentsBlock.new({ type: 'block', data: { title: 'Some title', text: 'Some text', 'text-align' => 'right' } }, page)
  end
  let(:doc) { blacklight_config.document_model.new(id: 1) }
  let(:blacklight_config) do
    Blacklight::Configuration.new do |config|
      config.view.embed.partials = %w(a b c)
      config.view.embed.locals = { a: 1 }
    end
  end

  before do
    allow(block).to receive(:each_document).and_yield({}, doc)
    allow(block).to receive(:documents?).and_return(true)
  end

  before do
    allow(view).to receive(:blacklight_config).and_return(blacklight_config)
    allow(view).to receive_messages(has_thumbnail?: true, render_thumbnail_tag: 'thumb', document_link_params: {})
  end

  context 'with a multi-image object' do
    let(:block_options) { { thumbnail_image_url: 'http://example.com' } }
    before do
      allow(block).to receive(:each_document).and_yield(block_options, doc)
    end

    it 'uses the provided thumbnail url' do
      render partial: p, locals: { solr_documents_block: block }
      expect(rendered).to have_selector 'img[src="http://example.com"]'
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.alpha.2 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-3.0.0.alpha.1 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.13.0 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.12.1 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.12.0 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.11.0 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.10.0 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.9.0 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.8.0 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.7.2 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.7.1 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.7.0 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.6.1.1 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.6.1 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.6.0 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.5.2 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.5.1 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb
blacklight-spotlight-2.5.0 spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb