aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/blank_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext/blank_test.rb')
-rw-r--r--activesupport/test/core_ext/blank_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/blank_test.rb b/activesupport/test/core_ext/blank_test.rb
index 0fce470fd5..76a0b39978 100644
--- a/activesupport/test/core_ext/blank_test.rb
+++ b/activesupport/test/core_ext/blank_test.rb
@@ -3,9 +3,21 @@ require File.dirname(__FILE__) + '/../abstract_unit'
class BlankTest < Test::Unit::TestCase
BLANK = [nil, false, '', ' ', " \n\t \r ", [], {}]
NOT = [true, 0, 1, 'a', [nil], { nil => 0 }]
+
+ class EmptyObject
+ def empty?
+ true
+ end
+ alias :strip :empty?
+ end
+ class NoStripObject < EmptyObject; undef :strip; end
+ class NoEmptyStripObject < NoStripObject; undef :empty?; end
def test_blank
BLANK.each { |v| assert v.blank? }
NOT.each { |v| assert !v.blank? }
+ assert EmptyObject.new.blank?
+ assert NoStripObject.new.blank?
+ assert !NoEmptyStripObject.new.blank?
end
end