Sha256: f1e8818dcec09fb4518cde1cc17ab231b340f8fc50969bfd9a87bfbe05e8f4c9

Contents?: true

Size: 1.73 KB

Versions: 44

Compression:

Stored size: 1.73 KB

Contents

require 'spec_helper'

describe "catalog/_document" do
  let :document do
    SolrDocument.new :id => 'xyz', :format => 'a'
  end

  let :blacklight_config do
    Blacklight::Configuration.new
  end

  it "should render the header, thumbnail and index by default" do
    allow(view).to receive(:render_grouped_response?).and_return(false)
    allow(view).to receive(:blacklight_config).and_return(blacklight_config)
    stub_template "catalog/_index_header_default.html.erb" => "document_header"
    stub_template "catalog/_thumbnail_default.html.erb" => "thumbnail_default"
    stub_template "catalog/_index_default.html.erb" => "index_default"
    render :partial => "catalog/document", :locals => {:document => document, :document_counter => 1}
    expect(rendered).to match /document_header/
    expect(rendered).to match /thumbnail_default/
    expect(rendered).to match /index_default/
    expect(rendered).to have_selector('div.document[@itemscope]')
    expect(rendered).to have_selector('div.document[@itemtype="http://schema.org/Thing"]')
  end


  it "should use the index.partials parameter to determine the partials to render" do
    allow(view).to receive(:render_grouped_response?).and_return(false)
    allow(view).to receive(:blacklight_config).and_return(blacklight_config)
    blacklight_config.index.partials = ['a', 'b', 'c']
    stub_template "catalog/_a_default.html.erb" => "a_partial"
    stub_template "catalog/_b_default.html.erb" => "b_partial"
    stub_template "catalog/_c_default.html.erb" => "c_partial"
    render :partial => "catalog/document", :locals => {:document => document, :document_counter => 1}
    expect(rendered).to match /a_partial/
    expect(rendered).to match /b_partial/
    expect(rendered).to match /c_partial/
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
blacklight-5.19.2 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.19.1 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.19.0 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.18.0 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.17.2 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.17.1 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.17.0 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.16.4 spec/views/catalog/_document.html.erb_spec.rb
blacklight-6.0.0.pre3 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.16.3 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.16.2 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.16.1 spec/views/catalog/_document.html.erb_spec.rb
blacklight-6.0.0.pre2 spec/views/catalog/_document.html.erb_spec.rb
blacklight-6.0.0.pre1 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.16.0 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.15.0 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.14.0 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.13.1 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.13.0 spec/views/catalog/_document.html.erb_spec.rb
blacklight-5.11.3 spec/views/catalog/_document.html.erb_spec.rb