Sha256: 9e0ce74245630ec18a451292bda7a8d76afa4677aae6475652ebba06d62c2d31

Contents?: true

Size: 772 Bytes

Versions: 7

Compression:

Stored size: 772 Bytes

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.show.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_messages(blacklight_config: config, action_name: 'show')
    assign :document, document
  end

  it "includes document attributes" do
    expect(hash).to include(data:
      {
        id: '123',
        type: 'Book',
        attributes: {
          'title' => 'Book1'
        }
      })
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
blacklight-8.6.1 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-8.6.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-8.5.1 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-8.5.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-8.4.0 spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/spec/views/catalog/show.json.jbuilder_spec.rb
blacklight-8.3.0 spec/views/catalog/show.json.jbuilder_spec.rb