Sha256: 25453b82a6f9642c03a73efe8b2887e958b42f3968f4232700220fa967545162

Contents?: true

Size: 841 Bytes

Versions: 20

Compression:

Stored size: 841 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 TestPersistOpen < 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|
      assert_equal obj, Open.json(tmpfile)
    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_open.rb
scout-essentials-1.6.2 test/scout/persist/test_open.rb
scout-essentials-1.6.1 test/scout/persist/test_open.rb
scout-essentials-1.6.0 test/scout/persist/test_open.rb
scout-essentials-1.3.1 test/scout/persist/test_open.rb
scout-essentials-1.3.0 test/scout/persist/test_open.rb
scout-essentials-1.2.0 test/scout/persist/test_open.rb
scout-essentials-1.1.1 test/scout/persist/test_open.rb
scout-essentials-1.1.0 test/scout/persist/test_open.rb
scout-essentials-1.0.0 test/scout/persist/test_open.rb
scout-gear-9.1.0 test/scout/persist/test_open.rb
scout-gear-9.0.0 test/scout/persist/test_open.rb
scout-gear-8.1.0 test/scout/persist/test_open.rb
scout-gear-8.0.0 test/scout/persist/test_open.rb
scout-gear-7.3.0 test/scout/persist/test_open.rb
scout-gear-7.2.0 test/scout/persist/test_open.rb
scout-gear-7.1.0 test/scout/persist/test_open.rb
scout-gear-6.0.0 test/scout/persist/test_open.rb
scout-gear-5.2.0 test/scout/persist/test_open.rb
scout-gear-5.1.1 test/scout/persist/test_open.rb