Skip to content

Commit

Permalink
Merge pull request #5562 from samvera/clipped_wings
Browse files Browse the repository at this point in the history
Disable wings when testing with a different valkyrie adapter
  • Loading branch information
cjcolvar authored Mar 22, 2022
2 parents e3ed472 + 789ddd1 commit 4366714
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion spec/models/hyrax/permission_template_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
end
end

describe "#source_model" do
describe "#source_model", valkyrie_adapter: :wings_adapter do
context 'when source is an AdminSet' do
let(:admin_set) { FactoryBot.create(:admin_set) }
let(:attributes) { { source_id: admin_set.id } }
Expand Down
14 changes: 11 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ def clean_active_fedora_repository

config.before(:each, type: :feature) do |example|
clean_active_fedora_repository unless
example.metadata[:clean_repo] # trust clean_repo if present
# trust that clean_repo performed the clean if present
example.metadata[:clean_repo] ||
# don't run for adapters other than wings
(example.metadata[:valkyrie_adapter].present? && example.metadata[:valkyrie_adapter] != :wings_adapter)
end

config.after(:each, type: :feature) do
Expand Down Expand Up @@ -249,9 +252,9 @@ def clean_active_fedora_repository
config.profile_examples = 10

config.before(:example, :clean_repo) do
clean_active_fedora_repository
Hyrax::RedisEventStore.instance.redis.flushdb
clean_active_fedora_repository unless Hyrax.config.disable_wings

Hyrax::RedisEventStore.instance.redis.flushdb
# Not needed to clean the Solr core used by ActiveFedora since
# clean_active_fedora_repository will wipe that core
Hyrax::SolrService.wipe! if Hyrax.config.query_index_from_valkyrie
Expand Down Expand Up @@ -317,6 +320,11 @@ def clean_active_fedora_repository
allow(Hyrax)
.to receive(:metadata_adapter)
.and_return(Valkyrie::MetadataAdapter.find(adapter_name))

if adapter_name != :wings_adapter
allow(Hyrax.config).to receive(:disable_wings).and_return(true)
hide_const("Wings") # disable_wings=true removes the Wings constant
end
end

# turn on the default nested reindexer; we use a null implementation for most
Expand Down

0 comments on commit 4366714

Please sign in to comment.