Skip to content

Commit

Permalink
Merge pull request #6423 from samvera/abel-fix_search_spec.rb
Browse files Browse the repository at this point in the history
Fix search_spec.rb
  • Loading branch information
dlpierce authored Nov 8, 2023
2 parents eaf4a05 + 39ace50 commit ed267be
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 74 deletions.
32 changes: 26 additions & 6 deletions spec/features/search_spec.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
# frozen_string_literal: true
RSpec.describe 'searching' do

RSpec.shared_examples "search functionality" do |_adapter|
let(:user) { create :user }
let(:subject_value) { 'mustache' }
let!(:work) do
create(:public_work,
title: ["Toothbrush"],
keyword: [subject_value, 'taco'],
user: user)
if Hyrax.config.use_valkyrie?
FactoryBot.valkyrie_create(:monograph, :public, title: ["Toothbrush"], keyword: [subject_value, 'taco'])
else
create(:public_work, title: ["Toothbrush"], keyword: [subject_value, 'taco'], user: user)
end
end

let!(:collection) do
create(:public_collection_lw, title: ['collection title abc'], description: [subject_value], user: user, members: [work])
if Hyrax.config.use_valkyrie?
FactoryBot.valkyrie_create(:collection_resource, :public, title: ['collection title abc'], creator: user.email, description: [subject_value], members: [work])
else
create(:public_collection_lw, title: ['collection title abc'], description: [subject_value], user: user, members: [work])
end
end

before do
allow(Hyrax.config).to receive(:collection_model).and_return('CollectionResource') if Hyrax.config.use_valkyrie?
end

context "as a public user", :clean_repo do
Expand Down Expand Up @@ -61,3 +71,13 @@
end
end
end

RSpec.describe 'Searching' do
context "when Valkyrie is not used" do
include_examples "search functionality"
end

context "when Valkyrie is used" do
include_examples "search functionality", index_adapter: :solr_index, valkyrie_adapter: :test_adapter
end
end
68 changes: 0 additions & 68 deletions spec/features/valkyrie_search_spec.rb

This file was deleted.

0 comments on commit ed267be

Please sign in to comment.