test/lookup_att_test.rb in ruote-0.9.18 vs test/lookup_att_test.rb in ruote-0.9.19

- old
+ new

@@ -9,82 +9,82 @@ require 'openwfe/utils' class LookupAttTest < Test::Unit::TestCase - #def setup - #end + #def setup + #end - #def teardown - #end + #def teardown + #end - def test_0 + def test_0 - l0 = [ - {"name"=>"companyA","DunsNr" => "JGE4753"}, - {"name"=>"companyB","DunsNr" => "ZUTE8555"}, - {"name"=>"companyC","DunsNr" => "GTI6775"}, - {"name"=>"companyD","DunsNr" => "XUE6755"} - ] - h0 = { "supplierList" => l0 } + l0 = [ + {"name"=>"companyA","DunsNr" => "JGE4753"}, + {"name"=>"companyB","DunsNr" => "ZUTE8555"}, + {"name"=>"companyC","DunsNr" => "GTI6775"}, + {"name"=>"companyD","DunsNr" => "XUE6755"} + ] + h0 = { "supplierList" => l0 } - do_lookup_test( - h0, "supplierList", l0) - do_lookup_test( - h0, "supplierList.1", {"name"=>"companyB","DunsNr" => "ZUTE8555"}) - do_lookup_test( - h0, "supplierList.1.DunsNr", "ZUTE8555") + do_lookup_test( + h0, "supplierList", l0) + do_lookup_test( + h0, "supplierList.1", {"name"=>"companyB","DunsNr" => "ZUTE8555"}) + do_lookup_test( + h0, "supplierList.1.DunsNr", "ZUTE8555") - do_has_attribute_test( - h0, "supplierList.1.DunsNr", true) - do_has_attribute_test( - h0, "supplierList.1.Whatever", false) - do_has_attribute_test( - h0, "supplierList.whatever", false) - do_has_attribute_test( - h0, "whatever", false) + do_has_attribute_test( + h0, "supplierList.1.DunsNr", true) + do_has_attribute_test( + h0, "supplierList.1.Whatever", false) + do_has_attribute_test( + h0, "supplierList.whatever", false) + do_has_attribute_test( + h0, "whatever", false) - h1 = { "supplierList" => l0.to_s } - do_lookup_test( - h1, "supplierList.1.DunsNr", nil) + h1 = { "supplierList" => l0.to_s } + do_lookup_test( + h1, "supplierList.1.DunsNr", nil) - do_has_attribute_test( - nil, "whatever", false) - do_has_attribute_test( - {}, "whatever", false) - do_has_attribute_test( - [], "whatever", false) - do_has_attribute_test( - "string", "whatever", false) + do_has_attribute_test( + nil, "whatever", false) + do_has_attribute_test( + {}, "whatever", false) + do_has_attribute_test( + [], "whatever", false) + do_has_attribute_test( + "string", "whatever", false) - do_has_attribute_test( - [ nil, nil ], "1.name", false) - end + do_has_attribute_test( + [ nil, nil ], "1.name", false) + end - def test_1 + def test_1 - h = { "0" => [ "a", "A" ], "1" => { "b" => "B"} } + h = { "0" => [ "a", "A" ], "1" => { "b" => "B"} } - do_lookup_test(h, "0", [ "a", "A" ]) - do_lookup_test(h, "1.b", "B") - do_has_attribute_test(h, "0", true) - do_has_attribute_test(h, "1.b", true) - end + do_lookup_test(h, "0", [ "a", "A" ]) + do_lookup_test(h, "1.b", "B") + do_has_attribute_test(h, "0", true) + do_has_attribute_test(h, "1.b", true) + end - protected + protected - def do_lookup_test (container, expression, expected_value) + def do_lookup_test (container, expression, expected_value) - assert_equal( - expected_value, - OpenWFE::lookup_attribute(container, expression)) - end + assert_equal( + expected_value, + OpenWFE::lookup_attribute(container, expression)) + end - def do_has_attribute_test (container, expression, expected_boolean) + def do_has_attribute_test (container, expression, expected_boolean) - assert_equal( - expected_boolean, - OpenWFE::has_attribute?(container, expression)) - end + assert_equal( + expected_boolean, + OpenWFE::has_attribute?(container, expression)) + end end