Sha256: c98db052003c9a33d26b63322812df0b16e4f410a2d644c19cf5988d7ee5c9a9

Contents?: true

Size: 1.03 KB

Versions: 45

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe SearchHistoryController do

  describe "index" do
    before(:all) do
      @one = Search.create
      @two = Search.create
      @three = Search.create
    end

    it "should only fetch 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).to_not include(@two)
    end
    
    it "should tolerate 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 "should 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

45 entries across 45 versions & 1 rubygems

Version Path
blacklight-5.19.2 spec/controllers/search_history_controller_spec.rb
blacklight-5.19.1 spec/controllers/search_history_controller_spec.rb
blacklight-5.19.0 spec/controllers/search_history_controller_spec.rb
blacklight-5.18.0 spec/controllers/search_history_controller_spec.rb
blacklight-5.17.2 spec/controllers/search_history_controller_spec.rb
blacklight-5.17.1 spec/controllers/search_history_controller_spec.rb
blacklight-5.17.0 spec/controllers/search_history_controller_spec.rb
blacklight-5.16.4 spec/controllers/search_history_controller_spec.rb
blacklight-5.16.3 spec/controllers/search_history_controller_spec.rb
blacklight-5.16.2 spec/controllers/search_history_controller_spec.rb
blacklight-5.16.1 spec/controllers/search_history_controller_spec.rb
blacklight-5.16.0 spec/controllers/search_history_controller_spec.rb
blacklight-5.15.0 spec/controllers/search_history_controller_spec.rb
blacklight-5.14.0 spec/controllers/search_history_controller_spec.rb
blacklight-5.13.1 spec/controllers/search_history_controller_spec.rb
blacklight-5.13.0 spec/controllers/search_history_controller_spec.rb
blacklight-5.11.3 spec/controllers/search_history_controller_spec.rb
blacklight-5.12.1 spec/controllers/search_history_controller_spec.rb
blacklight-5.12.0 spec/controllers/search_history_controller_spec.rb
blacklight-5.10.3 spec/controllers/search_history_controller_spec.rb