diff --git a/lib/rabl-rails.rb b/lib/rabl-rails.rb
index 9f88569..3c2ed94 100644
--- a/lib/rabl-rails.rb
+++ b/lib/rabl-rails.rb
@@ -33,7 +33,7 @@ module RablRails
mattr_accessor :responder_default_template
@@responder_default_template = 'show'
- mattr_accessor :plist_engine
+ mattr_reader :plist_engine
@@plist_engine = nil
mattr_accessor :include_plist_root
@@ -65,6 +65,11 @@ module RablRails
ActiveSupport::XmlMini.backend
end
+ def self.plist_engine=(name)
+ raise "Your plist engine does not respond to #dump" unless name.respond_to?(:dump)
+ @@plist_engine = name
+ end
+
def self.cache_templates?
ActionController::Base.perform_caching && @@cache_templates
end
diff --git a/test/renderers/plist_renderer_test.rb b/test/renderers/plist_renderer_test.rb
index 742a9e1..5b17165 100644
--- a/test/renderers/plist_renderer_test.rb
+++ b/test/renderers/plist_renderer_test.rb
@@ -1,4 +1,7 @@
require 'test_helper'
+require 'plist'
+
+RablRails.plist_engine = Plist::Emit
class TestPlistRenderer < ActiveSupport::TestCase
INDENT_REGEXP = /\n(\s)*/
@@ -20,6 +23,10 @@ class TestPlistRenderer < ActiveSupport::TestCase
output.sub!(HEADER_REGEXP, '').gsub!(%r(?plist[^>]*>), '').sub!(%r(), '').sub(%r(), '')
end
+ test "plist engine should responsd to #dump" do
+ assert_raises(RuntimeError) { RablRails.plist_engine = Object.new }
+ end
+
test "render object wth empty template" do
@template.source = {}
assert_equal %q(), render_plist_output
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 58f854f..7468f73 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -22,9 +22,6 @@ class <