give helpful error messages when fixtures accessed style table_name(:name) cannot be found [Tobias Luetke]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3480 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Tobias Lütke
2006-01-25 02:40:25 +00:00
parent 9c52a41241
commit 2dc16df10c

View File

@@ -453,7 +453,11 @@ module Test #:nodoc:
force_reload = optionals.shift
@fixture_cache[table_name] ||= Hash.new
@fixture_cache[table_name][fixture] = nil if force_reload
@fixture_cache[table_name][fixture] ||= @loaded_fixtures[table_name][fixture.to_s].find
if @loaded_fixtures[table_name][fixture.to_s]
@fixture_cache[table_name][fixture] ||= @loaded_fixtures[table_name][fixture.to_s].find
else
raise StandardError, "No fixture with name '#{fixture}' found for table '#{table_name}'"
end
end
end
end