[rspec-users] cucumber and fixtures

Zach Dennis zach.dennis at gmail.com
Wed Oct 8 15:55:58 EDT 2008

I use seed_fu with cucumber.


To load them I use the following my features/steps/env.rb. I reload
them for every scenarios:

Before do
  ActiveRecord::Schema.verbose = false
  load "#{RAILS_ROOT}/db/schema.rb"
  Dir[File.join(RAILS_ROOT, "features/fixtures", '*.rb')].sort.each {
|fixture| load fixture }

My fixture files live in features/fixtures/ and each looks like:

# my_model.rb
MyModel.transaction do
   MyModel.seed_many(:id, [
     { :name => "blah", :id => 1 },
     { :name => "foo", :id => 2

I use seed_fu for seeding production data as well. I don't use it in
the sense of Rails fixtures. I use it in the sense of "the app needs
this data to even run, period." Seems maybe this is what you're
looking for,


On Wed, Oct 8, 2008 at 10:44 AM, Daniel Higginbotham
<lists at ruby-forum.com> wrote:
> aslak hellesoy wrote:
>> On Wed, Oct 8, 2008 at 3:16 PM, Daniel Higginbotham
>> <lists at ruby-forum.com> wrote:
>>> Is it possible to use spec fixtures with Cucumber, and if so, how?
>> Google for cucumber fixtures
>> http://www.ruby-forum.com/topic/165215
>> http://www.ruby-forum.com/topic/165777
> Yep, I've read those threads and they both explain how to use
> alternatives to fixtures, not fixtures themselves.  In the first thread
> you posted, the OP mentions that he was trying to use fixtures and they
> were never loaded into his DB.
> Is there some way to use fixtures with Cucumber - not
> FixtureReplacement, not mocks, not ObjectDaddy, just fixtures?
> Thanks,
> Daniel Higginbotham
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Zach Dennis

More information about the rspec-users mailing list