Skip to content

Commit

Permalink
Backported #6755 to 3-2-stable. Don't read csv file during executing …
Browse files Browse the repository at this point in the history
…db:fixtures:load.
  • Loading branch information
authorNari committed Feb 28, 2013
1 parent 641a27d commit 3170d2b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions 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.
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/railties/databases.rake
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions railties/test/application/rake_test.rb
Expand Up @@ -122,6 +122,18 @@ def test_loading_specific_fixtures
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`
Expand Down

0 comments on commit 3170d2b

Please sign in to comment.