Sha256: f5804514195ec0987cde8c85ec590f72dd724c1476f6a8b8d630277b9b27123a

Contents?: true

Size: 1.52 KB

Versions: 18

Compression:

Stored size: 1.52 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

      within '.exhibit-card:first-child' do
        expect(page).to have_selector 'h2', text: 'Some Exhibit Title'
      end
    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

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.alpha.2 spec/features/exhibits_index_spec.rb
blacklight-spotlight-3.0.0.alpha.1 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.13.0 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.12.1 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.12.0 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.11.0 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.10.0 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.9.0 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.8.0 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.7.2 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.7.1 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.7.0 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.6.1.1 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.6.1 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.6.0 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.5.2 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.5.1 spec/features/exhibits_index_spec.rb
blacklight-spotlight-2.5.0 spec/features/exhibits_index_spec.rb