Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove depreciated Hyrax::SolrQueryBuilderService from tests #6396

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove depreciated Hyrax::SolrQueryBuilderService from tests
  • Loading branch information
rawOrlando committed Nov 29, 2023
commit 62e9daeefecb6cebf05b26ff1b1bfcf97b04be77
19 changes: 18 additions & 1 deletion spec/search_builders/hyrax/my/find_works_search_builder_spec.rb
Original file line number Diff line number Diff line change
@@ -30,18 +30,35 @@

it "is successful" do
subject
expect(solr_params[:fq]).to eq ["-" + Hyrax::SolrQueryBuilderService.construct_query_for_ids([work.id])]
expect(solr_params[:fq]).to eq ["-" + Hyrax::SolrQueryService.new.with_ids(ids: [work.id]).build]
end
end

describe "#show_only_works_not_child" do
subject { builder.show_only_works_not_child(solr_params) }

it "is successful" do
subject
ids = Hyrax::SolrService.query("{!field f=id}#{work.id}", fl: "member_ids_ssim").flat_map { |x| x.fetch("member_ids_ssim", []) }
expect(solr_params[:fq]).to eq ["-" + Hyrax::SolrQueryService.new.with_ids(ids: [ids]).build]
end

it "is successful old way" do
subject
ids = Hyrax::SolrService.query("{!field f=id}#{work.id}", fl: "member_ids_ssim").flat_map { |x| x.fetch("member_ids_ssim", []) }
expect(solr_params[:fq]).to eq ["-" + Hyrax::SolrQueryBuilderService.construct_query_for_ids([ids])]
end

it "is successful new same code way" do
subject
ids = Hyrax::SolrService.query("{!field f=id}#{work.id}", fl: "member_ids_ssim").flat_map { |x| x.fetch("member_ids_ssim", []) }
ids = [ids]
ids = ids.reject(&:blank?)
if ids.empty?
ids = "id:NEVER_USE_THIS_ID"
end
expect(solr_params[:fq]).to eq ["-" + Hyrax::SolrQueryService.new.with_ids(ids: ids).build]
end
end

describe "#show_only_works_not_parent" do