test/ft_44b_restore.rb in openwferu-0.9.16 vs test/ft_44b_restore.rb in openwferu-0.9.17

- old
+ new

@@ -35,11 +35,10 @@ _print "${f:saved.f}" _print "${f:f}" end end - #def xxxx_0 def test_0 dotest( TestCase44b0, """ v @@ -63,18 +62,13 @@ restore :from_variable => "v" _print "${f:f}" end end - #def xxxx_1 def test_1 - dotest( - TestCase44b1, - """ -field_value_x -field_value - """.strip) + + dotest TestCase44b1, "field_value_x\nfield_value" end # # Test 2 @@ -111,18 +105,13 @@ _print "${f:f0}" _print "${f:f1}" end end - #def xxxx_3 def test_3 - dotest( - TestCase44b3, - """ -value_aa -value_b - """.strip) + + dotest TestCase44b3, "value_aa\nvalue_b" end # # Test 4 @@ -139,17 +128,94 @@ _print "${f:f0}" _print "${f:f1}" end end - #def xxxx_4 def test_4 - dotest( - TestCase44b4, - """ -value_a -value_b - """.strip) + + dotest TestCase44b4, "value_a\nvalue_b" + end + + # tests about set_fields... + + # + # Test 5 + # + + class Test44b5 < ProcessDefinition + sequence do + set_fields :value => { + "customer" => { "name" => "Zigue", "age" => 34 }, + "approved" => false } + _print "${f:customer.name} (${f:customer.age}) ${f:approved}" + #pp_fields + end + end + + def test_5 + + dotest Test44b5, "Zigue (34) false" + end + + # + # Test 6 + # + + class Test44b6 < ProcessDefinition + set_fields :value => { + "customer" => { "name" => "Zigue", "age" => 34 }, + "approved" => false } + sequence do + _print "${f:customer.name} (${f:customer.age}) ${f:approved}" + end + end + + def test_6 + + dotest Test44b6, "Zigue (34) false" + end + + # + # Test 7 + # + + # not yet + + class Test44b7 < ProcessDefinition + set_fields do + { + "customer" => { "name" => "Zigue", "age" => 34 }, + "approved" => false + } + end + sequence do + _print "${f:customer.name} (${f:customer.age}) ${f:approved}" + end + end + + def _test_7 + + dotest Test44b7, "Zigue (34) false" + end + + # + # Test 8 + # + + class Test44b8 < ProcessDefinition + set_fields :value => { + "customer" => { "name" => "Zigue", "age" => 34 }, + "approved" => false }, :merge_lead => :current + sequence do + _print "${f:customer.name} (${f:customer.age}) ${f:approved}" + end + end + + def test_8 + + li = LaunchItem.new Test44b8 + li.approved = true + dotest li, "Zigue (34) true" end end