Sha256: d4fba61c09087a17c8cf0862e05040b0ef5a46f67803fb32b935d7f1fe1858da

Contents?: true

Size: 1.7 KB

Versions: 3

Compression:

Stored size: 1.7 KB

Contents

require 'spec_helper'
require 'features_shared'

RSpec.describe 'newspapers_search' do
  include_context "fixtures_for_features"

  # title_base_memo comes from fixtures_for_features
  before do
    visit newspaper_works.newspapers_search_path
    fill_in "all_fields", with: title_base_memo
  end

  it 'returns results for keyword search' do
    click_button('search-submit-newspapers')
    within "#search-results" do
      expect(page).to have_content "#{title1_issue1_title_memo}: Page 1"
      expect(page).to have_content "#{title1_issue1_title_memo}: Page 2"
      expect(page).to have_content "#{title2_issue1_title_memo}: Page 1"
    end
  end

  it 'returns correct results for keyword search with front page' do
    check 'f_first_page_bsi_'
    click_button('search-submit-newspapers')
    within "#search-results" do
      expect(page).to have_content "#{title2_issue1_title_memo}: Page 1"
      expect(page).not_to have_content "#{title1_issue1_title_memo}: Page 2"
    end
  end

  it 'returns correct results for keyword search with date' do
    fill_in "date_range_start", with: '1965'
    fill_in "date_range_end", with: '1966'
    click_button('search-submit-newspapers')
    within "#search-results" do
      expect(page).to have_content "#{title1_issue1_title_memo}: Page 1"
      expect(page).not_to have_content "#{title2_issue1_title_memo}: Page 1"
    end
  end

  it 'returns correct results for keyword search with facet' do
    check 'f_inclusive_language_sim_spanish'
    click_button('search-submit-newspapers')
    within "#search-results" do
      expect(page).to have_content "#{title2_issue1_title_memo}: Page 1"
      expect(page).not_to have_content "#{title1_issue1_title_memo}: Page 1"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newspaper_works-1.0.1 spec/features/newspapers_search_spec.rb
newspaper_works-1.0.0 spec/features/newspapers_search_spec.rb
newspaper_works-0.1.0 spec/features/newspapers_search_spec.rb