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

Version Path
scout-essentials-1.6.3 test/scout/persist/test_path.rb
scout-essentials-1.6.2 test/scout/persist/test_path.rb
scout-essentials-1.6.1 test/scout/persist/test_path.rb
scout-essentials-1.6.0 test/scout/persist/test_path.rb
scout-essentials-1.3.1 test/scout/persist/test_path.rb
scout-essentials-1.3.0 test/scout/persist/test_path.rb
scout-essentials-1.2.0 test/scout/persist/test_path.rb
scout-essentials-1.1.1 test/scout/persist/test_path.rb
scout-essentials-1.1.0 test/scout/persist/test_path.rb
scout-essentials-1.0.0 test/scout/persist/test_path.rb
scout-gear-9.1.0 test/scout/persist/test_path.rb
scout-gear-9.0.0 test/scout/persist/test_path.rb
scout-gear-8.1.0 test/scout/persist/test_path.rb
scout-gear-8.0.0 test/scout/persist/test_path.rb
scout-gear-7.3.0 test/scout/persist/test_path.rb
scout-gear-7.2.0 test/scout/persist/test_path.rb
scout-gear-7.1.0 test/scout/persist/test_path.rb
scout-gear-6.0.0 test/scout/persist/test_path.rb
scout-gear-5.2.0 test/scout/persist/test_path.rb
scout-gear-5.1.1 test/scout/persist/test_path.rb