How to write my spec without using the sleep (1.second) method? When I delete a dream, my tests are interrupted because they return the same timestamp?
I have the following class method:
def skip qs = find_or_create_by(user_id: user_id) qs.set_updated_at qs.n_skip += 1 qs.save! end
and the following specification:
qs = skip(user.id) sleep(1.second) qs2 = skip(user.id) qs.should_not be_nil qs2.should_not be_nil (qs.updated_at < qs2.updated_at).should be_true
source share