Permalink
Browse files

Fix issue with singularizing already singular names when dealing with…

… individual fixtures
  • Loading branch information...
1 parent 4144e2a commit 2f3a98df2a584259781a6efdfb9cf7f2de1eb7ff @jeremyevans committed Dec 11, 2007
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/fixture_dependencies.rb
@@ -43,14 +43,14 @@ def add(model_name, name, attributes)
# the fixture name.
def get(record)
model_name, name = split_name(record)
- model = model_name.classify.constantize
+ model = model_name.camelize.constantize
model.find(fixtures[model_name.to_sym][name.to_sym][model.primary_key.to_sym])
end
# Adds all fixtures in the yaml fixture file for the model to the fixtures
# hash (does not add them to the database, see add).
def load_yaml(model_name)
- YAML.load(File.read(File.join(Test::Unit::TestCase.fixture_path, "#{model_name.classify.constantize.table_name}.yml"))).each do |name, attributes|
+ YAML.load(File.read(File.join(Test::Unit::TestCase.fixture_path, "#{model_name.camelize.constantize.table_name}.yml"))).each do |name, attributes|
symbol_attrs = {}
attributes.each{|k,v| symbol_attrs[k.to_sym] = v}
add(model_name.to_sym, name, symbol_attrs)
@@ -76,7 +76,7 @@ def use(record, loading = [], procs = {})
puts "#{spaces}load stack:#{loading.inspect}" if verbose > 1
loading.push(record)
model_name, name = split_name(record)
- model = model_name.classify.constantize
+ model = model_name.camelize.constantize
unless loaded[model_name.to_sym]
puts "#{spaces}loading #{model.table_name}.yml" if verbose > 0
load_yaml(model_name)

0 comments on commit 2f3a98d

Please sign in to comment.