From 22653373dc387bded11d438345379b9650365d39 Mon Sep 17 00:00:00 2001 From: Daniel Pierce Date: Fri, 25 Oct 2024 13:35:22 -0400 Subject: [PATCH] Fix incorrect use of block with raise_error This was causing any raised error to be considered a pass, which is clearly not the intent. Fixing this revealed a problem caused by using Valkyrie::Resource directly. Required attributes were missing because they are only defined when the Valkyrie::Resource is inherited. --- .../hyrax/custom_queries/find_access_control_spec.rb | 6 +++--- .../services/custom_queries/find_access_control_spec.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/services/hyrax/custom_queries/find_access_control_spec.rb b/spec/services/hyrax/custom_queries/find_access_control_spec.rb index db514b5795..9144cc1132 100644 --- a/spec/services/hyrax/custom_queries/find_access_control_spec.rb +++ b/spec/services/hyrax/custom_queries/find_access_control_spec.rb @@ -7,11 +7,11 @@ describe '#find_access_control' do context 'for missing object' do - let(:resource) { Valkyrie::Resource.new } + let(:resource) { Hyrax::Resource.new } it 'raises ObjectNotFoundError' do expect { query_handler.find_access_control_for(resource: resource) } - .to raise_error { Valkyrie::Persistence::ObjectNotFoundError } + .to raise_error Valkyrie::Persistence::ObjectNotFoundError end end @@ -50,7 +50,7 @@ it 'raises ObjectNotFoundError' do expect { query_handler.find_access_control_for(resource: resource) } - .to raise_error { Valkyrie::Persistence::ObjectNotFoundError } + .to raise_error Valkyrie::Persistence::ObjectNotFoundError end end end diff --git a/spec/wings/services/custom_queries/find_access_control_spec.rb b/spec/wings/services/custom_queries/find_access_control_spec.rb index 5e52f5ab41..2bb9897fd6 100644 --- a/spec/wings/services/custom_queries/find_access_control_spec.rb +++ b/spec/wings/services/custom_queries/find_access_control_spec.rb @@ -17,7 +17,7 @@ it 'raises ObjectNotFoundError' do expect { query_handler.find_access_control_for(resource: resource) } - .to raise_error { Valkyrie::Persistence::ObjectNotFoundError } + .to raise_error Valkyrie::Persistence::ObjectNotFoundError end end