Sha256: c7d4916e5728384edf0a64d2380963fd71ed925e730e21be86d8328875a41263
Contents?: true
Size: 1.9 KB
Versions: 1
Compression:
Stored size: 1.9 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/registry' require 'test/unit' class TC_Registry < Test::Unit::TestCase def setup @registry = Needle::Registry.new end def test_bootstrap assert_respond_to @registry, :service_models assert_instance_of Hash, @registry.service_models assert_equal 12, @registry.service_models.length end def test_new_no_options! reg = Needle::Registry.new! do svc1 { Object.new } end assert_respond_to reg, :svc1 end def test_new_with_options! reg = Needle::Registry.new!( :logs => { :device => STDOUT } ) do svc1 { Object.new } end assert_respond_to reg, :svc1 assert_equal STDOUT, reg.logs.device end def test_new_no_options reg = Needle::Registry.new do |r| r.register( :svc ) { Object.new } end assert_respond_to reg, :svc end def test_new_with_options reg = Needle::Registry.new( :logs => { :device => STDOUT } ) do |r| r.register( :svc ) { Object.new } end assert_respond_to reg, :svc assert_equal STDOUT, reg.logs.device end def test_fullname assert_equal "[]", @registry.fullname end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
needle-0.6.0 | test/tc_registry.rb |