Skip to content

Commit

Permalink
Fix fixtures regression that required table names to map to classes o…
Browse files Browse the repository at this point in the history
…nly, not class names
  • Loading branch information
jeremy committed Sep 8, 2013
1 parent c989a18 commit bac28d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/fixtures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/cases/fixtures_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit bac28d3

Please sign in to comment.