Sha256: efb47230a2b504477d4a4838e53a2bf7922fbcd9a743dca477f622610655229b

Contents?: true

Size: 1.48 KB

Versions: 20

Compression:

Stored size: 1.48 KB

Contents

# frozen_string_literal: true

describe 'Exhibits index page', type: :feature do
  context 'with multiple exhibits' do
    let!(:exhibit) { FactoryBot.create(:exhibit, title: 'Some Exhibit Title') }
    let!(:other_exhibit) { FactoryBot.create(:exhibit, title: 'Some Other Title') }

    it 'shows some cards for each published exhibit' do
      visit spotlight.exhibits_path

      expect(page).to have_selector '.exhibit-card h2', text: 'Some Exhibit Title'
    end

    context 'with tagged exhibits' do
      before do
        exhibit.tag_list = %w[a]
        other_exhibit.tag_list = %w[a b]

        exhibit.save
        other_exhibit.save
      end

      it 'shows controls to filter exhibits by tags' do
        visit spotlight.exhibits_path

        expect(page).to have_selector '.exhibit-card', count: 2

        within '.tags' do
          expect(page).to have_selector '.active', text: 'All'

          click_link 'a'
        end

        expect(page).to have_selector '.exhibit-card', count: 2

        within '.tags' do
          expect(page).to have_selector '.active', text: 'a'
          click_link 'b'
        end

        expect(page).to have_selector '.exhibit-card', count: 1
      end
    end
  end

  context 'with a single exhibit' do
    let!(:exhibit) { FactoryBot.create(:exhibit, title: 'Some Exhibit Title') }

    it 'redirects to the exhibit home page' do
      visit spotlight.exhibits_path

      expect(current_url).to eq spotlight.exhibit_root_url(exhibit)
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
blacklight-spotlight-3.4.0 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.3.0 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.2.0 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.1.0 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.3 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.2 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.1 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.0 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.0.rc6 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.0.rc5 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.0.rc4 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.0.rc3 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.0.rc2 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.0.rc1 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.0.alpha.10 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.0.alpha.9 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.0.alpha.8 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.0.alpha.7 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.0.alpha.6 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.0.alpha.5 spec/features/exhibits_index_spec.rb