Ignore file fixtures on `db:fixtures:load`

This commit is contained in:
Kevin Sjöberg 2021-05-05 19:59:26 +02:00
parent 3a98e7da62
commit f0f067af78
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,7 @@
* Ignore file fixtures on `db:fixtures:load`
*Kevin Sjöberg*
* Fix ActionController::Live controller test deadlocks by removing the body buffer size limit for tests.
*Dylan Thacker-Smith*

View File

@ -385,8 +385,9 @@ db_namespace = namespace :db do
fixture_files = if ENV["FIXTURES"]
ENV["FIXTURES"].split(",")
else
# The use of String#[] here is to support namespaced fixtures.
Dir["#{fixtures_dir}/**/*.yml"].map { |f| f[(fixtures_dir.size + 1)..-5] }
files = Dir[File.join(fixtures_dir, "**/*.{yml}")]
files.reject! { |f| f.start_with?(File.join(fixtures_dir, "files")) }
files.map! { |f| f[fixtures_dir.to_s.size..-5].delete_prefix("/") }
end
ActiveRecord::FixtureSet.create_fixtures(fixtures_dir, fixture_files)