You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The 7.0 version of RSpec Rails introduced #2745 by @odlp which is overall a great addition, but doesn't provide a configuration to disable this check.
This is a problem for one of our app that uses before_enqueue and around_perform callbacks that modifies the arguments passed to the job.
Describe the solution you'd like
I would like a way to disable this check.
Describe alternatives you've considered
I'm not sure there are other solutions short of updating all the jobs in our app.
Additional context
Here are the callbacks being used:
classApplicationJob < ActiveJob::Base# Automatically retry jobs that encountered a deadlock# retry_on ActiveRecord::Deadlocked# Most jobs are safe to ignore if the underlying records are no longer availablediscard_onActiveJob::DeserializationErrorbefore_enqueuedo |job|
ifActor.current?job.arguments << {actor: Actor.current}endendaround_performdo |job,block|
arg=job.arguments.find{ |a| a.is_a?(Hash) && a.key?(:actor)}ifargjob.arguments.delete(arg)actor=arg[:actor]endifactorActor.with(actor)doblock.callendelseblock.callendendend
The text was updated successfully, but these errors were encountered:
Sorry to hear the signature-match check is causing issues for you both – adding an escape hatch sounds reasonable.
FWIW one can also store arbitrary data on an ActiveJob job by overriding #serialize and #deserialize to store/retrieve an extra value on the job payload hash. This would allow you to avoid adding then deleting a job argument, and allow the signature-match check to pass.
So in the example above you'd override #serialize to store the actor, #deserialize to populate an @actor instance variable, which can then be referenced in your around_perform hook...
Is your feature request related to a problem? Please describe.
The 7.0 version of RSpec Rails introduced #2745 by @odlp which is overall a great addition, but doesn't provide a configuration to disable this check.
This is a problem for one of our app that uses
before_enqueue
andaround_perform
callbacks that modifies the arguments passed to the job.Describe the solution you'd like
I would like a way to disable this check.
Describe alternatives you've considered
I'm not sure there are other solutions short of updating all the jobs in our app.
Additional context
Here are the callbacks being used:
The text was updated successfully, but these errors were encountered: