Sha256: a29c902cbf010a9f1bae0d1b7a0b3c20b0c90f16fda639a9fb3a08e7448493fd

Contents?: true

Size: 1.37 KB

Versions: 28

Compression:

Stored size: 1.37 KB

Contents

require "#{File.dirname(__FILE__)}/../../test_helper"

class ObjectTest < Test::Unit::TestCase
  context "object" do
    setup do
      clear!
    end
    context "global methods" do
      setup do
        @o = Object.new
      end
      
      should "have the clouds method" do      
        assert @o.respond_to?(:clouds)
        assert_equal Hash, @o.clouds.class
      end
      
      should "have the pools method" do
        assert @o.respond_to?(:pools)
        assert_equal Hash, @o.pools.class
      end
      
      should "make a pool when calling pool" do
        assert_nil @o.pools[:fun_pool]
        @pool = @o.pool :fun_pool do
        end
        assert_not_nil @o.pools["fun_pool"]
        assert_equal @pool, @o.pools["fun_pool"]
      end
      
      should "throw an error if the method pool for creation is given without a block" do
        PoolParty::PoolPartyError.create("PoolError")
        assert_raise PoolError do
          @o.pool :banks
        end
      end
      
      context "do_once" do
        should "have run_procs" do
          assert_equal Array, @o.run_procs.class
          assert_equal [], @o.run_procs
        end
        
        should "insert the block into the runprocs" do
          @proc = Proc.new {}
          @o.do_once &@proc
          assert_equal [@proc.to_s], @o.run_procs
        end
      end
      
      
    end
    
    
  end
  
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
auser-poolparty-1.3.0 test/lib/core/object_test.rb
auser-poolparty-1.3.1 test/lib/core/object_test.rb
auser-poolparty-1.3.10 test/lib/core/object_test.rb
auser-poolparty-1.3.11 test/lib/core/object_test.rb
auser-poolparty-1.3.12 test/lib/core/object_test.rb
auser-poolparty-1.3.13 test/lib/core/object_test.rb
auser-poolparty-1.3.14 test/lib/core/object_test.rb
auser-poolparty-1.3.15 test/lib/core/object_test.rb
auser-poolparty-1.3.16 test/lib/core/object_test.rb
auser-poolparty-1.3.17 test/lib/core/object_test.rb
auser-poolparty-1.3.2 test/lib/core/object_test.rb
auser-poolparty-1.3.3 test/lib/core/object_test.rb
auser-poolparty-1.3.4 test/lib/core/object_test.rb
auser-poolparty-1.3.5 test/lib/core/object_test.rb
auser-poolparty-1.3.6 test/lib/core/object_test.rb
auser-poolparty-1.3.7 test/lib/core/object_test.rb
auser-poolparty-1.3.8 test/lib/core/object_test.rb
fairchild-poolparty-1.3.17 test/lib/core/object_test.rb
fairchild-poolparty-1.3.5 test/lib/core/object_test.rb
poolparty-1.3.15 test/lib/core/object_test.rb