Sha256: 894eaa2ff811c5ffaaf40d2f5e4bbefee4fcd863eb05e9d9eba2bebb4e88d10d

Contents?: true

Size: 1.01 KB

Versions: 16

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", formats: [: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

16 entries across 16 versions & 1 rubygems

Version Path
blacklight-7.32.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.31.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.30.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.29.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.28.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.27.1 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.27.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.26.1 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.26.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.25.3 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.25.2 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.25.1 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.25.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.24.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.23.0.1 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-7.23.0 spec/views/catalog/show.json.jbuilder_spec.rb