Sha256: 8642baaab1848d53d1713a5ceabaef390925467842b56a426791ea28fba3918a

Contents?: true

Size: 973 Bytes

Versions: 2

Compression:

Stored size: 973 Bytes

Contents

#
# testing ruote
#
# Thu Aug 27 10:44:44 JST 2009
#

require File.join(File.dirname(__FILE__), '..', 'test_helper.rb')

require 'ruote/util/serializer'


class UtSerializerTest < Test::Unit::TestCase

  class Vehicle
    attr_accessor :type
    def initialize(t)
      @type = t
    end
  end

  #def setup
  #end
  #def teardown
  #end

  def test_yaml

    s = Ruote::Serializer.new(:yaml)

    data = s.encode(Vehicle.new('bike'))

    assert_match /^---/, data

    v = s.decode(data)

    assert_equal Vehicle, v.class
    assert_equal 'bike', v.type
  end

  def test_marshal

    s = Ruote::Serializer.new(:marshal)

    data = s.encode(Vehicle.new('bike'))

    v = s.decode(data)

    assert_equal Vehicle, v.class
    assert_equal 'bike', v.type
  end

  def test_marshal64

    s = Ruote::Serializer.new(:marshal64)

    data = s.encode(Vehicle.new('bike'))

    v = s.decode(data)

    assert_equal Vehicle, v.class
    assert_equal 'bike', v.type
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
ruote-maestrodev-2.2.1 test/unit/ut_13_serializer.rb
ruote-2.2.0 test/unit/ut_13_serializer.rb