[rspec-users] Cucumber and fixtures/FixtureReplacement

aslak hellesoy aslak.hellesoy at gmail.com
Tue Sep 9 13:54:03 EDT 2008


On Tue, Sep 9, 2008 at 7:45 PM, Matt Wynne <matt at mattwynne.net> wrote:
> Remember these things should use transactions, and may do that by default -
> the database will be wiped clean once the features have run.
>

FWIW, When Cucumber is used with Rails it runs all scenarios in a transaction.

I haven't tried FixtureReplacement, but it should work just fine in
Given steps. I think you'd just have to make sure you mix in the
FixtureReplacement module in your "world". Put this in your
steps/env.rb and let us know how it works:

Before do
  self.extend(FixtureReplacement)
end

Aslak

> On 9 Sep 2008, at 18:22, Tim Glen wrote:
>
>> Hey guys,
>>
>> I'd never used RSpec Stories before, so I decided to follow the apparent
>> direction of the wind and just jump right into cucumber. I'm dabbling
>> with/using Cucumber and really like it. Good job, aslak!
>>

Thanks!

>> Where i'm struggling right now is using either fixtures or a model factory
>> methodology like the FixtureReplacement. In both cases, I'm not seeing
>> anything getting loaded into the database.
>>
>> I have some legacy fixtures that I'm willing to let go of, but I kind of
>> assumed that they would work for now. When I run my Features, I'm not seeing
>> anything whatsoever loaded into the db.
>>
>> When I use FixtureReplacement (http://replacefixtures.rubyforge.org/), i'm
>> getting errors that the methods aren't defined. I've added a "config.include
>> FixtureReplacement" to my spec_helper but that didn't seem to make any

The spec helper doesn't influence cucumber

>> difference. Then I tried adding "include FixtureReplacement" into my Steps

In Ruby - include is for classes/modules. Use extend to mix in a
module in an object. See above.

HTH,
Aslak

>> Before block, but that doesn't work either.
>>
>> any thoughts?
>> --
>> Tim Glen
>> Rails 2.0.2
>> RSpec 1.1.4
>>
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>
> cheers,
> Matt
> ----
> http://blog.mattwynne.net
> http://songkick.com
>
> In case you wondered: The opinions expressed in this email are my own and do
> not necessarily reflect the views of any former, current or future employers
> of mine.
>
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list