Sha256: 6f6c2e8d6971434e29e2ec8c1e62a4ab41ee75450da2a328d86fffde7c898343

Contents?: true

Size: 1.96 KB

Versions: 33

Compression:

Stored size: 1.96 KB

Contents

describe 'Item Administration', type: :feature do
  let(:exhibit) { FactoryGirl.create(:exhibit) }
  let(:curator) { FactoryGirl.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 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

33 entries across 33 versions & 1 rubygems

Version Path
blacklight-spotlight-1.0.0 spec/features/item_admin_spec.rb
blacklight-spotlight-1.0.0.alpha2 spec/features/item_admin_spec.rb
blacklight-spotlight-1.0.0.alpha1 spec/features/item_admin_spec.rb
blacklight-spotlight-0.34.1 spec/features/item_admin_spec.rb
blacklight-spotlight-0.34.0 spec/features/item_admin_spec.rb
blacklight-spotlight-0.33.3 spec/features/item_admin_spec.rb
blacklight-spotlight-0.33.2 spec/features/item_admin_spec.rb
blacklight-spotlight-0.33.1 spec/features/item_admin_spec.rb
blacklight-spotlight-0.33.0 spec/features/item_admin_spec.rb
blacklight-spotlight-0.32.0 spec/features/item_admin_spec.rb
blacklight-spotlight-0.31.0 spec/features/item_admin_spec.rb
blacklight-spotlight-0.30.0 spec/features/item_admin_spec.rb
blacklight-spotlight-0.29.1 spec/features/item_admin_spec.rb
blacklight-spotlight-0.29.0 spec/features/item_admin_spec.rb
blacklight-spotlight-0.28.3 spec/features/item_admin_spec.rb
blacklight-spotlight-0.28.2 spec/features/item_admin_spec.rb
blacklight-spotlight-0.28.1 spec/features/item_admin_spec.rb
blacklight-spotlight-0.28.0 spec/features/item_admin_spec.rb
blacklight-spotlight-0.27.0 spec/features/item_admin_spec.rb
blacklight-spotlight-0.26.1 spec/features/item_admin_spec.rb