1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Ruby 1.9 compat: delete DEFAULTS key from Hash not Omap array

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9191 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2008-04-01 06:33:16 +00:00
parent ecdddc4de5
commit c3df9bfad2
2 changed files with 5 additions and 2 deletions

View file

@ -561,7 +561,11 @@ class Fixtures < (RUBY_VERSION < '1.9' ? YAML::Omap : Hash)
now = now.to_s(:db)
# allow a standard key to be used for doing defaults in YAML
delete(assoc("DEFAULTS"))
if is_a?(Hash)
delete('DEFAULTS')
else
delete(assoc('DEFAULTS'))
end
# track any join tables we need to insert later
habtm_fixtures = Hash.new do |h, habtm|

View file

@ -565,7 +565,6 @@ class FoxyFixturesTest < ActiveRecord::TestCase
assert(parrots(:louis).treasures.include?(treasures(:sapphire)))
end
# FIXME: first assertion fails on Ruby 1.9
def test_strips_DEFAULTS_key
assert_raise(StandardError) { parrots(:DEFAULTS) }