Skip to content

Archival exceptions should not be swallowed during testing #50

Description

@esquivalient

The current implementation of #handle_archival_action_exception translates all exceptions to an ActiveRecord::Rollback exception. If archiving fails because of an exception, the only information return is 'false'. There are some log lines in that method that look like they intend to provide more information, but those log messages were not added to the test log in a recent Rails 7 project.

I think this situation can be replicated by making a model with a bogus relationship, like

class Foo < ApplicationRecord
  acts_as_archival
  has_many :bar
end

where the project does not have a Bar model. So, calling archive on an instance of Foo like

test = Foo.first
test.archive! #=> false

Debugging in the run_callbacks will show the failure is about failing to find the Bar class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions