Skip to content

Commit

Permalink
Improve tests (closes #7166) [zackchandler]
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7582 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Sep 22, 2007
1 parent f0dc277 commit 953de11
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions activesupport/test/core_ext/blank_test.rb
Original file line number Diff line number Diff line change
@@ -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?
Expand Down

0 comments on commit 953de11

Please sign in to comment.