aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/xml_mini
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/xml_mini')
-rw-r--r--activesupport/test/xml_mini/jdom_engine_test.rb34
-rw-r--r--activesupport/test/xml_mini/libxml_engine_test.rb16
-rw-r--r--activesupport/test/xml_mini/libxmlsax_engine_test.rb16
-rw-r--r--activesupport/test/xml_mini/nokogiri_engine_test.rb26
-rw-r--r--activesupport/test/xml_mini/nokogirisax_engine_test.rb26
-rw-r--r--activesupport/test/xml_mini/rexml_engine_test.rb22
6 files changed, 70 insertions, 70 deletions
diff --git a/activesupport/test/xml_mini/jdom_engine_test.rb b/activesupport/test/xml_mini/jdom_engine_test.rb
index 34e213b718..fea3711c37 100644
--- a/activesupport/test/xml_mini/jdom_engine_test.rb
+++ b/activesupport/test/xml_mini/jdom_engine_test.rb
@@ -1,17 +1,17 @@
-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
@@ -25,12 +25,12 @@ if RUBY_PLATFORM.include?('java')
</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 +40,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,7 +52,7 @@ 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
@@ -62,7 +62,7 @@ if RUBY_PLATFORM.include?('java')
<!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 +86,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 +178,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
diff --git a/activesupport/test/xml_mini/libxml_engine_test.rb b/activesupport/test/xml_mini/libxml_engine_test.rb
index a8df2e1f7b..c40145ae5f 100644
--- a/activesupport/test/xml_mini/libxml_engine_test.rb
+++ b/activesupport/test/xml_mini/libxml_engine_test.rb
@@ -1,18 +1,18 @@
begin
- require 'libxml'
+ require "libxml"
rescue LoadError
# Skip libxml tests
else
-require 'abstract_unit'
-require 'active_support/xml_mini'
-require 'active_support/core_ext/hash/conversions'
+require "abstract_unit"
+require "active_support/xml_mini"
+require "active_support/core_ext/hash/conversions"
class LibxmlEngineTest < ActiveSupport::TestCase
include ActiveSupport
def setup
@default_backend = XmlMini.backend
- XmlMini.backend = 'LibXML'
+ XmlMini.backend = "LibXML"
LibXML::XML::Error.set_handler(&lambda { |error| }) #silence libxml, exceptions will do
end
@@ -42,13 +42,13 @@ class LibxmlEngineTest < ActiveSupport::TestCase
end
def test_setting_libxml_as_backend
- XmlMini.backend = 'LibXML'
+ XmlMini.backend = "LibXML"
assert_equal XmlMini_LibXML, 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
@@ -196,7 +196,7 @@ class LibxmlEngineTest < ActiveSupport::TestCase
def assert_equal_rexml(xml)
parsed_xml = XmlMini.parse(xml)
xml.rewind if xml.respond_to?(:rewind)
- hash = XmlMini.with_backend('REXML') { XmlMini.parse(xml) }
+ hash = XmlMini.with_backend("REXML") { XmlMini.parse(xml) }
assert_equal(hash, parsed_xml)
end
end
diff --git a/activesupport/test/xml_mini/libxmlsax_engine_test.rb b/activesupport/test/xml_mini/libxmlsax_engine_test.rb
index d6d90639e2..a92cd9da8c 100644
--- a/activesupport/test/xml_mini/libxmlsax_engine_test.rb
+++ b/activesupport/test/xml_mini/libxmlsax_engine_test.rb
@@ -1,18 +1,18 @@
begin
- require 'libxml'
+ require "libxml"
rescue LoadError
# Skip libxml tests
else
-require 'abstract_unit'
-require 'active_support/xml_mini'
-require 'active_support/core_ext/hash/conversions'
+require "abstract_unit"
+require "active_support/xml_mini"
+require "active_support/core_ext/hash/conversions"
class LibXMLSAXEngineTest < ActiveSupport::TestCase
include ActiveSupport
def setup
@default_backend = XmlMini.backend
- XmlMini.backend = 'LibXMLSAX'
+ XmlMini.backend = "LibXMLSAX"
end
def teardown
@@ -42,13 +42,13 @@ class LibXMLSAXEngineTest < ActiveSupport::TestCase
end
def test_setting_libxml_as_backend
- XmlMini.backend = 'LibXMLSAX'
+ XmlMini.backend = "LibXMLSAX"
assert_equal XmlMini_LibXMLSAX, 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
@@ -187,7 +187,7 @@ class LibXMLSAXEngineTest < ActiveSupport::TestCase
def assert_equal_rexml(xml)
parsed_xml = XmlMini.parse(xml)
xml.rewind if xml.respond_to?(:rewind)
- hash = XmlMini.with_backend('REXML') { XmlMini.parse(xml) }
+ hash = XmlMini.with_backend("REXML") { XmlMini.parse(xml) }
assert_equal(hash, parsed_xml)
end
end
diff --git a/activesupport/test/xml_mini/nokogiri_engine_test.rb b/activesupport/test/xml_mini/nokogiri_engine_test.rb
index 1314c9065a..dd169e7eb4 100644
--- a/activesupport/test/xml_mini/nokogiri_engine_test.rb
+++ b/activesupport/test/xml_mini/nokogiri_engine_test.rb
@@ -1,16 +1,16 @@
begin
- require 'nokogiri'
+ require "nokogiri"
rescue LoadError
# Skip nokogiri tests
else
-require 'abstract_unit'
-require 'active_support/xml_mini'
-require 'active_support/core_ext/hash/conversions'
+require "abstract_unit"
+require "active_support/xml_mini"
+require "active_support/core_ext/hash/conversions"
class NokogiriEngineTest < ActiveSupport::TestCase
def setup
@default_backend = ActiveSupport::XmlMini.backend
- ActiveSupport::XmlMini.backend = 'Nokogiri'
+ ActiveSupport::XmlMini.backend = "Nokogiri"
end
def teardown
@@ -24,12 +24,12 @@ class NokogiriEngineTest < ActiveSupport::TestCase
</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_exception_thrown_on_expansion_attack
@@ -54,13 +54,13 @@ class NokogiriEngineTest < ActiveSupport::TestCase
end
def test_setting_nokogiri_as_backend
- ActiveSupport::XmlMini.backend = 'Nokogiri'
+ ActiveSupport::XmlMini.backend = "Nokogiri"
assert_equal ActiveSupport::XmlMini_Nokogiri, ActiveSupport::XmlMini.backend
end
def test_blank_returns_empty_hash
assert_equal({}, ActiveSupport::XmlMini.parse(nil))
- assert_equal({}, ActiveSupport::XmlMini.parse(''))
+ assert_equal({}, ActiveSupport::XmlMini.parse(""))
end
def test_array_type_makes_an_array
@@ -207,7 +207,7 @@ class NokogiriEngineTest < ActiveSupport::TestCase
def assert_equal_rexml(xml)
parsed_xml = ActiveSupport::XmlMini.parse(xml)
xml.rewind if xml.respond_to?(:rewind)
- hash = ActiveSupport::XmlMini.with_backend('REXML') { ActiveSupport::XmlMini.parse(xml) }
+ hash = ActiveSupport::XmlMini.with_backend("REXML") { ActiveSupport::XmlMini.parse(xml) }
assert_equal(hash, parsed_xml)
end
end
diff --git a/activesupport/test/xml_mini/nokogirisax_engine_test.rb b/activesupport/test/xml_mini/nokogirisax_engine_test.rb
index 7978a50921..9a2bcc3f7e 100644
--- a/activesupport/test/xml_mini/nokogirisax_engine_test.rb
+++ b/activesupport/test/xml_mini/nokogirisax_engine_test.rb
@@ -1,16 +1,16 @@
begin
- require 'nokogiri'
+ require "nokogiri"
rescue LoadError
# Skip nokogiri tests
else
-require 'abstract_unit'
-require 'active_support/xml_mini'
-require 'active_support/core_ext/hash/conversions'
+require "abstract_unit"
+require "active_support/xml_mini"
+require "active_support/core_ext/hash/conversions"
class NokogiriSAXEngineTest < ActiveSupport::TestCase
def setup
@default_backend = ActiveSupport::XmlMini.backend
- ActiveSupport::XmlMini.backend = 'NokogiriSAX'
+ ActiveSupport::XmlMini.backend = "NokogiriSAX"
end
def teardown
@@ -24,12 +24,12 @@ class NokogiriSAXEngineTest < ActiveSupport::TestCase
</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_exception_thrown_on_expansion_attack
@@ -55,13 +55,13 @@ class NokogiriSAXEngineTest < ActiveSupport::TestCase
end
def test_setting_nokogirisax_as_backend
- ActiveSupport::XmlMini.backend = 'NokogiriSAX'
+ ActiveSupport::XmlMini.backend = "NokogiriSAX"
assert_equal ActiveSupport::XmlMini_NokogiriSAX, ActiveSupport::XmlMini.backend
end
def test_blank_returns_empty_hash
assert_equal({}, ActiveSupport::XmlMini.parse(nil))
- assert_equal({}, ActiveSupport::XmlMini.parse(''))
+ assert_equal({}, ActiveSupport::XmlMini.parse(""))
end
def test_array_type_makes_an_array
@@ -208,7 +208,7 @@ class NokogiriSAXEngineTest < ActiveSupport::TestCase
def assert_equal_rexml(xml)
parsed_xml = ActiveSupport::XmlMini.parse(xml)
xml.rewind if xml.respond_to?(:rewind)
- hash = ActiveSupport::XmlMini.with_backend('REXML') { ActiveSupport::XmlMini.parse(xml) }
+ hash = ActiveSupport::XmlMini.with_backend("REXML") { ActiveSupport::XmlMini.parse(xml) }
assert_equal(hash, parsed_xml)
end
end
diff --git a/activesupport/test/xml_mini/rexml_engine_test.rb b/activesupport/test/xml_mini/rexml_engine_test.rb
index 6e9ce7ac11..2af98f7fe2 100644
--- a/activesupport/test/xml_mini/rexml_engine_test.rb
+++ b/activesupport/test/xml_mini/rexml_engine_test.rb
@@ -1,5 +1,5 @@
-require 'abstract_unit'
-require 'active_support/xml_mini'
+require "abstract_unit"
+require "active_support/xml_mini"
class REXMLEngineTest < ActiveSupport::TestCase
def test_default_is_rexml
@@ -7,12 +7,12 @@ class REXMLEngineTest < ActiveSupport::TestCase
end
def test_set_rexml_as_backend
- ActiveSupport::XmlMini.backend = 'REXML'
+ ActiveSupport::XmlMini.backend = "REXML"
assert_equal ActiveSupport::XmlMini_REXML, ActiveSupport::XmlMini.backend
end
def test_parse_from_io
- ActiveSupport::XmlMini.backend = 'REXML'
+ ActiveSupport::XmlMini.backend = "REXML"
io = StringIO.new(<<-eoxml)
<root>
good
@@ -23,21 +23,21 @@ class REXMLEngineTest < ActiveSupport::TestCase
</root>
eoxml
hash = ActiveSupport::XmlMini.parse(io)
- assert hash.has_key?('root')
- assert hash['root'].has_key?('products')
- assert_match "good", hash['root']['__content__']
- products = hash['root']['products']
+ assert hash.has_key?("root")
+ assert hash["root"].has_key?("products")
+ assert_match "good", hash["root"]["__content__"]
+ products = hash["root"]["products"]
assert products.has_key?("__content__")
- assert_match 'hello everyone', products['__content__']
+ assert_match "hello everyone", products["__content__"]
end
def test_parse_from_empty_string
- ActiveSupport::XmlMini.backend = 'REXML'
+ ActiveSupport::XmlMini.backend = "REXML"
assert_equal({}, ActiveSupport::XmlMini.parse(""))
end
def test_parse_from_frozen_string
- ActiveSupport::XmlMini.backend = 'REXML'
+ ActiveSupport::XmlMini.backend = "REXML"
xml_string = "<root></root>".freeze
assert_equal({"root" => {}}, ActiveSupport::XmlMini.parse(xml_string))
end