[Nitro] Nitro/OG spec questions

Mark Van De Vyver mvyver at gmail.com
Fri Sep 7 09:09:42 EDT 2007


Hi Devs,
In case any one is interested, it seems what I really wanted to do
isn't so straight forward...
Essentially, that is something like: delete a class.
The following is an old thread, 2002, but I've not yet seen anything
setting out how this can be done in a straight forward manner:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/58851

For what it is worth If I use :
it do
@manager=Og.start
@manager.should be_an_instance_of(Og::Manager)
end

Several such specs pass, so then I add:

after(:each) do
@manager.store.disconnect
Object.module_eval { remove_const '@manager' }
end

and the spec fails.

I get same result (failing spec) using the approach set out in
./og/.old_test/spec, i.e.

  after(:each) do
      @manager.store.disconnect
      #Object.module_eval { remove_const '@manager' }
      OgSpecHelper.stop(@manager)
  end

where:

module OgSpecHelper
  class << self
    def stop(manager)
        manager.close_store
        manager.unmanage_classes
     end
  end
end

I think I'm going to have to work a different way... unless there is
something obvious I'm missing or doing wrong?

Mark


On 9/7/07, Mark Van De Vyver <mvyver at gmail.com> wrote:
> Hi Gabrielle,
>
> On 9/7/07, gabriele renzi <rff_rff at yahoo.it> wrote:
> > On Fri, 07 Sep 2007 18:35:14 +1000, Mark Van De Vyver wrote:
> >
> > > I'm not familiar with the spec infrastructure - I assume starting a
> > > spec in a new file ensure your starting 'from-scratch'?  Have I missed
> > > something obvious?
> >
> > AFAIK all specs are loaded together, so even sticking to single spec per
> > source is not useful but see later.
>
> Thanks. Good to know.
>
> > > Choices:
> > > stick with single spec file per source, and just wrestle (and cross
> > > fingers). split the sources and maintain on spec file per source file
> > > (may/ may not fully solve the issue?).
> > > adopt some convention for multiple spec files per source (pointless if
> > > this doesn't over come the above problem).
> > >
> > > Comments/thoughts/tips?
> >
> > use
> >  before {block}
> >  after {block}
> > for setup something between every "it" and
> >  before :all {}
> >  after :all {}
> > for whole-spec setup/teardown
> >
> > i.e. I have tests like
> >
> > describe "foo" do
> >  before :all { Og.setup(:dbfile=>'test.db' }    #run at the start of spec
> >
> >  after { Foo.delete_all }                       #run between every spec
> >
> >  it 'should create XYZ" {Foo.create("arg"); Foo.count.should == 1}
> >
> >  after :all {File.delete('test.db') }           #run at end for cleanup
> > end
> >
> > This is general good practice for tests.
>
> Thanks much appreciated.
> Regards
> Mark
>
> >
> >
> > --
> > goto 10: http://www.goto10.it
> > blog it: http://riffraff.blogsome.com
> > blog en: http://www.riffraff.info
> >
> > _______________________________________________
> > Nitro-general mailing list
> > Nitro-general at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/nitro-general
> >
>


More information about the Nitro-general mailing list