From: Robert Klemme Date: 2009-12-30T20:01:20+09:00 Subject: Re: Using #include at the instance level? 2009/12/29 Intransition : > > On Dec 29, 3:16 pm, Robert Klemme wrote: >> I believe you haven't yet fully analyzed the problem you want to >> solve.  I suggest to put it to sleep for a while and then get back >> later to it.  I can't help you any more because to me it is not clear >> what you are trying to achieve.  So far we only went through technical >> issues but the problem you are trying to solve isn't cleat to me yet. > > All I am trying to do is emulate test/unit but using a DSL. > Essentially: > >  class MyTest < Test::Unit::TestCase > >    include M > >    def test_N_n1 >       assert_equal(N.n1, "n1") >     end > >  end > > Becomes: > >  testcase :MyTest do > >    include M > >    testunit :N_n1 do >       assert_equal(N.n1, "n1") >     end > >  end > > That's it. But I can't do it exactly b/c I can't make the include > work. Ah, now I see. I believe your problem comes from the fact that you are mixing two styles: DSL and "regular" Ruby. If you integrate defining those modules into your DSL (i.e. not via "module ... end") then integrating lookups might be easier as well. I don't have a clear idea yet how to do that but maybe it's worth exploring. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/