[rspec-users] Cucumber vs Rails Fixtures

Phlip phlip2005 at gmail.com
Wed May 20 13:44:13 EDT 2009


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'
     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!


More information about the rspec-users mailing list