I'm using Ruby 2.3.4 and rspec 3.6.0.
I'm writing a test for an object that uses rand(10000..99999)
. I can't find any docs on rand
to see what object it's a part of. I tried stubbing Kernel
, Object
, and Random
(see below) but none of my attempts resulted in rand
being stubbed for the object.
allow(Kernel).to receive(rand).and_return(12345)
allow(Object).to receive(rand).and_return(12345)
allow(Random).to receive(rand).and_return(12345)
Any help is appreciated.