Here's a no-fuss way to mock `rand` in your specs:
allow_any_instance_of(Object).to receive(:rand).and_return(5)
A Mastodon instance for Rubyists & friends