Skip to content

Instantly share code, notes, and snippets.

@phlcastro
Created May 14, 2016 01:59
Show Gist options
  • Save phlcastro/41edf06a5439c906dc5460a01afd744e to your computer and use it in GitHub Desktop.
Save phlcastro/41edf06a5439c906dc5460a01afd744e to your computer and use it in GitHub Desktop.
How to deal with random values on RSpec
allow(YourClass).to receive(:your_method).with('your parameter').and_return('your result')
#ie.:
allow(Random).to receive(:rand).with(1..9).and_return(7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment