ruby-changes:26833
From: nobu <ko1@a...>
Date: Sun, 20 Jan 2013 10:21:55 +0900 (JST)
Subject: [ruby-changes:26833] nobu:r38884 (trunk): test_parser.rb: tempfile
nobu 2013-01-20 10:19:44 +0900 (Sun, 20 Jan 2013) New Revision: 38884 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38884 Log: test_parser.rb: tempfile * test/rss/test_parser.rb (RSS::TestParser#setup): use temporary file, should not use fixed path working files. Modified files: trunk/test/rss/test_parser.rb Index: test/rss/test_parser.rb =================================================================== --- test/rss/test_parser.rb (revision 38883) +++ test/rss/test_parser.rb (revision 38884) @@ -1,4 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/test/rss/test_parser.rb#L1 -require "fileutils" +require "tempfile" require "rss-testcase" @@ -15,13 +15,15 @@ module RSS https://github.com/ruby/ruby/blob/trunk/test/rss/test_parser.rb#L15 #{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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/