Pre-loaded fixtures wiped-out by test run

30 views
Skip to first unread message

Alex Dilley

unread,
Jul 26, 2017, 4:16:19 PM7/26/17
to Ruby on Rails: Talk
If you preload your test database with all fixture data via the rake task:

bin/rails db:fixtures:load

And set self.pre_loaded_fixtures to true:

class ActiveSupport::TestCase
  self.pre_loaded_fixtures = true
  self.use_transactional_tests = true # the default

  fixtures :all
end

Would you expect the fixtures to be deleted and reinserted on every test run (caused by ActiveRecord::FixtureSet.create_fixtures – the same code exercised by the rake task)? Given the documentation on Transactional Tests, I'd imagine this to be unexpected behaviour but, regardless of options configured, fixture data is always reinstalled by the fixtures :all call.
Reply all
Reply to author
Forward
0 new messages