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.15.1 spec/features/search_crawler_spec.rb
blacklight-7.15.0 spec/features/search_crawler_spec.rb
blacklight-7.14.1 spec/features/search_crawler_spec.rb
blacklight-7.14.0 spec/features/search_crawler_spec.rb
blacklight-7.13.2 spec/features/search_crawler_spec.rb
blacklight-7.13.1 spec/features/search_crawler_spec.rb
blacklight-7.13.0 spec/features/search_crawler_spec.rb
blacklight-7.12.1 spec/features/search_crawler_spec.rb
blacklight-7.12.0 spec/features/search_crawler_spec.rb
blacklight-7.11.1 spec/features/search_crawler_spec.rb
blacklight-7.10.0 spec/features/search_crawler_spec.rb
blacklight-7.9.0 spec/features/search_crawler_spec.rb
blacklight-7.8.1 spec/features/search_crawler_spec.rb
blacklight-7.8.0 spec/features/search_crawler_spec.rb
blacklight-7.7.0 spec/features/search_crawler_spec.rb
blacklight-7.6.0 spec/features/search_crawler_spec.rb
blacklight-7.5.1 spec/features/search_crawler_spec.rb
blacklight-7.5.0 spec/features/search_crawler_spec.rb
blacklight-7.4.2 spec/features/search_crawler_spec.rb
blacklight-7.4.1 spec/features/search_crawler_spec.rb