Skip to content

Commit

Permalink
add spec to EnqueueSidekiqJob
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismaximin committed Sep 11, 2023
1 parent bfb9e02 commit 4660eaf
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spec/rspec/sidekiq/matchers/enqueue_sidekiq_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,26 @@
end
end

context "immediately" do
it "passes if the job is enqueued immediately" do
expect { worker.perform_async }.to enqueue_sidekiq_job.immediately
expect { worker.perform_at(1.hour.ago) }.to enqueue_sidekiq_job.immediately
end

it "fails if the job is scheduled" do
specific_time = 1.hour.from_now
expect do
expect { worker.perform_at(specific_time) }.to enqueue_sidekiq_job.immediately
end.to raise_error { |error|
lines = error.message.split("\n")
expect(lines).to include(
match(/expected to have an enqueued .* job/),
match(/-{"at"=>nil}/)
)
}
end
end

describe "chainable" do
it "can chain expectations on the job" do
specific_time = 1.hour.from_now
Expand Down

0 comments on commit 4660eaf

Please sign in to comment.