Sha256: f64fb3fd21e5365fb331489da3499c3e132cf2b2292d19fba2531c36c7fa5e8e

Contents?: true

Size: 900 Bytes

Versions: 88

Compression:

Stored size: 900 Bytes

Contents

# frozen_string_literal: true

RSpec.describe "Search History Page" do
  describe "crawler search" do
    let(:original_proc) { ::CatalogController.blacklight_config.crawler_detector }

    before do
      ::CatalogController.blacklight_config.crawler_detector = ->(req) { req.env['HTTP_USER_AGENT'] =~ /Googlebot/ }
    end

    after do
      ::CatalogController.blacklight_config.crawler_detector = original_proc
    end

    it "remembers human searches" do
      visit root_path
      fill_in "q", with: 'chicken'
      expect { click_button 'search' }.to change(Search, :count).by(1)
    end

    it "doesn't remember bot searches" do
      page.driver.header('User-Agent', 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)')
      visit root_path
      fill_in "q", with: 'chicken'
      expect { click_button 'search' }.not_to change(Search, :count)
    end
  end
end

Version data entries

88 entries across 88 versions & 2 rubygems

Version Path
blacklight-7.40.0 spec/features/search_crawler_spec.rb
blacklight-7.39.0 spec/features/search_crawler_spec.rb
blacklight-7.38.0 spec/features/search_crawler_spec.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-7.37.0/spec/features/search_crawler_spec.rb
blacklight-8.2.2 spec/features/search_crawler_spec.rb
blacklight-8.2.1 spec/features/search_crawler_spec.rb
blacklight-8.2.0 spec/features/search_crawler_spec.rb
blacklight-7.37.0 spec/features/search_crawler_spec.rb
blacklight-7.36.2 spec/features/search_crawler_spec.rb
blacklight-7.36.1 spec/features/search_crawler_spec.rb
blacklight-7.36.0 spec/features/search_crawler_spec.rb
blacklight-7.35.0 spec/features/search_crawler_spec.rb
blacklight-8.1.0 spec/features/search_crawler_spec.rb
blacklight-7.34.0 spec/features/search_crawler_spec.rb
blacklight-8.0.1 spec/features/search_crawler_spec.rb
blacklight-8.0.0 spec/features/search_crawler_spec.rb
blacklight-8.0.0.beta8 spec/features/search_crawler_spec.rb
blacklight-8.0.0.beta7 spec/features/search_crawler_spec.rb
blacklight-8.0.0.beta6 spec/features/search_crawler_spec.rb
blacklight-8.0.0.beta5 spec/features/search_crawler_spec.rb