Sha256: b4914448736fb68e607c25031519aef6fffc59d2a906ff862be0cd60920e85e3

Contents?: true

Size: 1.61 KB

Versions: 9

Compression:

Stored size: 1.61 KB

Contents

# frozen_string_literal: true

describe 'spotlight/sir_trevor/blocks/_solr_documents_grid_block', type: :view do
  let(:p) { 'spotlight/sir_trevor/blocks/solr_documents_grid_block' }
  let(:page) { double('Page') }
  let(:block) do
    SirTrevorRails::Blocks::SolrDocumentsGridBlock.new({ type: 'block', data: { title: 'Some title', text: 'Some text', 'text-align' => 'right' } }, page)
  end
  let(:blacklight_config) do
    Blacklight::Configuration.new
  end

  let(:stub_presenter) do
    instance_double(Blacklight::DocumentPresenter, heading: 'blah', thumbnail: thumbnail_presenter)
  end

  let(:thumbnail_presenter) { instance_double(Blacklight::ThumbnailPresenter, exists?: true, thumbnail_tag: 'thumb') }

  before do
    allow(block).to receive(:each_document).and_return([
                                                         [{}, SolrDocument.new(id: 1)],
                                                         [{}, SolrDocument.new(id: 2)],
                                                         [{}, SolrDocument.new(id: 3)]
                                                       ])
  end

  before do
    allow(view).to receive_messages(
      blacklight_config: blacklight_config,
      document_presenter: stub_presenter
    )
  end

  it 'has a slideshow block' do
    render partial: p, locals: { solr_documents_grid_block: block }
    expect(rendered).to have_selector 'h3', text: 'Some title'
    expect(rendered).to have_content 'Some text'
    expect(rendered).to have_selector '.box', text: 'thumb', count: 3
    expect(rendered).to have_selector '.items-col'
    expect(rendered).to have_selector '.text-col'
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
blacklight-spotlight-3.4.0 spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb
blacklight-spotlight-3.3.0 spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb
blacklight-spotlight-3.2.0 spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb
blacklight-spotlight-3.1.0 spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb
blacklight-spotlight-3.0.3 spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb
blacklight-spotlight-3.0.2 spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb
blacklight-spotlight-3.0.1 spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb
blacklight-spotlight-3.0.0 spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb
blacklight-spotlight-3.0.0.rc6 spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb