Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Remco van 't Veer http://blog.remvee.net

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

load all fixtures

In some test cases I need all my fixtures to be loaded. To make this easier, add the following to test/test_helper.rb:

class Test::Unit::TestCase
  def self.all_fixtures
    Dir[File.dirname(__FILE__) + "/fixtures/*.yml"].each do |f|
      fixtures File.basename(f, '.yml')
    end
  end

  ..
end


and in your tests use it as follows:

class FooTest < Test::Unit::TestCase
  all_fixtures

  ..
end


Happy testing!
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS