Sha256: 939229816ab5b7721c2598d4169d673c8961c8760cdff17227215c6fad19994a

Contents?: true

Size: 1.98 KB

Versions: 19

Compression:

Stored size: 1.98 KB

Contents

describe 'Item Administration', type: :feature do
  let(:exhibit) { FactoryBot.create(:exhibit) }
  let(:curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
  before { login_as curator }

  before do
    allow_any_instance_of(::SolrDocument).to receive_messages(reindex: true)
  end

  describe 'admin' do
    it "does not have a 'Save this search' button" do
      visit spotlight.admin_exhibit_catalog_path(exhibit)
      expect(page).not_to have_css('button', text: 'Save this search')
    end
    it 'has catalog items' do
      visit spotlight.admin_exhibit_catalog_path(exhibit)
      expect(page).to have_css('h1 small', text: 'Items')
      expect(page).to have_css('table#documents')
      expect(page).to have_css('.pagination')

      item = first('tr[itemscope]')
      expect(item).to have_link 'View'
      expect(item).to have_link 'Edit'
    end

    it 'has a public/private toggle' do
      visit spotlight.admin_exhibit_catalog_path(exhibit)
      item = first('tr[itemscope]')
      expect(item).to have_button 'Make Private'
      item.click_button 'Make Private'

      item = first('tr[itemscope]')
      expect(item).to have_button 'Make Public'
      item.click_button 'Make Public'
    end

    it "toggles the 'blacklight-private' label", js: true, default_max_wait_time: 5 do
      visit spotlight.admin_exhibit_catalog_path(exhibit)
      # The label should be toggled when the checkbox is clicked
      expect(page).to_not have_css('tr.blacklight-private')
      within 'tr[itemscope]:first-child' do
        find("input.toggle_visibility[type='checkbox']").click
      end
      expect(page).to have_css('tr.blacklight-private')

      # The label should show up on page load
      expect(page).to have_css('tr.blacklight-private')
      visit spotlight.admin_exhibit_catalog_path(exhibit)
      within 'tr[itemscope]:first-child' do
        find("input.toggle_visibility[type='checkbox']").click
      end
      expect(page).to_not have_css('tr.blacklight-private')
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
blacklight-spotlight-2.4.1 spec/features/item_admin_spec.rb
blacklight-spotlight-2.4.0 spec/features/item_admin_spec.rb
blacklight-spotlight-2.3.3 spec/features/item_admin_spec.rb
blacklight-spotlight-2.3.2 spec/features/item_admin_spec.rb
blacklight-spotlight-2.3.1 spec/features/item_admin_spec.rb
blacklight-spotlight-2.3.0 spec/features/item_admin_spec.rb
blacklight-spotlight-2.2.1 spec/features/item_admin_spec.rb
blacklight-spotlight-2.2.0 spec/features/item_admin_spec.rb
blacklight-spotlight-2.1.0 spec/features/item_admin_spec.rb
blacklight-spotlight-2.0.2 spec/features/item_admin_spec.rb
blacklight-spotlight-2.0.1 spec/features/item_admin_spec.rb
blacklight-spotlight-2.0.0 spec/features/item_admin_spec.rb
blacklight-spotlight-2.0.0.rc6 spec/features/item_admin_spec.rb
blacklight-spotlight-2.0.0.rc5 spec/features/item_admin_spec.rb
blacklight-spotlight-2.0.0.rc4 spec/features/item_admin_spec.rb
blacklight-spotlight-2.0.0.rc3 spec/features/item_admin_spec.rb
blacklight-spotlight-2.0.0.rc2 spec/features/item_admin_spec.rb
blacklight-spotlight-2.0.0.rc1 spec/features/item_admin_spec.rb
blacklight-spotlight-1.5.1 spec/features/item_admin_spec.rb