From 8208e9872a20cc6a0da9bd199fe1187c38b7c0d3 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 20 Jan 2013 01:19:44 +0000 Subject: test_parser.rb: tempfile * test/rss/test_parser.rb (RSS::TestParser#setup): use temporary file, should not use fixed path working files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/rss/test_parser.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'test/rss/test_parser.rb') diff --git a/test/rss/test_parser.rb b/test/rss/test_parser.rb index 2e8c9be4d3..e9ab668214 100644 --- a/test/rss/test_parser.rb +++ b/test/rss/test_parser.rb @@ -1,4 +1,4 @@ -require "fileutils" +require "tempfile" require "rss-testcase" @@ -15,13 +15,15 @@ module RSS #{make_textinput} #{make_image} EOR - @rss_file = "rss10.rdf" - File.open(@rss_file, "w") {|f| f.print(@rss10)} + @rss_tmp = Tempfile.new(%w"rss10- .rdf") + @rss_tmp.print(@rss10) + @rss_tmp.close + @rss_file = @rss_tmp.path.untaint.trust end def teardown Parser.default_parser = @_default_parser - FileUtils.rm_f(@rss_file) + @rss_tmp.close(true) end def test_default_parser -- cgit v1.2.3