aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activesupport/test/core_ext/blank_test.rb35
1 files changed, 33 insertions, 2 deletions
diff --git a/activesupport/test/core_ext/blank_test.rb b/activesupport/test/core_ext/blank_test.rb
index 76a0b39978..a14edf440b 100644
--- a/activesupport/test/core_ext/blank_test.rb
+++ b/activesupport/test/core_ext/blank_test.rb
@@ -1,8 +1,39 @@
require File.dirname(__FILE__) + '/../abstract_unit'
+class EmptyTrue
+ def empty?() true; end
+end
+
+class EmptyFalse
+ def empty?() false; end
+end
+
+class EmptyStripNotEmpty
+ def empty?() true; end
+ def strip() 'foo'; end
+end
+
+class EmptyStripEmpty
+ def empty?() true; end
+ def strip() ''; end
+end
+
+class NotEmptyStripNotEmpty
+ def empty?() false; end
+ def strip() 'foo'; end
+end
+
+class NotEmptyStripEmpty
+ def empty?() false; end
+ def strip() ''; end
+end
+
class BlankTest < Test::Unit::TestCase
- BLANK = [nil, false, '', ' ', " \n\t \r ", [], {}]
- NOT = [true, 0, 1, 'a', [nil], { nil => 0 }]
+ BLANK = [ EmptyTrue.new, EmptyStripNotEmpty.new, EmptyStripEmpty.new,
+ NotEmptyStripEmpty.new, nil, false, '', ' ', " \n\t \r ",
+ [], {} ]
+ NOT = [ EmptyFalse.new, NotEmptyStripNotEmpty.new, Object.new, true,
+ 0, 1, 'a', [nil], { nil => 0 } ]
class EmptyObject
def empty?