Skip to content

Commit

Permalink
Merge branch 'blacklight_advanced_and_range' into adventist_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewolf committed Sep 21, 2023
2 parents 3a7fde2 + 36590bc commit 5b72d50
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions spec/controllers/search_history_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# frozen_string_literal: true

RSpec.describe SearchHistoryController do
routes { Blacklight::Engine.routes }

describe 'index' do
let(:one) { Search.create }
let(:two) { Search.create }
let(:three) { Search.create }

it 'only fetches searches with ids in the session' do
session[:history] = [one.id, three.id]
get :index
searches = assigns(:searches)
expect(searches).to include(one)
expect(searches).not_to include(two)
end

it 'tolerates bad ids in session' do
session[:history] = [one.id, three.id, 'NOT_IN_DB']
get :index
searches = assigns(:searches)
expect(searches).to include(one)
expect(searches).to include(three)
end

it 'does not fetch any searches if there is no history' do
session[:history] = []
get :index
searches = assigns(:searches)
expect(searches).to be_empty
end
end
end

0 comments on commit 5b72d50

Please sign in to comment.