Sha256: 7c21fdc863ee313ed8433de2784296033b349158a73774c77eb8649da68c57df

Contents?: true

Size: 1.85 KB

Versions: 47

Compression:

Stored size: 1.85 KB

Contents

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

47 entries across 47 versions & 1 rubygems

Version Path
blacklight-spotlight-2.0.2 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-2.0.1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-2.0.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc6 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc5 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc4 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc3 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc2 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-2.0.0.rc1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-1.5.1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-1.4.1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-1.4.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-1.3.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-1.2.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-1.1.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-1.0.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-1.0.0.alpha2 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-1.0.0.alpha1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.34.1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.34.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb