Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions spec/textris/delay/sidekiq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down