Permalink
Browse files

Fix fixtures regression that required table names to map to classes o…

…nly, not class names
  • Loading branch information...
1 parent c989a18 commit bac28d3bbdbe59109ac532935f06c2603ffe0fcd @jeremy jeremy committed Sep 8, 2013
Showing with 2 additions and 2 deletions.
  1. +1 −1 activerecord/lib/active_record/fixtures.rb
  2. +1 −1 activerecord/test/cases/fixtures_test.rb
View
2 activerecord/lib/active_record/fixtures.rb
@@ -479,7 +479,7 @@ def self.create_fixtures(fixtures_directory, fixture_set_names, class_names = {}
fixture_sets = files_to_read.map do |fs_name|
klass = class_names[fs_name]
- conn = klass ? klass.connection : connection
+ conn = klass.respond_to?(:connection) ? klass.connection : connection
fixtures_map[fs_name] = new( # ActiveRecord::FixtureSet.new
conn,
fs_name,
View
2 activerecord/test/cases/fixtures_test.rb
@@ -78,7 +78,7 @@ def test_multiple_clean_fixtures
end
def test_create_symbol_fixtures
- fixtures = ActiveRecord::FixtureSet.create_fixtures(FIXTURES_ROOT, :collections, :collections => Course) { Course.connection }
+ fixtures = ActiveRecord::FixtureSet.create_fixtures(FIXTURES_ROOT, :collections, :collections => 'Course') { Course.connection }
assert Course.find_by_name('Collection'), 'course is not in the database'
assert fixtures.detect { |f| f.name == 'collections' }, "no fixtures named 'collections' in #{fixtures.map(&:name).inspect}"

0 comments on commit bac28d3

Please sign in to comment.