-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable a configuration for skipping a saved search that uses the requ…
…est and params object
- Loading branch information
1 parent
13d3ca5
commit 8f8c025
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe 'Search session skipping' do | ||
describe 'crawler search' do | ||
let(:original_proc) { ::CatalogController.blacklight_config.skip_session_tracking } | ||
|
||
before do | ||
::CatalogController.blacklight_config.skip_session_tracking = ->(req, params) { params.fetch('view', nil) == 'weird_json_view' } | ||
end | ||
|
||
after do | ||
::CatalogController.blacklight_config.skip_session_tracking = original_proc | ||
end | ||
|
||
it 'remembers most searches' do | ||
visit root_path | ||
fill_in 'q', with: 'chicken' | ||
expect { click_button 'search' }.to change(Search, :count).by(1) | ||
end | ||
|
||
it 'does not remember weird json search' do | ||
visit root_path | ||
expect { visit search_catalog_path(q: 'chicken', view: 'weird_json_view') }.not_to change(Search, :count) | ||
end | ||
end | ||
end |