Permalink
Browse files

Fix tests, when creating rescue handler, we need to check for arity now

Before it was handled by Proc.bind, but since Proc.bind has been
deprecated, this is no longer the case and returned handler
needs to match rescuer.
  • Loading branch information...
1 parent 39961f8 commit d1887d384a4038d67bcad50a46a6dc67abfebe04 @drogus drogus committed Mar 23, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 activesupport/lib/active_support/rescuable.rb
@@ -108,7 +108,11 @@ def handler_for_rescue(exception)
when Symbol
method(rescuer)
when Proc
- Proc.new { |*args| instance_exec(*args, &rescuer) }
+ if rescuer.arity == 0
+ Proc.new { instance_exec(&rescuer) }
+ else
+ Proc.new { |exception| instance_exec(exception, &rescuer) }
+ end
end
end
end

0 comments on commit d1887d3

Please sign in to comment.