diff options
author | ayumin <ayumin@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-27 19:44:02 +0000 |
---|---|---|
committer | ayumin <ayumin@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-27 19:44:02 +0000 |
commit | 2865b450e05f7e9e80f4af6c0c29d0bd4014840d (patch) | |
tree | 4b435b584443f8ced858abcdd5b956e173aee550 /test/psych | |
parent | fcb2bb8bd696ee8c455a7874b657453286a4d6d9 (diff) | |
download | ruby-2865b450e05f7e9e80f4af6c0c29d0bd4014840d.tar.gz |
* test/psych/test_yamlstore.rb: use tmpdir for tmpfile.
* test/syck/test_yamlstore.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych')
-rw-r--r-- | test/psych/test_yamlstore.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/psych/test_yamlstore.rb b/test/psych/test_yamlstore.rb index e99ba30dab..d607013ada 100644 --- a/test/psych/test_yamlstore.rb +++ b/test/psych/test_yamlstore.rb @@ -1,18 +1,26 @@ require 'test/unit' require 'yaml/store' +require 'tmpdir' + Psych::Store = YAML::Store unless defined?(Psych::Store) module Psych class YAMLStoreTest < Test::Unit::TestCase def setup @engine, YAML::ENGINE.yamler = YAML::ENGINE.yamler, 'psych' - @yamlstore_file = "yamlstore.tmp.#{Process.pid}" + @dir = Dir.mktmpdir("rubytest-file") + File.chown(-1, Process.gid, @dir) + @yamlstore_file = make_tmp_filename("yamlstore") @yamlstore = YAML::Store.new(@yamlstore_file) end def teardown YAML::ENGINE.yamler = @engine - File.unlink(@yamlstore_file) rescue nil + FileUtils.remove_entry_secure @dir + end + + def make_tmp_filename(prefix) + @dir + "/" + prefix + File.basename(__FILE__) + ".#{$$}.test" end def test_opening_new_file_in_readonly_mode_should_result_in_empty_values |