Sha256: 48d8159b31461a2af9915968ab5945b2d061a320b9af7a8d37ea1820ae0849c1

Contents?: true

Size: 1.07 KB

Versions: 19

Compression:

Stored size: 1.07 KB

Contents

# -*- encoding : utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/../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)
      @searches.length.should == 2
      @searches.should include(@one)
      @searches.should include(@three)
      @searches.should_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)
      @searches.length.should == 2
      @searches.should include(@one)
      @searches.should include(@three)      
    end
    
    it "should not fetch any searches if there is no history" do
      session[:history] = []
      get :index
      @searches = assigns(:searches)
      @searches.length.should == 0
    end
  end



end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
blacklight-3.6.1.1 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.6.0 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.5.0 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.4.2 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.4.1 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.4.0 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.3.2 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.3.1 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.3.0 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.2.2 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.2.1 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.2.0 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.2.0pre2 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.2.0pre1 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.1.2 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.1.1 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.1.0 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.0.0 test_support/spec/controllers/search_history_controller_spec.rb
blacklight-3.0.0pre8 test_support/spec/controllers/search_history_controller_spec.rb