diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-02-28 04:00:38 -0800 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-02-28 04:00:38 -0800 |
commit | 5e1d629ff66dc433aa50a10130e477060da13bf8 (patch) | |
tree | bd42df58810c3939de8c83b9929b0ca101aab015 | |
parent | 641a27d47baf4804e89d5a99ee6d843a75d868e6 (diff) | |
parent | 3170d2b7689f2e7f63bac4a5dee050ca03005678 (diff) | |
download | rails-5e1d629ff66dc433aa50a10130e477060da13bf8.tar.gz rails-5e1d629ff66dc433aa50a10130e477060da13bf8.tar.bz2 rails-5e1d629ff66dc433aa50a10130e477060da13bf8.zip |
Merge pull request #9485 from authorNari/backport-6755-to-3-2-stable
Backported #6755 to 3-2-stable. Don't read csv file during executing db:fixtures:load.
CSV fixtures have already been removed some time ago in 1716da07204193c8acf967e2d75a53a82e4c7c28, but the task was still loading them, even though later it tried to find the related yaml file.
-rw-r--r-- | activerecord/CHANGELOG.md | 3 | ||||
-rw-r--r-- | activerecord/lib/active_record/railties/databases.rake | 2 | ||||
-rw-r--r-- | railties/test/application/rake_test.rb | 12 |
3 files changed, 16 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 4434d9ae6a..3ae1e95a43 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,4 +1,7 @@ ## unreleased ## +* Don't read csv file during executing db:fixtures:load. + + *kennyj* * Reverted 921a296a3390192a71abeec6d9a035cc6d1865c8, 'Quote numeric values compared to string columns.' This caused several regressions. diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake index 8f7c7f6b00..7f1b84b848 100644 --- a/activerecord/lib/active_record/railties/databases.rake +++ b/activerecord/lib/active_record/railties/databases.rake @@ -355,7 +355,7 @@ db_namespace = namespace :db do base_dir = File.join [Rails.root, ENV['FIXTURES_PATH'] || %w{test fixtures}].flatten fixtures_dir = File.join [base_dir, ENV['FIXTURES_DIR']].compact - (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir["#{fixtures_dir}/**/*.{yml,csv}"].map {|f| f[(fixtures_dir.size + 1)..-5] }).each do |fixture_file| + (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir["#{fixtures_dir}/**/*.yml"].map {|f| f[(fixtures_dir.size + 1)..-5] }).each do |fixture_file| ActiveRecord::Fixtures.create_fixtures(fixtures_dir, fixture_file) end end diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index ab9084df55..107b54c0be 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -122,6 +122,18 @@ module ApplicationTests assert_equal 0, ::AppTemplate::Application::User.count end + def test_loading_only_yml_fixtures + Dir.chdir(app_path) do + `rake db:migrate` + end + + app_file "test/fixtures/products.csv", "" + + require "#{rails_root}/config/environment" + errormsg = Dir.chdir(app_path) { `rake db:fixtures:load` } + assert $?.success?, errormsg + end + def test_scaffold_tests_pass_by_default content = Dir.chdir(app_path) do `rails generate scaffold user username:string password:string` |