Add XML engine configuration

This commit is contained in:
ccocchi 2012-09-17 15:24:39 +02:00
parent c566c0d788
commit 84cd69bdfd
2 changed files with 11 additions and 2 deletions

View File

@ -48,11 +48,22 @@ module RablRails
MultiJson.engine
end
def self.xml_engine=(name)
ActiveSupport::XmlMini.backend = name
rescue LoadError, NameError
Rails.logger.warn %Q(WARNING: rabl-rails could not load "#{name}" as XML engine, fallback to default)
end
def self.xml_engine
ActiveSupport::XmlMini.backend
end
def self.cache_templates?
ActionController::Base.perform_caching && @@cache_templates
end
def self.load_default_engines!
self.json_engine = MultiJson.default_engine
self.xml_engine = 'LibXML'
end
end

View File

@ -23,8 +23,6 @@ end
require 'rabl-rails'
ActiveSupport::XmlMini.backend = 'LibXML'
module ActiveSupport
class TestCase
RSpec::Mocks::setup(self)