<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>acts_as_developer: autotest errors after migration?</title>
    <link>http://www.robertshowalter.com/articles/2007/06/23/autotest-fails-after-migration</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>autotest errors after migration?</title>
      <description>&lt;p&gt;If you generate a new model or run a migration that makes changes to your database, &lt;a href="http://www.zenspider.com/ZSS/Products/ZenTest/"&gt;autotest&lt;/a&gt; will probably start reporting errors.&lt;/p&gt;


	&lt;p&gt;For instance, if you generate a new model, edit the migration and then &lt;code&gt;rake db:migrate&lt;/code&gt;, you might see something like this:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;ActiveRecord::StatementInvalid: Mysql::Error: #42S02Table 'sample_test.widgets' doesn't exist: DELETE FROM widgets&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;autotest is really smart, which is great. But this one trips it up a bit. The problem is that autotest is running your new &lt;code&gt;widget_test.rb&lt;/code&gt;, which is trying to load your new Widget fixtures. However, &lt;code&gt;rake db:migrate&lt;/code&gt; only affects your production database, not your test database.&lt;/p&gt;


	&lt;p&gt;The fix is simple:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Run &lt;code&gt;rake db:test:prepare&lt;/code&gt;. This applies the current development schema to your test database.&lt;/li&gt;
		&lt;li&gt;Press Ctrl-C (once) in your autotest window. That tells autotest to restart itself and run the full test suite.&lt;/li&gt;
	&lt;/ol&gt;</description>
      <pubDate>Sat, 23 Jun 2007 20:15:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:f8fa4454-3a99-4864-b919-c6f45a1c1172</guid>
      <author>Bob Showalter</author>
      <link>http://www.robertshowalter.com/articles/2007/06/23/autotest-fails-after-migration</link>
      <category>Rails</category>
    </item>
  </channel>
</rss>
