From 96f53c26b32c902e7576a8817c1e2a42603b722a Mon Sep 17 00:00:00 2001 From: Artur Trzop Date: Wed, 19 Jun 2024 15:39:35 +0200 Subject: [PATCH] reproduce issue when Timecop mocks the Process.clock_gettime --- spec/support/config/timecop.rb | 3 +++ spec/timecop_spec.rb | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 spec/support/config/timecop.rb diff --git a/spec/support/config/timecop.rb b/spec/support/config/timecop.rb new file mode 100644 index 00000000..021bec9d --- /dev/null +++ b/spec/support/config/timecop.rb @@ -0,0 +1,3 @@ +# https://github.com/travisjeffery/timecop + +Timecop.mock_process_clock = true diff --git a/spec/timecop_spec.rb b/spec/timecop_spec.rb index a98ebcfb..9dba0410 100644 --- a/spec/timecop_spec.rb +++ b/spec/timecop_spec.rb @@ -2,6 +2,13 @@ let(:time_1) { Time.local(2015, 12, 1) } let(:time_2) { Time.local(2016, 1, 21) } + before do + Timecop.travel(time_1) + end + after do + #Timecop.return + end + it 'travel in time' do sleep 1 Timecop.travel(time_1)