Skip to content
This repository
Browse code

Don't read csv file during executing db:fixtures:load.

  • Loading branch information...
commit ee64abbf948b489ee1b3b0a3fae378b974a3db87 1 parent bebfa5c
Toshinori Kajihara authored June 17, 2012
2  activerecord/lib/active_record/railties/databases.rake
@@ -318,7 +318,7 @@ db_namespace = namespace :db do
318 318
       base_dir     = File.join [Rails.root, ENV['FIXTURES_PATH'] || %w{test fixtures}].flatten
319 319
       fixtures_dir = File.join [base_dir, ENV['FIXTURES_DIR']].compact
320 320
 
321  
-      (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir["#{fixtures_dir}/**/*.{yml,csv}"].map {|f| f[(fixtures_dir.size + 1)..-5] }).each do |fixture_file|
  321
+      (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir["#{fixtures_dir}/**/*.yml"].map {|f| f[(fixtures_dir.size + 1)..-5] }).each do |fixture_file|
322 322
         ActiveRecord::Fixtures.create_fixtures(fixtures_dir, fixture_file)
323 323
       end
324 324
     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
       output = Dir.chdir(app_path) do
127 139
         `rails generate scaffold user username:string password:string;

0 notes on commit ee64abb

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