From cd3b05948479b612eaab552870159a0d26e53ac3 Mon Sep 17 00:00:00 2001 From: LaRita Robinson <laritakr@users.noreply.github.com> Date: Fri, 15 Dec 2023 19:14:28 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Fix=20Hyrax=205=20remaining=20co?= =?UTF-8?q?ntroller=20spec=20failures=20(#2064)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🧹Remove ActiveFedora monkeypatch * 🧹Fix file fixture --- config/initializers/active_fedora_override.rb | 12 ------------ .../hyrax/generic_works_controller_spec.rb | 4 +++- spec/controllers/hyrax/images_controller_spec.rb | 2 +- 3 files changed, 4 insertions(+), 14 deletions(-) delete mode 100644 config/initializers/active_fedora_override.rb diff --git a/config/initializers/active_fedora_override.rb b/config/initializers/active_fedora_override.rb deleted file mode 100644 index e595997ae..000000000 --- a/config/initializers/active_fedora_override.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true -# Based on https://github.com/samvera/hyrax/issues/4581#issuecomment-843085122 - -# Monkey-patch to short circuit ActiveModel::Dirty which attempts to load the whole master files ordered list when calling nodes_will_change! -# This leads to a stack level too deep exception when attempting to delete a master file from a media object on the manage files step. -# See https://github.com/samvera/active_fedora/pull/1312/commits/7c8bbbefdacefd655a2ca653f5950c991e1dc999#diff-28356c4daa0d55cbaf97e4269869f510R100-R103 -ActiveFedora::Aggregation::ListSource.class_eval do - def attribute_will_change!(attr) - return super unless attr == 'nodes' - attributes_changed_by_setter[:nodes] = true - end -end diff --git a/spec/controllers/hyrax/generic_works_controller_spec.rb b/spec/controllers/hyrax/generic_works_controller_spec.rb index 741963ed2..65d075285 100644 --- a/spec/controllers/hyrax/generic_works_controller_spec.rb +++ b/spec/controllers/hyrax/generic_works_controller_spec.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'rails_helper' + RSpec.describe Hyrax::GenericWorksController do let(:user) { FactoryBot.create(:user) } let(:work) { FactoryBot.create(:work_with_one_file, user: user) } @@ -7,7 +9,7 @@ before do Hydra::Works::AddFileToFileSet.call(file_set, - fixture_file('images/world.png'), + fixture_file_upload('images/world.png'), :original_file) end diff --git a/spec/controllers/hyrax/images_controller_spec.rb b/spec/controllers/hyrax/images_controller_spec.rb index e0b2b42b6..06b48c7c4 100644 --- a/spec/controllers/hyrax/images_controller_spec.rb +++ b/spec/controllers/hyrax/images_controller_spec.rb @@ -12,7 +12,7 @@ before do Hydra::Works::AddFileToFileSet.call(file_set, - fixture_file('images/world.png'), + fixture_file_upload('images/world.png'), :original_file) end