Sha256: 29b60044b6dab1604365e1e4bb0a76b71fc4475f8fddcf5ccc6c1efe0ec27333

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

covers 'facets/kernel/blank'

# NOTE: Using x.assert.blank? here caused AE some issues
# b/c of problems with Assertor. Basically Assertor needs
# to subclass BasicObject, but Ruby 1.9 has constant lookup
# issues with BasicObject that need address. So in this case
# we'll just use the old-school `assert foo` syntax.

testcase Kernel do

  unit :blank? do
    refute Object.new.blank?
  end

end

testcase NilClass do

  unit :blank? do
    assert nil.blank?
  end

end

testcase FalseClass do

  unit :blank? do
    assert false.blank?
  end

end

testcase TrueClass do

  unit :blank? do
    refute true.blank?
  end

end

testcase Array do

  unit :blank? do
    assert [].blank?
    refute [1].blank?
  end

end

testcase Hash do

  unit :blank? do
    assert( {}.blank? )
    refute( {:a=>1}.blank? )
  end

end

testcase String do

  unit :blank? do
    refute "xyz".blank?
    assert "   ".blank?
  end

end

testcase Numeric do

  unit :blank? do
    refute 0.blank?
  end

  unit :blank? do
    refute 10.blank?
  end

  unit :blank? do
    refute 10.0.blank?
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facets-2.9.1 test/core/kernel/test_blank.rb
facets-2.9.0 test/core/kernel/test_blank.rb
facets-2.9.0.pre.2 test/core/kernel/test_blank.rb
facets-2.9.0.pre.1 test/core/kernel/test_blank.rb