title: how can I return 2 values from an Rspec Mock?
body: <p>I'm trying to mock <code>Open3.capture2</code> and I want to return a string and a double for the status. Any idea how to return 2 value?</p>
  
  <p>code under test:</p>
  
  <pre><code>stdout, status = Open3.capture2(command)
  
  if status.success?
    puts stdout
  else
    puts stdout
    throw "error: could not execute"
  end
  </code></pre>
  
  <p>spec:</p>
  
  <pre><code>it "throws an error" do
    status = double("status message", :success? =&gt; false)
    allow(Open3).to receive(:capture2).and_return("wat?", status)
    ScreenShotWorker.new.perform(url: "www.google.com")
    expect(Open3).to have_received(:capture2)
  end
  </code></pre>