Sha256: 41ea0efe0d54a4be0965068821b089c9351a5dad815aee18d4ae9185de2686c8
Contents?: true
Size: 860 Bytes
Versions: 20
Compression:
Stored size: 860 Bytes
Contents
require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb') require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1') class TestPersistPath < Test::Unit::TestCase def obj ["TEST", 2, :symbol, {"a" => [1,2], :b => 3}] end def test_json obj = ["TEST", 2] TmpFile.with_file(obj.to_json) do |tmpfile| Path.setup(tmpfile) assert_equal obj, tmpfile.json end end def test_yaml TmpFile.with_file(obj.to_yaml) do |tmpfile| assert_equal obj, Open.yaml(tmpfile) end end def test_marshal TmpFile.with_file(Marshal.dump(obj)) do |tmpfile| assert_equal obj, Open.marshal(tmpfile) end end def test_yaml_io TmpFile.with_file(obj.to_yaml) do |tmpfile| Open.open(tmpfile) do |f| assert_equal obj, Open.yaml(f) end end end end
Version data entries
20 entries across 20 versions & 2 rubygems