[Nitro] Nitro/OG spec questions

Mark Van De Vyver mvyver at gmail.com
Sat Sep 8 07:27:40 EDT 2007


Hi Gabrielle

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

Sorry for being a bit slow on the up-take, I was not clear that wanted
to delete the manger between specs :-)
I now see that store and model have this `delete_all` method.

I didn't fully appreciate your tip at the time. Thanks for the insight.

Cheers
Mark

> >  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