Last Updated: February 25, 2016
·
548
· rgeyer

Use Kernel.sleep() rather than sleep() so that you can flexmock it.

Don't do this

sleep(10)

Instead do this

Kernel.sleep(10)

So that you can do this

it 'can skip sleeping when testing' do
  flexmock(Kernel).should_receive(:sleep)
end

Written by Ryan Geyer

Recommend
Say Thanks
Update Notifications Off
Respond