Permalink
Browse files

SafeBuffer#gsub test still failing for $1

* ensured the block is passed, refactor test so can't be mislead if block never called
  • Loading branch information...
1 parent 21054bd commit 62e2818c44cc38240de457236f76830936b2c42d @tardate committed Jun 14, 2011
@@ -129,8 +129,8 @@ def #{unsafe_method}!(*args)
#
# If you really need the magic matching variables after the gsub call
# you will need to convert SafeBuffer to a String first
- def gsub(*args)
- to_str.gsub(*args)
+ def gsub(*args, &block)
+ to_str.gsub(*args, &block)
end
end
end
@@ -54,7 +54,9 @@ def setup
test "Should set magic match variables within block passed to gsub" do
'burn'[/(matches)/]
@buffer << 'swan'
- @buffer.gsub(/(swan)/) { assert_equal 'swan', $1 }
+ result = nil
+ @buffer.gsub(/(swan)/) { result = $1 }
+ assert_equal 'swan', result, "dang it, still not working"
end
test "Should not expect magic match variables after gsub call" do

0 comments on commit 62e2818

Please sign in to comment.