Sha256: 46479efdd6f44e5e01b45ae237673db2c20c70419fa2616204a6b082cbb56ea3
Contents?: true
Size: 1.58 KB
Versions: 1
Compression:
Stored size: 1.58 KB
Contents
#-- # ============================================================================= # Copyright (c) 2004, Jamis Buck (jgb3@email.byu.edu) # All rights reserved. # # This source file is distributed as part of the Needle dependency injection # library for Ruby. This file (and the library as a whole) may be used only as # allowed by either the BSD license, or the Ruby license (or, by association # with the Ruby license, the GPL). See the "doc" subdirectory of the Needle # distribution for the texts of these licenses. # ----------------------------------------------------------------------------- # needle website : http://needle.rubyforge.org # project website: http://rubyforge.org/projects/needle # ============================================================================= #++ $:.unshift "../../lib" require "needle/models/prototype-deferred" require "test/unit" class TC_ModelsPrototypeDeferred < Test::Unit::TestCase def test_instance instantiated = false model = Needle::Models::PrototypeDeferred.new( nil ) { instantiated = true Hash.new } assert !instantiated proto = model.instance assert !instantiated proto[:test] = :value assert instantiated assert_equal :value, proto[:test] end def test_container model = Needle::Models::PrototypeDeferred.new( :container ) { |c| assert_equal :container, c Hash.new } model.instance[:test] = :value end def test_model model = Needle::Models::PrototypeDeferred.new( nil ) { Hash.new } p1 = model.instance p2 = model.instance assert_not_same p1, p2 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
needle-0.5.0 | test/models/tc_prototype_deferred.rb |