Sha256: b8e96a9fbeb303bb3cfaff73c05fcc179539edcb581cabb59dd6fb821d0ebb34

Contents?: true

Size: 974 Bytes

Versions: 11

Compression:

Stored size: 974 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

11 entries across 11 versions & 1 rubygems

Version Path
ruote-2.1.11 test/unit/ut_13_serializer.rb
ruote-2.1.10 test/unit/ut_13_serializer.rb
ruote-2.1.9 test/unit/ut_13_serializer.rb
ruote-2.1.8 test/unit/ut_13_serializer.rb
ruote-2.1.7 test/unit/ut_13_serializer.rb
ruote-2.1.6 test/unit/ut_13_serializer.rb
ruote-2.1.5 test/unit/ut_13_serializer.rb
ruote-2.1.4 test/unit/ut_13_serializer.rb
ruote-2.1.3 test/unit/ut_13_serializer.rb
ruote-2.1.2 test/unit/ut_13_serializer.rb
ruote-2.1.1 test/unit/ut_13_serializer.rb