Sha256: bc2b3795e513b37584c56d041ae114a7d3bab419d67cd9d88f7fd42233a8540c

Contents?: true

Size: 1.44 KB

Versions: 5

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'

describe "catalog/_document_masonry.html.erb", :type => :view do
  let(:blacklight_config) { Blacklight::Configuration.new }
  let(:documents) { [stub_model(::SolrDocument), stub_model(::SolrDocument)] }
  let(:presenter) { instance_double(Blacklight::IndexPresenter, heading: 'xyz')}
  before do
    allow(view).to receive_messages(blacklight_config: blacklight_config)
    allow(view).to receive_messages(index_presenter: presenter)
    allow(view).to receive_messages(documents: documents)
    allow(view).to receive_messages(document_counter: 1)
    allow(view).to receive_messages(document_counter_with_offset: 1)
    allow(view).to receive_messages(render_document_partials: "Caption")
    allow(view).to receive_messages(render_thumbnail_tag: "Thumbnail")
    render
  end

  it 'should render a container div with a data attribute to initiate the masonry plugin' do
    expect(rendered).to have_css('#documents[data-behavior="masonry-gallery"]')
  end

  it 'should render a .masonry.document div for each document' do
    expect(rendered).to have_css('.masonry.document', count: 2)
  end

  it 'should render the thumbnail' do
    expect(rendered).to have_css('.thumbnail', text: 'Thumbnail')
    expect(view).to have_received(:render_thumbnail_tag).with(documents.first, { class: 'img-thumbnail', alt: 'xyz' }, counter: 1)
  end

  it 'should render the caption' do
    expect(rendered).to have_css('.caption', text: 'Caption')
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-gallery-2.1.0 spec/views/catalog/_index_masonry.html.erb_spec.rb
blacklight-gallery-2.0.2 spec/views/catalog/_index_masonry.html.erb_spec.rb
blacklight-gallery-2.0.1 spec/views/catalog/_index_masonry.html.erb_spec.rb
blacklight-gallery-2.0.0 spec/views/catalog/_index_masonry.html.erb_spec.rb
blacklight-gallery-1.7.0 spec/views/catalog/_index_masonry.html.erb_spec.rb