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
I'm trying to spy on a method that is expecting to receive an ::ActionController::Parameters object. While hash-like, it's not a hash anymore in Rails, and hasn't been for a while
is calling ** on the last parameter, trying to un-double-splat it. That fails, since ::ActionController::Parameters doesn't let you convert to a hash unless you first called permit (you get an error of):
ActionController::UnfilteredParameters: ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash
Normally, requiring permitted parameters is 100% the right and secure thing to do, but I am trying to pass the parameter object explicitly to this sub method (and spy on it for testing) for logging purposes, and I want to get the original values, so don't want to permit the parameters in my higher-level code.
Is there a workaround? This worked in Spy 1.3, but failing in Spy 1.4 and 1.5
The text was updated successfully, but these errors were encountered:
I'm trying to spy on a method that is expecting to receive an ::ActionController::Parameters object. While hash-like, it's not a hash anymore in Rails, and hasn't been for a while
However, the spy code here: and related
https://github.com/ryanong/spy/blob/master/lib/spy/subroutine.rb#L246-L248
is calling ** on the last parameter, trying to un-double-splat it. That fails, since ::ActionController::Parameters doesn't let you convert to a hash unless you first called permit (you get an error of):
ActionController::UnfilteredParameters: ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash
Normally, requiring permitted parameters is 100% the right and secure thing to do, but I am trying to pass the parameter object explicitly to this sub method (and spy on it for testing) for logging purposes, and I want to get the original values, so don't want to permit the parameters in my higher-level code.
Is there a workaround? This worked in Spy 1.3, but failing in Spy 1.4 and 1.5
The text was updated successfully, but these errors were encountered: