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