title: How to test with Rspec that a key exists inside a hash that contains an array of hashes
body: <p>I have a Model method that returns the following when executed.</p>
  
  <pre><code> {"data" =&gt; [
   {"product" =&gt; "PRODUCTA", "orders" =&gt; 3, "ordered" =&gt; 6, "revenue" =&gt; 600.0},
   {"product" =&gt; "PRODUCTB", "orders" =&gt; 1, "ordered" =&gt; 5, "revenue" =&gt; 100.0}]}
  </code></pre>
  
  <p>I would like to test to make sure that "revenue" in the first hash is there and then test that the value is equal to 600.</p>
  
  <pre><code>subject { described_class.order_items_by_revenue }
  
  it "includes revenue key" do
    expect(subject).to include(:revenue)
  end
  </code></pre>
  
  <p>I am completely lost on how to test this with Rspec.</p>