Browse files

just yield if possible (saves creating Proc object)

  • Loading branch information...
1 parent cfb3b54 commit cd9185712375e7f81ac70531c681c1fa71a25a3e @dchelimsky dchelimsky committed Nov 14, 2010
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/rspec/core/example.rb
View
8 lib/rspec/core/example.rb
@@ -75,8 +75,12 @@ def with_pending_capture
end
end
- def with_around_hooks(&wrapped_example)
- @example_group_class.eval_around_eachs(@example_group_instance, wrapped_example).call
+ def with_around_hooks
+ if @example_group_class.around_hooks.empty?
+ yield
+ else
+ @example_group_class.eval_around_eachs(@example_group_instance, Proc.new).call
+ end
end
def start(reporter)

0 comments on commit cd91857

Please sign in to comment.