From bf937e484f91bd79676c4fc641020abb6a9de83f Mon Sep 17 00:00:00 2001 From: Chaz Meyers Date: Sun, 4 Oct 2020 19:45:31 -0400 Subject: [PATCH] test was designed to test a job queued for a specific time in the future. the hardcoded time specified is now in the past, so the test broke. --- spec/textris/delay/sidekiq_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/textris/delay/sidekiq_spec.rb b/spec/textris/delay/sidekiq_spec.rb index ab454ac..78616c7 100644 --- a/spec/textris/delay/sidekiq_spec.rb +++ b/spec/textris/delay/sidekiq_spec.rb @@ -154,7 +154,9 @@ class XRelation < ActiveRecord::Relation; end describe '#delay_until' do it 'schedules action with proper params and execution time' do - MyTexter.delay_until(Time.new(2020, 1, 1)).delayed_action( + # sidekiq behaves differently if we're not queueing into the future + expected_scheduled_time = Time.new(Time.now.year + 1, 1, 1) + MyTexter.delay_until(expected_scheduled_time).delayed_action( '48111222333', 'Hi') expect_any_instance_of(MyTexter).to receive(:text).with( @@ -163,7 +165,7 @@ class XRelation < ActiveRecord::Relation; end scheduled_at = Time.at(Textris::Delay::Sidekiq::Worker.jobs.last['at']) - expect(scheduled_at).to eq Time.new(2020, 1, 1) + expect(scheduled_at).to eq expected_scheduled_time Textris::Delay::Sidekiq::Worker.drain end