Sha256: 41bba26b52e22f644c12ed8029600ce84ba12a4e220f02bff64d2456b43e3c0f

Contents?: true

Size: 1.88 KB

Versions: 28

Compression:

Stored size: 1.88 KB

Contents

require 'spec_helper'

describe 'spotlight/catalog/_edit_default.html.erb', type: :view do
  let(:blacklight_config) do
    Blacklight::Configuration.new do |config|
      config.index.title_field = :title_field
    end
  end

  let(:document) { stub_model(::SolrDocument) }

  let(:exhibit) { stub_model(Spotlight::Exhibit) }

  before do
    allow(exhibit).to receive_messages(blacklight_config: blacklight_config)

    allow(view).to receive(:uploaded_field_label) do |config|
      "#{config.field_name} label"
    end
    allow(view).to receive_messages(exhibit_tags_path: 'autocomplete-path.json')
    allow(view).to receive_messages(blacklight_config: blacklight_config)
    allow(view).to receive_messages(current_exhibit: exhibit)
    allow(view).to receive_messages(document: document)
    allow(view).to receive(:can?).and_return(true)
  end

  it 'has a edit tag form' do
    render
    expect(rendered).to have_field 'solr_document_exhibit_tag_list'
    expect(rendered).to have_selector '#solr_document_exhibit_tag_list[@data-autocomplete_url="autocomplete-path.json"]'
  end
  it 'does not have special metadata editing fields for non-uploaded resources' do
    render
    expect(rendered).to_not have_field 'title_field label'
    expect(rendered).to_not have_field 'spotlight_upload_description_tesim label'
    expect(rendered).to_not have_field 'spotlight_upload_attribution_tesim label'
    expect(rendered).to_not have_field 'spotlight_upload_date_tesim label'
  end
  it 'has special metadata fields for an uploaded resource' do
    allow(document).to receive_messages(uploaded_resource?: true)
    render
    expect(rendered).to have_field 'title_field label'
    expect(rendered).to have_field 'spotlight_upload_description_tesim label'
    expect(rendered).to have_field 'spotlight_upload_attribution_tesim label'
    expect(rendered).to have_field 'spotlight_upload_date_tesim label'
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
blacklight-spotlight-0.19.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.18.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.17.1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.17.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.16.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.15.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.14.2 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.14.1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.14.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.13.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.12.1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.12.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.11.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.10.3 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.10.2 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.10.1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.10.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.9.2 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.9.1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.9.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb