Sha256: d2dab63e0431a710f5a05b2f2452453d25739b56a67707d0548325c032838444

Contents?: true

Size: 1.1 KB

Versions: 9

Compression:

Stored size: 1.1 KB

Contents

describe Hyrax::MySharesSearchBuilder do
  let(:me) { create(:user) }
  let(:config) { CatalogController.blacklight_config }
  let(:scope) do
    double('The scope',
           blacklight_config: config,
           params: {},
           current_ability: Ability.new(me),
           current_user: me)
  end
  let(:builder) { described_class.new(scope) }

  before do
    allow(builder).to receive(:gated_discovery_filters).and_return(["access_filter1", "access_filter2"])

    # This prevents any generated classes from interfering with this test:
    allow(builder).to receive(:work_classes).and_return([GenericWork])

    allow(ActiveFedora::SolrQueryBuilder).to receive(:construct_query_for_rel)
      .with(depositor: me.user_key)
      .and_return("depositor")
  end

  subject { builder.to_hash['fq'] }

  it "filters things we have access to in which we are not the depositor" do
    expect(subject).to eq ["access_filter1 OR access_filter2",
                           "{!terms f=has_model_ssim}GenericWork,Collection",
                           "-suppressed_bsi:true",
                           "-depositor"]
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hyrax-1.1.1 spec/search_builder/hyrax/my_shares_search_builder_spec.rb
hyrax-1.1.0 spec/search_builder/hyrax/my_shares_search_builder_spec.rb
hyrax-1.0.5 spec/search_builder/hyrax/my_shares_search_builder_spec.rb
hyrax-1.0.4 spec/search_builder/hyrax/my_shares_search_builder_spec.rb
hyrax-1.0.3 spec/search_builder/hyrax/my_shares_search_builder_spec.rb
hyrax-1.0.2 spec/search_builder/hyrax/my_shares_search_builder_spec.rb
hyrax-1.0.1 spec/search_builder/hyrax/my_shares_search_builder_spec.rb
hyrax-1.0.0.rc2 spec/search_builder/hyrax/my_shares_search_builder_spec.rb
hyrax-1.0.0.rc1 spec/search_builder/hyrax/my_shares_search_builder_spec.rb