Sha256: 47299cd8ac53e3e882d4bf68594a9f31bbaf4eb23f48016ac4f7d202294fdda9

Contents?: true

Size: 1.77 KB

Versions: 1

Compression:

Stored size: 1.77 KB

Contents

require "spec_helper"

describe "Search Results Block", type: :feature, js: true do
  let(:exhibit) { FactoryGirl.create(:exhibit) }
  let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
  let!(:feature_page) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
  let!(:alt_search) { FactoryGirl.create(:search, title: "Alt. Search", exhibit: exhibit) }

  before { login_as exhibit_curator }
  it "should allow a curator to select from existing browse categories" do
    skip("Passing locally but Travis is throwing intermittent errors") if ENV["CI"]
    visit spotlight.exhibit_home_page_path(exhibit, exhibit.home_page)
    click_link exhibit_curator.email
    within '#user-util-collapse .dropdown' do
      click_link 'Dashboard'
    end
    click_link "Feature pages"

    within("[data-id='#{feature_page.id}']") do
      click_link "Edit"
    end

    add_widget 'search_results'

    # Drop down should exist with all browse categories listed
    within("select[name='searches-options']") do
      expect(page).to have_css("option", text: "All Exhibit Items", visible: true)
      expect(page).to have_css("option", text: "Alt. Search", visible: true)
      expect(page).to have_css("option[value='#{alt_search.id}']", visible: true)
    end

    select("All Exhibit Items", from: "Browse category")

    check "gallery"
    check "slideshow"

    save_page
    
    # The two configured view types should be
    # present and the one not selected should not be
    within(".view-type-group") do
      expect(page).not_to have_css(".view-type-list")
      expect(page).to     have_css(".view-type-gallery")
      expect(page).to     have_css(".view-type-slideshow")
    end

    # Documents should exist
    expect(page).to have_css(".documents .document")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-spotlight-0.2.0 spec/features/javascript/search_result_block_spec.rb