<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -265,4 +265,18 @@ class BSONTest &lt; Test::Unit::TestCase
     assert val.keys.include?(:_id)
   end
 
+  # note we only test for _id here because in the general case we will
+  # write duplicates for :key and &quot;key&quot;. _id is a special case because
+  # we call has_key? to check for it's existance rather than just iterating
+  # over it like we do for the rest of the keys. thus, things like
+  # HashWithIndifferentAccess can cause problems for _id but not for other
+  # keys. rather than require rails to test with HWIA directly, we do this
+  # somewhat hacky test.
+  def test_no_duplicate_id
+    dup = {&quot;_id&quot; =&gt; &quot;foo&quot;, :_id =&gt; &quot;foo&quot;}
+    one = {&quot;_id&quot; =&gt; &quot;foo&quot;}
+
+    assert_equal @b.serialize(one).to_a, @b.serialize(dup).to_a
+  end
+
 end</diff>
      <filename>test/test_bson.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>79acba5417265e6ba53d3e4e3f9d7154629789d8</id>
    </parent>
  </parents>
  <author>
    <name>Mike Dirolf</name>
    <email>mike@10gen.com</email>
  </author>
  <url>http://github.com/mongodb/mongo-ruby-driver/commit/0f0c0e569d067418c6bd48d9128d851718aa5cf5</url>
  <id>0f0c0e569d067418c6bd48d9128d851718aa5cf5</id>
  <committed-date>2009-10-22T14:12:42-07:00</committed-date>
  <authored-date>2009-10-22T14:12:42-07:00</authored-date>
  <message>minor: test for duplicate _id (as string and symbol)</message>
  <tree>35ad4f62be6953a98d58d9e9e5c06ad40f74e4c5</tree>
  <committer>
    <name>Mike Dirolf</name>
    <email>mike@10gen.com</email>
  </committer>
</commit>
