Sha256: 34fa689ef88185c7cfb49840ea92d54d6e13804f37dd936685baeb39f8717dda
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 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" require "test/unit" class TC_ModelsPrototype < Test::Unit::TestCase def test_instance instantiated = false model = Needle::Models::Prototype.new( nil ) { instantiated = true Hash.new } assert !instantiated proto = model.instance assert instantiated proto[:test] = :value assert_equal :value, proto[:test] end def test_container model = Needle::Models::Prototype.new( :container ) { |c| assert_equal :container, c Hash.new } model.instance end def test_model model = Needle::Models::Prototype.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.rb |