diff options
Diffstat (limited to 'activesupport/test/xml_mini/jdom_engine_test.rb')
-rw-r--r-- | activesupport/test/xml_mini/jdom_engine_test.rb | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/activesupport/test/xml_mini/jdom_engine_test.rb b/activesupport/test/xml_mini/jdom_engine_test.rb index 34e213b718..a776ad25c4 100644 --- a/activesupport/test/xml_mini/jdom_engine_test.rb +++ b/activesupport/test/xml_mini/jdom_engine_test.rb @@ -1,17 +1,16 @@ -if RUBY_PLATFORM.include?('java') - require 'abstract_unit' - require 'active_support/xml_mini' - require 'active_support/core_ext/hash/conversions' - +if RUBY_PLATFORM.include?("java") + require "abstract_unit" + require "active_support/xml_mini" + require "active_support/core_ext/hash/conversions" class JDOMEngineTest < ActiveSupport::TestCase include ActiveSupport - FILES_DIR = File.dirname(__FILE__) + '/../fixtures/xml' + FILES_DIR = File.dirname(__FILE__) + "/../fixtures/xml" def setup @default_backend = XmlMini.backend - XmlMini.backend = 'JDOM' + XmlMini.backend = "JDOM" end def teardown @@ -19,18 +18,18 @@ if RUBY_PLATFORM.include?('java') end def test_file_from_xml - hash = Hash.from_xml(<<-eoxml) + hash = Hash.from_xml(<<-eoxml) <blog> <logo type="file" name="logo.png" content_type="image/png"> </logo> </blog> eoxml - assert hash.has_key?('blog') - assert hash['blog'].has_key?('logo') + assert hash.has_key?("blog") + assert hash["blog"].has_key?("logo") - file = hash['blog']['logo'] - assert_equal 'logo.png', file.original_filename - assert_equal 'image/png', file.content_type + file = hash["blog"]["logo"] + assert_equal "logo.png", file.original_filename + assert_equal "image/png", file.content_type end def test_not_allowed_to_expand_entities_to_files @@ -40,7 +39,7 @@ if RUBY_PLATFORM.include?('java') ]> <member>x&a;</member> EOT - assert_equal 'x', Hash.from_xml(attack_xml)["member"] + assert_equal "x", Hash.from_xml(attack_xml)["member"] end def test_not_allowed_to_expand_parameter_entities_to_files @@ -52,17 +51,16 @@ if RUBY_PLATFORM.include?('java') <member>x&a;</member> EOT assert_raise Java::OrgXmlSax::SAXParseException do - assert_equal 'x', Hash.from_xml(attack_xml)["member"] + assert_equal "x", Hash.from_xml(attack_xml)["member"] end end - def test_not_allowed_to_load_external_doctypes attack_xml = <<-EOT <!DOCTYPE member SYSTEM "file://#{FILES_DIR}/jdom_doctype.dtd"> <member>x&a;</member> EOT - assert_equal 'x', Hash.from_xml(attack_xml)["member"] + assert_equal "x", Hash.from_xml(attack_xml)["member"] end def test_exception_thrown_on_expansion_attack @@ -86,13 +84,13 @@ if RUBY_PLATFORM.include?('java') end def test_setting_JDOM_as_backend - XmlMini.backend = 'JDOM' + XmlMini.backend = "JDOM" assert_equal XmlMini_JDOM, XmlMini.backend end def test_blank_returns_empty_hash assert_equal({}, XmlMini.parse(nil)) - assert_equal({}, XmlMini.parse('')) + assert_equal({}, XmlMini.parse("")) end def test_array_type_makes_an_array @@ -178,7 +176,7 @@ if RUBY_PLATFORM.include?('java') private def assert_equal_rexml(xml) parsed_xml = XmlMini.parse(xml) - hash = XmlMini.with_backend('REXML') { XmlMini.parse(xml) } + hash = XmlMini.with_backend("REXML") { XmlMini.parse(xml) } assert_equal(hash, parsed_xml) end end |