title: Why do I get Active record relation instead of Array in rspec?
body: <p>I'm running tests on <code>Post</code>: </p>
  
  <p><code>expect(subject.query).to eq [previous_post, post, future_comment]</code></p>
  
  <p>But I get this error :</p>
  
  <pre><code>expected: [#&lt;Post id: 3, body: "Sed quis aut harum. Asperiores ad commodi tempore ...", ...&gt;]
  
  
  got: #&lt;ActiveRecord::Relation [#&lt;Post id: 3, body: "Sed quis aut harum. Asperiores a.....&gt;]&gt;
  </code></pre>
  
  <p>It expected an array but get an active record object. How can I resolve that ?</p>
  
  <p>This is the code i'm testing :</p>
  
  <pre><code>      def query
          scope = Post
                  .where(user_id: user.id)
                  .my_scope
                  .my_other_scope
                  .includes(:body)
  
          scope = case @options[:order_by]
                  when "older"
                    order_by_older(scope)
                  when "most_discussed"
                    order_by_most_discussed(scope)
                  else
                    order_by_older(scope)
                  end
  
          scope
        end
  </code></pre>