Sha256: bd09b79be7f1ea41f3f3f8aa3ab3e709c0d0f4df6afb46673cdd5d5590040d07

Contents?: true

Size: 1.01 KB

Versions: 27

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

RSpec.describe "catalog/show.json" do
  let(:document) do
    SolrDocument.new(id: '123', title_tsim: 'Book1', author_tsim: 'Julie', format: 'Book')
  end
  let(:config) do
    Blacklight::Configuration.new do |config|
      config.add_show_field 'title', label: 'Title', field: 'title_tsim'
    end
  end

  let(:hash) do
    render template: "catalog/show.json", format: :json
    JSON.parse(rendered).with_indifferent_access
  end

  before do
    allow(view).to receive(:blacklight_config).and_return(config)
    allow(view).to receive(:action_name).and_return('show')
    assign :document, document
  end

  it "includes document attributes" do
    expect(hash).to include(data:
      {
        id: '123',
        type: 'Book',
        attributes: {
          'title' => {
            id: 'http://test.host/catalog/123#title',
            type: 'document_value',
            attributes: {
              value: 'Book1',
              label: 'Title'
            }
          }
        }
      })
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
blacklight-7.22.2 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.22.1 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.22.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.21.2 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.21.1 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.21.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.20.1 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.20.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.19.2 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.19.1 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.19.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.18.1 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.18.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.17.2 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.17.1 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.17.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.16.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.15.2 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.15.1 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.15.0 spec/views/catalog/show.json.jbuilder_spec.rb