[Needle] (Newbie?) problem with overriding in child container

Ryan Platte ryan.platte at pobox.com
Wed Aug 24 12:16:11 EDT 2005

Hello, I began using Needle yesterday, and I'm liking it.

I'm stumbling on something I must be missing. I've tried several  
different approaches to working around the problem in case there was  
a bug, but whatever's wrong with me or Needle is more fundamental  
than the places I looked.

The following test fails because the actual value examined is class  
Foo at runtime. Help?:

require 'test/unit'
require 'rubygems'
require 'needle'

class NeedleParentProblemTest < Test::Unit::TestCase

   class Foo; end
   class Bar; end

   def test_child_container_can_override_properly
     parent_registry = Needle::Registry.define! {
       the_class { Foo }
       the_object { |c, p| c.the_class.new }
     child_container = Needle::Container.new(parent_registry)
     child_container.define! {
       the_class { Bar }
     assert_same(Bar, child_container.the_object.class)


Ryan Platte

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2371 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/needle-discuss/attachments/20050824/3982e372/smime.bin

More information about the Needle-discuss mailing list