aboutsummaryrefslogtreecommitdiffstats
path: root/test/rexml/test_contrib.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-27 13:45:04 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-27 13:45:04 +0000
commit3356c312cddcc95af59e648c4ad946ec969d9813 (patch)
tree5e6ba12c41b94d5288f38cd60a913244288ddc34 /test/rexml/test_contrib.rb
parent3c908895abe6c6f113ae9776480cff983a6cd4bb (diff)
downloadruby-3356c312cddcc95af59e648c4ad946ec969d9813.tar.gz
* test/rexml: Avoid fd leaks.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rexml/test_contrib.rb')
-rw-r--r--test/rexml/test_contrib.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/rexml/test_contrib.rb b/test/rexml/test_contrib.rb
index 917502fca6..fa84ebef3a 100644
--- a/test/rexml/test_contrib.rb
+++ b/test/rexml/test_contrib.rb
@@ -276,7 +276,7 @@ EOF
f.write( tn, Output.new(o = "", "ISO-8859-1") )
assert_equal(expected_iso, o.strip)
- doc = Document.new File.new(fixture_path('xmlfile-bug.xml'))
+ doc = File.open(fixture_path('xmlfile-bug.xml')) {|file| Document.new file }
tn = XPath.first(doc, "//nebenspalte/text()[2]")
assert_equal(expected_utf, tn.to_s.strip)
f.write( tn, Output.new(o = "", "ISO-8859-1") )
@@ -310,9 +310,10 @@ EOF
# Alun ap Rhisiart
def test_less_than_in_element_content
- source = File.new(fixture_path('ProductionSupport.xml'))
+ doc = File.open(fixture_path('ProductionSupport.xml')) do |source|
+ REXML::Document.new source
+ end
h = Hash.new
- doc = REXML::Document.new source
doc.elements.each("//CommonError") { |el|
h[el.elements['Key'].text] = 'okay'
}