Sha256: 726b37eee7ad666c11a6f9d9b7d9d3e0d564ea4acd9203203ff5b6aafa7ba0c0

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

require 'helper'

class TestBlobject < Test::Unit::TestCase
  should "not be empty? if the blobject has data" do
    b = Blobject.new
    b.data = 'LOOK! some data. :)'
    assert !b.empty?
  end
  
  should "not be empty if the blobject complex with real data" do
    b = Blobject.new
    b.colors.red = '#ff0000'
    assert !b.empty?
  end
  
  should 'report empty when there are no descendants' do
    assert Blobject.new.empty?
  end
  
  should 'report empty? as true when descendants are empty Hash, Array or Blobjects' do
    b = Blobject.new
    b.array = []
    b.hash = {}
    b.blobject = Blobject.new
    assert b.empty?
  end
  
  should 'report empty? as false when descendants include a non-empty Array' do
    b = Blobject.new
    b.array = [1,2,3,4,5]
    assert !b.empty?
  end
  
  should 'report empty? as false when descendants include a non-empty Hash' do
    b = Blobject.new
    b.hash = {:key1 => 1, :key2 =>2, :key3 => 3}
    assert !b.empty?
  end
  
  should 'report empty? as false when descendants include a non-empty Blobject' do
    b = Blobject.new
    b.blobject = Blobject.new :initial_data => [1,2,3]
    assert !b.empty?
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blobject-0.1.5 test/test_blobject.rb
blobject-0.1.4 test/test_blobject.rb
blobject-0.1.3 test/test_blobject.rb
blobject-0.1.2 test/test_blobject.rb
blobject-0.1.1 test/test_blobject.rb