Sha256: f0699a6cfa0a99674cb4e995538371c71c25ef03abf1e345efdb33a10b6b0c6f

Contents?: true

Size: 1.32 KB

Versions: 6

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe 'adding IIIF Manifest', type: :feature do
  let(:exhibit) { FactoryGirl.create(:exhibit) }
  let(:curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
  before { login_as curator }

  it 'has form to add IIIF Manifests' do
    visit spotlight.admin_exhibit_catalog_path(exhibit)
    click_link 'Add items'

    expect(page).to have_link('IIIF URL') # tab name
    expect(page).to have_css("input[id='resource_url'][type='text']")
    expect(page).to have_content 'Add the URL of a IIIF manifest or collection'
    expect(page).to have_button 'Add IIIF items'
  end

  it 'submits the form to create a new item' do
    expect_any_instance_of(Spotlight::Resource).to receive(:reindex_later).and_return(true)
    url = 'https://purl.stanford.edu/vw754mr2281/iiif/manifest.json'
    visit spotlight.admin_exhibit_catalog_path(exhibit)

    click_link 'Add items'
    fill_in 'URL', with: url

    click_button 'Add IIIF items'

    expect(Spotlight::Resource.last.url).to eq url
  end

  it 'returns an error message if the URL returned in not a IIIF endpoint' do
    visit spotlight.admin_exhibit_catalog_path(exhibit)

    click_link 'Add items'
    fill_in 'URL', with: 'http://example.com'

    click_button 'Add IIIF items'

    expect(page).to have_css('.alert', text: 'Invalid IIIF URL')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
blacklight-spotlight-0.34.1 spec/features/add_iiif_manifest_spec.rb
blacklight-spotlight-0.34.0 spec/features/add_iiif_manifest_spec.rb
blacklight-spotlight-0.33.3 spec/features/add_iiif_manifest_spec.rb
blacklight-spotlight-0.33.2 spec/features/add_iiif_manifest_spec.rb
blacklight-spotlight-0.33.1 spec/features/add_iiif_manifest_spec.rb
blacklight-spotlight-0.33.0 spec/features/add_iiif_manifest_spec.rb