Permalink
Browse files

fixing infinite loop in blank slate

git-svn-id: http://expectations.rubyforge.org/svn/trunk@65 6f265639-962f-4d85-a13b-3090ac0aa348
  • Loading branch information...
1 parent b7cb465 commit aa306ab29e62b34cff8c56c7a572bc56589fbf9e jaycfields committed Mar 28, 2008
Showing with 7 additions and 8 deletions.
  1. +6 −7 lib/expectations/blank_slate.rb
  2. +1 −1 rakefile.rb
@@ -58,12 +58,11 @@ def reveal(name)
#
module Kernel
class << self
- alias_method :blank_slate_method_added, :method_added
-
# Detect method additions to Kernel and remove them in the
# BlankSlate class.
- def method_added(name)
- result = blank_slate_method_added(name)
+ unbound_method = method(:method_added)
+ define_method :method_added do |name|
+ result = unbound_method.call(name)
return result if self != Kernel
BlankSlate.hide(name)
result
@@ -100,9 +99,9 @@ def find_hidden_method(name)
# exposed in the first place.
#
class Module
- alias blankslate_original_append_features append_features
- def append_features(mod)
- result = blankslate_original_append_features(mod)
+ unbound_method = instance_method(:append_features)
+ define_method :append_features do |mod|
+ result = unbound_method.bind(self).call(mod)
return result if mod != Object
instance_methods.each do |name|
BlankSlate.hide(name)
View
@@ -46,7 +46,7 @@
expect NoMethodError do
Object.invalid_method_call
end."
- s.version = "0.2.5"
+ s.version = "0.2.6"
s.author = 'Jay Fields'
s.description = "A lightweight unit testing framework. Tests (expectations) will be written as follows
expect 2 do

0 comments on commit aa306ab

Please sign in to comment.