Add YAML merge keys workaround.

Prevent problems when using running tests with
a mongoid.yml using YAML merge keys on Ruby 1.9.2
and RubyGems >= 1.5

Will be needed until r30629 and r30630 are backported
to 1.9.2 (ticket #4357)

http://redmine.ruby-lang.org/issues/show/4357
This commit is contained in:
Leonard Chin 2011-02-19 20:54:32 +09:00
parent 1ada571065
commit be40c18e2b
1 changed files with 8 additions and 1 deletions

View File

@ -3,7 +3,14 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rails'
require 'mongoid'
require 'kaminari'
# Ensure we use 'syck' instead of 'psych' in 1.9.2
# RubyGems >= 1.5.0 uses 'psych' on 1.9.2, but
# Psych does not yet support YAML 1.1 merge keys.
# Merge keys is often used in mongoid.yml
# See: http://redmine.ruby-lang.org/issues/show/4300
if RUBY_VERSION >= '1.9.2'
YAML::ENGINE.yamler = 'syck'
end
require File.join(File.dirname(__FILE__), 'fake_app')
require 'rspec/rails'