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
This commit is contained in:
nobu 2013-01-20 01:19:44 +00:00
parent eed593eba6
commit 8208e9872a

View File

@ -1,4 +1,4 @@
require "fileutils" require "tempfile"
require "rss-testcase" require "rss-testcase"
@ -15,13 +15,15 @@ module RSS
#{make_textinput} #{make_textinput}
#{make_image} #{make_image}
EOR EOR
@rss_file = "rss10.rdf" @rss_tmp = Tempfile.new(%w"rss10- .rdf")
File.open(@rss_file, "w") {|f| f.print(@rss10)} @rss_tmp.print(@rss10)
@rss_tmp.close
@rss_file = @rss_tmp.path.untaint.trust
end end
def teardown def teardown
Parser.default_parser = @_default_parser Parser.default_parser = @_default_parser
FileUtils.rm_f(@rss_file) @rss_tmp.close(true)
end end
def test_default_parser def test_default_parser