Skip to content
Browse files

tweak instance_exec

  • Loading branch information...
1 parent ea852a5 commit bdb79667a5989bd2bc9d55b54f9f0f71817942de @dchelimsky dchelimsky committed Mar 10, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/rspec/matchers/extensions/instance_exec.rb
View
6 lib/rspec/matchers/extensions/instance_exec.rb
@@ -15,14 +15,14 @@ def instance_exec(*args, &block)
orig_critical, Thread.critical = Thread.critical, true
n = 0
n += 1 while respond_to?(method_name="__instance_exec#{n}")
- singleton_class.module_eval{ define_method(:__instance_exec, &block) }
+ singleton_class.module_eval{ define_method(method_name, &block) }
ensure
Thread.critical = orig_critical
end
begin
- return send(:__instance_exec, *args)
+ return send(method_name, *args)
ensure
- singleton_class.module_eval{ remove_method(:__instance_exec) } rescue nil
+ singleton_class.module_eval{ remove_method(method_name) } rescue nil
end
end
end

0 comments on commit bdb7966

Please sign in to comment.
Something went wrong with that request. Please try again.