Sha256: e7e36a3fd98e148aabdcf45bb70a97aaa51162d33c86f9a1730e53e6685d062d
Contents?: true
Size: 1.45 KB
Versions: 20
Compression:
Stored size: 1.45 KB
Contents
require 'spec_helper' describe Hydra::Collections::SearchService do before do @login = 'vanessa' @session = {:history => [17, 14, 12, 9]} @service = Hydra::Collections::SearchService.new(@session, @login) end it "should get the documents for the first history entry" do expect(Search).to receive(:find).with(17).and_return(Search.new(:query_params=>{:q=>"World Peace"})) expect(@service).to receive(:get_search_results).and_return([:one, [:doc1, :doc2]]) expect(@service.last_search_documents).to eq([:doc1, :doc2]) end describe 'apply_gated_search' do before(:each) do allow(RoleMapper).to receive(:roles).with(@login).and_return(['umg/test.group.1']) params = @service.apply_gated_search({}, {}) @group_query = params[:fq].first.split(' OR ')[1] end it "should escape slashes in groups" do expect(@group_query).to eq('edit_access_group_ssim:umg\/test.group.1') end it "should allow overriding Solr's access control suffix" do module Hydra module Collections class SearchService def solr_access_control_suffix(key) "edit_#{key}_customfield" end end end end @service = Hydra::Collections::SearchService.new({}, '') params = @service.apply_gated_search({}, {}) @public_query = params[:fq].first.split(' OR ')[0] expect(@public_query).to eq('edit_group_customfield:public') end end end
Version data entries
20 entries across 20 versions & 1 rubygems