Should you be able to override fixture_path for `rake db:fixtures:load`?

I usually keep my fixtures in spec/fixtures.

In order for rake db:fixtures:load to work, I’ve always had to symlink test/fixtures to point to spec/fixtures.

I was trying to avoid this in a new Rails 5 project, but I could see any way to (even monkey patching ActiveSupport::TestCase#fixture_path didn’t work).

I realize rspec-rails allows you to set it via config.fixture_path, but this doesn’t help when doing db:fixtures:load, which is dev env.

Ideally, I’d like to do something like this in config/development.rb:

config.active_record.fixture_path = "#{::Rails.root}/spec/fixtures"

Am I missing something obvious? If not, what do you think about a patch to support the above line?


– Chad

So, I finally realized I could accomplish this by setting ENV[‘FIXTURES_PATH’], but it took me a while to realize this.

I submitted the following PR to make this “just work” for users of rspec + fixtures.


– Chad