Do not include Active Support on tests

It was not done to be included
This commit is contained in:
Rafael Mendonça França 2015-01-04 18:57:43 -03:00
parent 9644cdcd3d
commit eded51f3b4
3 changed files with 24 additions and 30 deletions

View File

@ -8,15 +8,13 @@ require 'active_support/xml_mini'
require 'active_support/core_ext/hash/conversions'
class NokogiriEngineTest < ActiveSupport::TestCase
include ActiveSupport
def setup
@default_backend = XmlMini.backend
XmlMini.backend = 'Nokogiri'
@default_backend = ActiveSupport::XmlMini.backend
ActiveSupport::XmlMini.backend = 'Nokogiri'
end
def teardown
XmlMini.backend = @default_backend
ActiveSupport::XmlMini.backend = @default_backend
end
def test_file_from_xml
@ -56,13 +54,13 @@ class NokogiriEngineTest < ActiveSupport::TestCase
end
def test_setting_nokogiri_as_backend
XmlMini.backend = 'Nokogiri'
assert_equal XmlMini_Nokogiri, XmlMini.backend
ActiveSupport::XmlMini.backend = 'Nokogiri'
assert_equal ActiveSupport::XmlMini_Nokogiri, ActiveSupport::XmlMini.backend
end
def test_blank_returns_empty_hash
assert_equal({}, XmlMini.parse(nil))
assert_equal({}, XmlMini.parse(''))
assert_equal({}, ActiveSupport::XmlMini.parse(nil))
assert_equal({}, ActiveSupport::XmlMini.parse(''))
end
def test_array_type_makes_an_array
@ -207,9 +205,9 @@ class NokogiriEngineTest < ActiveSupport::TestCase
private
def assert_equal_rexml(xml)
parsed_xml = XmlMini.parse(xml)
parsed_xml = ActiveSupport::XmlMini.parse(xml)
xml.rewind if xml.respond_to?(:rewind)
hash = XmlMini.with_backend('REXML') { XmlMini.parse(xml) }
hash = ActiveSupport::XmlMini.with_backend('REXML') { ActiveSupport::XmlMini.parse(xml) }
assert_equal(hash, parsed_xml)
end
end

View File

@ -8,15 +8,13 @@ require 'active_support/xml_mini'
require 'active_support/core_ext/hash/conversions'
class NokogiriSAXEngineTest < ActiveSupport::TestCase
include ActiveSupport
def setup
@default_backend = XmlMini.backend
XmlMini.backend = 'NokogiriSAX'
@default_backend = ActiveSupport::XmlMini.backend
ActiveSupport::XmlMini.backend = 'NokogiriSAX'
end
def teardown
XmlMini.backend = @default_backend
ActiveSupport::XmlMini.backend = @default_backend
end
def test_file_from_xml
@ -57,13 +55,13 @@ class NokogiriSAXEngineTest < ActiveSupport::TestCase
end
def test_setting_nokogirisax_as_backend
XmlMini.backend = 'NokogiriSAX'
assert_equal XmlMini_NokogiriSAX, XmlMini.backend
ActiveSupport::XmlMini.backend = 'NokogiriSAX'
assert_equal ActiveSupport::XmlMini_NokogiriSAX, ActiveSupport::XmlMini.backend
end
def test_blank_returns_empty_hash
assert_equal({}, XmlMini.parse(nil))
assert_equal({}, XmlMini.parse(''))
assert_equal({}, ActiveSupport::XmlMini.parse(nil))
assert_equal({}, ActiveSupport::XmlMini.parse(''))
end
def test_array_type_makes_an_array
@ -208,9 +206,9 @@ class NokogiriSAXEngineTest < ActiveSupport::TestCase
private
def assert_equal_rexml(xml)
parsed_xml = XmlMini.parse(xml)
parsed_xml = ActiveSupport::XmlMini.parse(xml)
xml.rewind if xml.respond_to?(:rewind)
hash = XmlMini.with_backend('REXML') { XmlMini.parse(xml) }
hash = ActiveSupport::XmlMini.with_backend('REXML') { ActiveSupport::XmlMini.parse(xml) }
assert_equal(hash, parsed_xml)
end
end

View File

@ -2,19 +2,17 @@ require 'abstract_unit'
require 'active_support/xml_mini'
class REXMLEngineTest < ActiveSupport::TestCase
include ActiveSupport
def test_default_is_rexml
assert_equal XmlMini_REXML, XmlMini.backend
assert_equal ActiveSupport::XmlMini_REXML, ActiveSupport::XmlMini.backend
end
def test_set_rexml_as_backend
XmlMini.backend = 'REXML'
assert_equal XmlMini_REXML, XmlMini.backend
ActiveSupport::XmlMini.backend = 'REXML'
assert_equal ActiveSupport::XmlMini_REXML, ActiveSupport::XmlMini.backend
end
def test_parse_from_io
XmlMini.backend = 'REXML'
ActiveSupport::XmlMini.backend = 'REXML'
io = StringIO.new(<<-eoxml)
<root>
good
@ -29,9 +27,9 @@ class REXMLEngineTest < ActiveSupport::TestCase
private
def assert_equal_rexml(xml)
parsed_xml = XmlMini.parse(xml)
parsed_xml = ActiveSupport::XmlMini.parse(xml)
xml.rewind if xml.respond_to?(:rewind)
hash = XmlMini.with_backend('REXML') { XmlMini.parse(xml) }
hash = ActiveSupport::XmlMini.with_backend('REXML') { ActiveSupport::XmlMini.parse(xml) }
assert_equal(hash, parsed_xml)
end
end