Sha256: 3af57f1c516e9c35c6be1021a9b075620aba16511bd20e41fc163308e2f1e451

Contents?: true

Size: 1.49 KB

Versions: 33

Compression:

Stored size: 1.49 KB

Contents

describe 'Exhibits index page', type: :feature do
  context 'with multiple exhibits' do
    let!(:exhibit) { FactoryGirl.create(:exhibit, title: 'Some Exhibit Title') }
    let!(:other_exhibit) { FactoryGirl.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) { FactoryGirl.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

33 entries across 33 versions & 1 rubygems

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