Daniel Higginbotham <[EMAIL PROTECTED]> writes: > Zach Dennis wrote: >> I use seed_fu with cucumber. >> >> http://github.com/mbleigh/seed-fu/tree >> >> To load them I use the following my features/steps/env.rb. I reload >> them for every scenarios: >> >> Before do >> >> ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test']) >> ActiveRecord::Schema.verbose = false >> load "#{RAILS_ROOT}/db/schema.rb" >> Dir[File.join(RAILS_ROOT, "features/fixtures", '*.rb')].sort.each { >> |fixture| load fixture } >> end >> >> 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 >> ]) >> end >> >> 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, >> >> Zach > > This isn't quite what I'm looking for. I'd actually like to be able to > use the fixtures in spec/fixtures , just as I can for plain old specs. > With specs, you can define which fixtures to use in each "describe" > block, using something like > > describe TodoList do > fixtures :todo_lists, :todos, :users > > it "should return an error when blah blah blah" do > ... > end > end > > Are you similarly able to load your YAML fixtures from spec/fixtures > when you're running a Cucumber feature? > > Thanks, > Daniel Higginbotham
I don't know that it's built into Cucumber, but loading fixtures is pretty simple from what I remember. Something like AR::Fixtures.load('path/to/file.yml') or something. Look around and I'm sure you can find the couple lines to make it work. Pat _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users