title: How can I use rspec with YAML fixtures that get cleaned up?
body: <p>I want my rspec tests to load my YAML fixtures, and I want them to be loaded inside the transaction, so that they disappear after each test.</p>
  
  <pre><code>describe "the thing I'm testing"
     fixtures :sandwiches, :condiments
  
     before(:each) do
        # stuff
     end
  
     it "makes sandwiches"
        # making sandwiches 
     end
  end
  </code></pre>
  
  <p>When the call to <code>fixtures</code> is there (in the <code>describe</code> block, but not in the <code>before</code> block), it loads my sandwiches and condiments, but outside of the transaction, and thus committed. Well, it looks that way; what's certain is that my fixtures are still in the db after the test finishes.</p>
  
  <p>I thought perhaps I could put the call to <code>fixtures</code> in the <code>before</code> block, inside the transaction, but then I get</p>
  
  <blockquote>
    <p>NoMethodError: undefined method `fixtures' for 
    &lt;RSpec::Core::ExampleGroup::Nested_1:0x007fd1f11f7578&gt;</p>
  </blockquote>
  
  <p>So I guess I could use DatabaseCleaner, or something similar, but...can't I get what I want without that?</p>