# -*- coding: utf-8 -*- require 'test/unit' require File.join(File.dirname(__FILE__), "..", "lib", "apricoteatsgorilla") class HashToXmlTest < Test::Unit::TestCase def test_dead_simple hash = { "dude" => "likes beer" } expected = "likes beer" result = ApricotEatsGorilla.hash_to_xml(hash) assert_equal expected, result end def test_nested_hash hash = { "dude" => { "likes" => "beer", "hates" => "appletini" } } expected = "appletinibeer" result = ApricotEatsGorilla.hash_to_xml(hash) assert_equal expected, result end def test_nested_hash_with_array hash = { "dude" => { "likes" => [ "beer", "helicopters" ] } } expected = "beerhelicopters" result = ApricotEatsGorilla.hash_to_xml(hash) assert_equal expected, result end def test_nested_hash_with_array_containing_a_hash hash = { "dude" => { "likes" => [ { "beer" => "a lot" }, { "helicopters" => "a little more" } ] } } expected = "a lota little more" result = ApricotEatsGorilla.hash_to_xml(hash) assert_equal expected, result end end