test/torm/tools_test.rb in torm-0.2.0 vs test/torm/tools_test.rb in torm-0.2.1

- old
+ new

@@ -1,17 +1,20 @@ require 'minitest_helper' # This module is included in Torm, so we use that to test its behavior. describe Torm::Tools do describe '#atomic_save' do - tmp_file = 'tmp/atomic.test' + tmp_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'tmp')) + tmp_file = "#{tmp_dir}/atomic.test" + before do + Dir.mkdir(tmp_dir) unless File.exist?(tmp_dir) + end + after do File.delete(tmp_file) if File.exist?(tmp_file) - Dir.delete('tmp') if File.exist?('tmp') end it 'should save data to a file' do - Dir.mkdir('tmp') Torm.atomic_save(tmp_file, 'test') assert File.exist?(tmp_file) File.read(tmp_file).must_equal 'test' end end