Skip to content
This repository
Browse code

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 1716da0, but the task was still loading them, even though later it tried to find the related yaml file.
  • Loading branch information...
commit 5e1d629ff66dc433aa50a10130e477060da13bf8 2 parents 641a27d + 3170d2b
Carlos Antonio da Silva authored February 28, 2013
3  activerecord/CHANGELOG.md
Source Rendered
... ...
@@ -1,4 +1,7 @@
1 1
 ## unreleased ##
  2
+*   Don't read csv file during executing db:fixtures:load.
  3
+
  4
+    *kennyj*
2 5
 
3 6
 *   Reverted 921a296a3390192a71abeec6d9a035cc6d1865c8, 'Quote numeric values
4 7
     compared to string columns.' This caused several regressions.
2  activerecord/lib/active_record/railties/databases.rake
@@ -355,7 +355,7 @@ db_namespace = namespace :db do
355 355
       base_dir     = File.join [Rails.root, ENV['FIXTURES_PATH'] || %w{test fixtures}].flatten
356 356
       fixtures_dir = File.join [base_dir, ENV['FIXTURES_DIR']].compact
357 357
 
358  
-      (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir["#{fixtures_dir}/**/*.{yml,csv}"].map {|f| f[(fixtures_dir.size + 1)..-5] }).each do |fixture_file|
  358
+      (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir["#{fixtures_dir}/**/*.yml"].map {|f| f[(fixtures_dir.size + 1)..-5] }).each do |fixture_file|
359 359
         ActiveRecord::Fixtures.create_fixtures(fixtures_dir, fixture_file)
360 360
       end
361 361
     end
12  railties/test/application/rake_test.rb
@@ -122,6 +122,18 @@ def test_loading_specific_fixtures
122 122
       assert_equal 0, ::AppTemplate::Application::User.count
123 123
     end
124 124
 
  125
+    def test_loading_only_yml_fixtures
  126
+      Dir.chdir(app_path) do
  127
+        `rake db:migrate`
  128
+      end
  129
+
  130
+      app_file "test/fixtures/products.csv", ""
  131
+
  132
+      require "#{rails_root}/config/environment"
  133
+      errormsg = Dir.chdir(app_path) { `rake db:fixtures:load` }
  134
+      assert $?.success?, errormsg
  135
+    end
  136
+
125 137
     def test_scaffold_tests_pass_by_default
126 138
       content = Dir.chdir(app_path) do
127 139
         `rails generate scaffold user username:string password:string`

0 notes on commit 5e1d629

Please sign in to comment.
Something went wrong with that request. Please try again.