Sha256: e47d378fd95abb2b593f3d01b03f6ade8227a1456d20d6eef348d6bd1b2eb8e6

Contents?: true

Size: 1.31 KB

Versions: 54

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

describe CurationConcerns::Collections::SearchService do
  before do
    @login = 'vanessa'
    @session = { history: [17, 14, 12, 9] }
    @service = described_class.new(@session, @login)
  end

  it "gets 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 "escapes slashes in groups" do
      expect(@group_query).to eq('edit_access_group_ssim:umg\/test.group.1')
    end
    it "allows overriding Solr's access control suffix" do
      allow_any_instance_of(described_class).to receive(:solr_access_control_suffix).and_return("edit_group_customfield")
      @service = described_class.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

54 entries across 54 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.7.7 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-2.0.0 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-2.0.0.rc2 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.7.6 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.7.5 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.7.4 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.7.3 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.7.2 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-2.0.0.rc1 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.7.1 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.7.0 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.7.0.beta1 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.6.3 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.6.2 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.6.1 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.6.0 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.5.0 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.4.0 spec/lib/curation_concerns/collections/search_service_spec.rb
curation_concerns-1.3.3 spec/lib/curation_concerns/collections/search_service_spec.rb