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-0.33.3 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.33.2 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.33.1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.33.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.32.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.31.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.30.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.29.1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.29.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.28.3 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.28.2 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.28.1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.28.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.27.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.26.1 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.26.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.25.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.24.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.23.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb
blacklight-spotlight-0.22.0 spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb