title: Configuring fixture_path in ActiveRecord test fixtures
body: <p>I'm using ActiveRecord with Sinatra instead of Rails, and I want to use fixtures in my tests. The documentation for <a href="http://apidock.com/rails/v4.0.2/ActiveRecord/FixtureSet" rel="nofollow">ActiveRecord's FixtureSet</a> says that you have to use <code>fixture_path</code> to tell it where the fixture files are:</p>
  
  <blockquote>
    <p>placed in the directory appointed by ActiveSupport::TestCase.fixture_path=(path)</p>
  </blockquote>
  
  <p>How can I write to that setting? I tried <code>@fixture_path</code> and <code>@@fixture_path</code>, but both of them left the value nil when <code>FixtureSet</code> tried to read it.</p>
  
  <p>Here's the only thing I could get to work, but it can't possibly be right:</p>
  
  <pre><code># test_helper.rb
  require_relative '../app'
  require 'minitest/autorun'
  require 'active_record'
  
  ActiveRecord::Base.establish_connection(:test)
  
  #Set up fixtures and such
  class ActiveSupport::TestCase
    include ActiveRecord::TestFixtures
    include ActiveRecord::TestFixtures::ClassMethods
  
    class &lt;&lt; self
      def fixtures(*fixture_set_names)
        self.fixture_path = 'test/fixtures'
        super *fixture_set_names
      end
    end
  
    self.use_transactional_fixtures = true
    self.use_instantiated_fixtures  = false
  end
  </code></pre>
  
  <p>The full source code is posted as a <a href="https://github.com/donkirkby/active_sinatra" rel="nofollow">small demo project</a> for ActiveRecord and Sinatra.</p>