[rspec-users] Can module spec use fixtures?

Luis Lavena luislavena at gmail.com
Wed Aug 22 20:37:00 EDT 2007


On 8/22/07, Shaker <flyeminent at hotmail.com> wrote:
>
> Good morning, dear fellows:
>     I'd like to recall one question I posted yesterday. I am writing specs
> for ruby modules. Some of the modules do some data process in the test
> database. Because 'fixtures' is undefined (Am I correct?) in module specs,
> spec of certain module (e.g. delete data form database) will affect other
> specs of other modules (e.g. try to access the deleted data). My observation
> is all the modules specs share only a copy of test data.
>     If I am correct, are there any way of avoiding this, and providing a
> copy of initial test data (like fixtures do) for each module spec?

I'll like to ask you if the "feature" you have implemented inside
those modules is related to a model (I guess).

So, shouldn't be better describe the specs for your model in that
specified context, make it shared and later do it_should_behave_like
'...' ?

As previous discussed inthe list, creating specs for especific
functionality (like the acts_as_list thread) will make your specs
brittle.

Expecting results (which the aim of BDD) is more helpful.

Or maybe I'm wrong (as usual) and don't get the picture ;-)

-- 
Luis Lavena
Multimedia systems
-
Leaders are made, they are not born. They are made by hard effort,
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi


More information about the rspec-users mailing list