title: Why are successive arrays collected from ObjectSpace not equal in my spec?
body: <p>I have a Project class with two ObjectSpace-related methods:</p>
  
  <pre><code>def self.all
    ObjectSpace.each_object(self).to_a
  end
  
  def self.count
    ObjectSpace.each_object(self).count
  end
  </code></pre>
  
  <p>This spec is failing:</p>
  
  <pre><code>it "can print all projects" do
    Project.all.should eq([@project1, @project2])
  end
  </code></pre>
  
  <p>with the following error:</p>
  
  <pre><code>Failure/Error: Project.all.should eq([@project1, @project2])
  
         expected: [#&lt;Project:0x007fd76a815508 @name="Building house", @tasks=[]&gt;, #&lt;Project:0x007fd76a815198 @name="Getting a loan from the Bank", @tasks=[]&gt;]
              got: [#&lt;Project:0x007fd7688336b8 @name="Building house", @tasks=[]&gt;, #&lt;Project:0x007fd7688dae40 @name="Building house", @tasks=[]&gt;, #&lt;Project:0x007fd768af4de8 @name="Getting a loan from the Bank", @tasks=[]&gt;, #&lt;Project:0x007fd768af5090 @name="Building house", @tasks=[]&gt;, #&lt;Project:0x007fd76a815198 @name="Getting a loan from the Bank", @tasks=[]&gt;, #&lt;Project:0x007fd76a815508 @name="Building house", @tasks=[]&gt;]
  </code></pre>
  
  <p>As you can see, this is giving me my objects in an array doubled but the code itself works fine. So why is my test failing?</p>