Permalink
Browse files

Using 'tempfile' module.

  • Loading branch information...
1 parent 5ee2aa1 commit a01cc383f6dcbb18e36cd3f001f878d1db9d0130 @bfontaine committed Jan 14, 2013
Showing with 9 additions and 8 deletions.
  1. +8 −8 tests/gdf_tests.rb
  2. +1 −0 tests/tests.rb
View
@@ -35,15 +35,15 @@ def test_sample_graph_to_gdf
def test_empty_graph_write_gdf
g = Graph.new
- g.write('/tmp/_graph_test.gdf')
- g2 = GDF.load('/tmp/_graph_test.gdf')
- assert_equal(g, g2)
- end
- def setup
- if File.exists? '/tmp/_graph_test.gdf'
- File.delete '/tmp/_graph_test.gdf'
- end
+ f = Tempfile.new([ 'foo', '.gdf' ])
+ f.close
+
+ g.write(f.path)
+ g2 = GDF.load(f.path)
+
+ assert_equal(g, g2)
+ f.unlink
end
end
View
@@ -2,6 +2,7 @@
# -*- coding: UTF-8 -*-
require 'test/unit'
+require 'tempfile'
require_relative '../lib/graph'
for t in Dir.glob( File.join( File.expand_path( File.dirname(__FILE__) ), '*_tests.rb' ) )

0 comments on commit a01cc38

Please sign in to comment.