<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -65,33 +65,39 @@ class XmlTest &lt; Test::Unit::TestCase
         }
       }
     }
-
+    
     Crack::XML.parse(xml).should == hash
   end
   
-  should &quot;should include attributes hash if present&quot; do
-    xml =&lt;&lt;-XML
-      &lt;opt&gt;
-        &lt;user login=&quot;grep&quot;&gt;Gary R Epstein&lt;/user&gt;
-        &lt;user&gt;Simon T Tyson&lt;/user&gt;
-      &lt;/opt&gt;
-    XML
-
-    Crack::XML.parse(xml)['opt']['user'].class.should == Array
+  context &quot;Parsing xml with text and attributes&quot; do
+    setup do
+      xml =&lt;&lt;-XML
+        &lt;opt&gt;
+          &lt;user login=&quot;grep&quot;&gt;Gary R Epstein&lt;/user&gt;
+          &lt;user&gt;Simon T Tyson&lt;/user&gt;
+        &lt;/opt&gt;
+      XML
+      @data = Crack::XML.parse(xml)
+    end
 
-    hash = {
-      'opt' =&gt; {
-        'user' =&gt; [
-          'Gary R Epstein',
-          'Simon T Tyson'
-        ]
+    should &quot;correctly parse text nodes&quot; do
+      @data.should == {
+        'opt' =&gt; {
+          'user' =&gt; [
+            'Gary R Epstein',
+            'Simon T Tyson'
+          ]
+        }
       }
-    }
-
-    Crack::XML.parse(xml).should == hash
+    end
+    
+    should &quot;be parse attributes for text node if present&quot; do
+      @data['opt']['user'][0].attributes.should == {'login' =&gt; 'grep'}
+    end
     
-    Crack::XML.parse(xml)['opt']['user'][0].attributes.should == { 'login' =&gt; 'grep' }
-    Crack::XML.parse(xml)['opt']['user'][1].attributes.should == {}
+    should &quot;default attributes to empty hash if not present&quot; do
+      @data['opt']['user'][1].attributes.should == {}
+    end
   end
 
   should &quot;should typecast an integer&quot; do</diff>
      <filename>test/xml_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>66a2a2b860765a4c6577eb064dc0faf49b68a0f0</id>
    </parent>
  </parents>
  <author>
    <name>John Nunemaker</name>
    <email>nunemaker@gmail.com</email>
  </author>
  <url>http://github.com/jnunemaker/crack/commit/8822c76f98f07e837ff6eeef7fbca9a2647e7bd0</url>
  <id>8822c76f98f07e837ff6eeef7fbca9a2647e7bd0</id>
  <committed-date>2009-06-30T20:23:26-07:00</committed-date>
  <authored-date>2009-06-30T20:12:33-07:00</authored-date>
  <message>Reorganized tests for attribute addition.</message>
  <tree>69ab0b49f656463ce88c79a81d8dc4aa5b88b194</tree>
  <committer>
    <name>John Nunemaker</name>
    <email>nunemaker@gmail.com</email>
  </committer>
</commit>
