I do this: Fixtures.reset_cache fixtures_folder = File.join(RAILS_ROOT, 'test', 'fixtures') fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| File.basename(f, '.yml') } fixture_class_names = {} # or whatever needed Fixtures.create_fixtures(fixtures_folder, fixtures, fixture_class_names)
On Wed, May 20, 2009 at 12:44 PM, Phlip <phlip2...@gmail.com> wrote: > Cucumberists: > > Apologies for not jumping into some wild alternate fixture (or mock!) > system, but the unit tests at my new day gig are >cough< hanging by a thread > as it is. > > I need to show off some cute Cuke, _without_ rocking the boat! > > How do I actually use real, pre-existing Rails fixtures, the same as the > unit tests use? For familiarity? > > Putting this at the top of the step.rb seems just a leeettle bit tacky... > > $fixtures_installed ||= ( > ENV['RAILS_ENV'] = 'test' > RAILS_ENV.replace('test') > system('rake db:fixtures:load') ) > > I have attempted to load Rails Fixtures on demand before, and I'm the first > to admit their architecture sucks - loading them on demand ain't pretty! > > And exactly why was 'rake features' running in RAILS_ENV=development mode? > Do developers _like_ having their scratch database screwed up each time they > run fixtures? Enquiring minds want to know! > > -- > Phlip > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > -- http://yiwenandsoftware.wordpress.com
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users