Sha256: 7fab3d7b3f58917c4613d00f857a716238e1149edae4c65a058d36e1be00afc2

Contents?: true

Size: 1.39 KB

Versions: 7

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

RSpec.describe "Search History Page" do
  describe "navigating from the homepage" do
    it "has a link to the history page" do
      visit root_path
      click_on 'History'
      expect(page).to have_content 'Search History'
      expect(page).to have_content 'You have no search history'
    end
  end

  describe "when I have done a search" do
    before do
      visit root_path
      fill_in "q", with: 'book'
      click_on 'search'
      click_on 'History'
    end

    it "shows searches" do
      expect(page).to have_content 'Your recent searches'
      expect(page).to have_content 'book'
      expect(page).to have_no_content 'dang'
      visit root_path
      fill_in "q", with: 'dang'
      click_on 'search'
      click_on 'History'
      expect(page).to have_content 'book'
      expect(page).to have_content 'dang'
    end
  end

  describe "when i've done several searches" do
    before do
      visit root_path
      fill_in "q", with: 'book'
      click_on 'search'
      fill_in "q", with: 'dang'
      click_on 'search'
      click_on 'History'
    end

    it "is able to clear the history" do
      click_on "Clear Search History"
      expect(page).to have_content 'Cleared your search history.'
      expect(page).to have_content 'You have no search history'
      expect(page).to have_no_content 'book'
      expect(page).to have_no_content 'dang'
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
blacklight-8.6.1 spec/features/search_history_spec.rb
blacklight-8.6.0 spec/features/search_history_spec.rb
blacklight-8.5.1 spec/features/search_history_spec.rb
blacklight-8.5.0 spec/features/search_history_spec.rb
blacklight-8.4.0 spec/features/search_history_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/spec/features/search_history_spec.rb
blacklight-8.3.0 spec/features/search_history_spec.rb