Sha256: 0541ada39d618668e970d7dff80ddd41399ad72bced9c7c5b9ebabf7c22905e2
Contents?: true
Size: 1.05 KB
Versions: 95
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true RSpec.describe SearchHistoryController do routes { Blacklight::Engine.routes } describe "index" do before(:all) do @one = Search.create @two = Search.create @three = Search.create end it "only fetches searches with ids in the session" do session[:history] = [@one.id, @three.id] get :index @searches = assigns(:searches) expect(@searches).to have(2).searches expect(@searches).to include(@one) expect(@searches).to include(@three) 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 have(2).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
Version data entries
95 entries across 94 versions & 2 rubygems