title: How to stub #sample with RSpec?
body: <p>How can I stub the return value for <code>Array#sample</code> in RSpec?</p>
  
  <p>Given that the method I am testing contains the following line:  </p>
  
  <p><code>["Rock", "Paper", "Scissors"].sample
  </code></p>
  
  <p>I require something like the following line, which doesn't stub the behaviour.</p>
  
  <p><code>allow(Array).to receive(:sample) { "Rock" }
  </code></p>