Sha256: 5f65ad7e14d9445bf180552c475e385f0f81b41ecb6e7477ac5a6e73db1a1d36
Contents?: true
Size: 1.33 KB
Versions: 8
Compression:
Stored size: 1.33 KB
Contents
require File.join(File.dirname(__FILE__), "..", "helper") class ShortcutMethodTest < Test::Unit::TestCase context "Calling []" do setup do ApricotEatsGorilla.setup do |s| s.sort_keys = true s.disable_tag_names_to_lower_camel_case = false s.disable_hash_keys_to_snake_case = false s.disable_hash_keys_to_symbol = false end end context "with an XML String" do should "return a Hash containing the XML content" do xml = "<root><name>Jungle Julia</name></root>" expected = { :name => "Jungle Julia" } result = ApricotEatsGorilla[xml] assert_equal expected, result end end context "with an XML String and a custom root node" do should "return a Hash containing the XML content starting at custom root" do xml = "<root><something><name>Jungle Julia</name></something></root>" expected = { :name => "Jungle Julia" } result = ApricotEatsGorilla[xml, "//something"] assert_equal expected, result end end context "with a Hash" do should "return an XML String containing the XML content" do hash = { "apricot" => "eats gorilla" } expected = "<apricot>eats gorilla</apricot>" result = ApricotEatsGorilla[hash] assert_equal expected, result end end end end
Version data entries
8 entries across 8 versions & 1 rubygems