<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: testing code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 08 Aug 2008 08:01:30 GMT</pubDate>
    <description>DZone Snippets: testing code</description>
    <item>
      <title>load all fixtures</title>
      <link>http://snippets.dzone.com/posts/show/5007</link>
      <description>In some test cases I need all my fixtures to be loaded.  To make this easier, add the following to test/test_helper.rb:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;class Test::Unit::TestCase&lt;br /&gt;  def self.all_fixtures&lt;br /&gt;    Dir[File.dirname(__FILE__) + "/fixtures/*.yml"].each do |f|&lt;br /&gt;      fixtures File.basename(f, '.yml')&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;  ..&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;and in your tests use it as follows:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;class FooTest &lt; Test::Unit::TestCase&lt;br /&gt;  all_fixtures&lt;br /&gt;&lt;br /&gt;  ..&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Happy testing!</description>
      <pubDate>Fri, 18 Jan 2008 19:01:16 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5007</guid>
      <author>remvee (Remco van 't Veer)</author>
    </item>
  </channel>
</rss>
