Load RSpec fixtures in Rails
If you’re still using fixtures in your RSpec Rails tests for some reason you might want to load them into an environment to look at. For example, to ensure the data is displaying in the application like you intend.
Rails expects you’re using Test::Unit so it expects the fixtures to live in test/fixtures
. Here’s how you load fixtures from RSpec into your ‘test’ environment:
bundle exec rake db:fixtures:load RAILS_ENV=test FIXTURES_PATH=spec/fixtures
You get a deprecation warning when running this. It says you should set this with Update: the deprecation warning was removed in Rails 4.1.ActiveRecord::Tasks::DatabaseTasks.fixtures_path = '/path/to/fixtures'
instead but I haven’t worked out where you’d put that for this kind of use (suggestions in the comments greatly appreciated!).