Sha256: 102ca8f4c5037634b4c4ec529cf51c8ae0fb53ca9cb1f4145648205a0ebef9e1

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

#
# Testing OpenWFE
#
# John Mettraux at openwfe.org
#
# Sun Oct 29 16:18:25 JST 2006
#

require 'test/unit'

require 'openwfe/workitem'
require 'openwfe/flowexpressionid'

require 'rutest_utils'


#
# testing fei.to_h and wi.to_h
#

class HashTest < Test::Unit::TestCase

    #def setup
    #end

    #def teardown
    #end

    def test_fei_to_h

        fei0 = new_fei
        h = fei0.to_h
        fei1 = OpenWFE::FlowExpressionId.from_h(h)

        assert_equal fei0, fei1
    end

    def test_wi_to_h

        wi0 = OpenWFE::InFlowWorkItem.new
        wi0.fei = new_fei

        h = wi0.to_h
        #p h

        wi1 = OpenWFE::InFlowWorkItem.from_h(h)

        assert_equal wi0.fei, wi1.fei
        assert_equal wi0.attributes.length, wi1.attributes.length

        wi2 = OpenWFE::workitem_from_h(h)

        assert_equal wi0.fei, wi2.fei
        assert_equal wi0.attributes.length, wi2.attributes.length
    end

    def test_any_from_h

        li = OpenWFE::LaunchItem.new
        li.workflow_definition_url = "http://www.openwfe.org/nada"
        li.price = "USD 12"
        li.customer = "Captain Nemo"

        h = li.to_h
        #p h

        li1 = OpenWFE::workitem_from_h h

        assert_kind_of OpenWFE::LaunchItem, li1
        assert_equal "USD 12", li1.price
        assert_equal 3, li1.attributes.size
    end

end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
openwferu-0.9.17 test/hash_test.rb
ruote-0.9.18 test/hash_test.rb