Skip to content

Commit 00bd256

Browse files
committed
Add a spec for one job performed and one enqueued
1 parent efa83dc commit 00bd256

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

spec/rspec/rails/matchers/active_job_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,20 @@ def self.name; "LoggingJob"; end
9898
expect { }.not_to have_enqueued_job
9999
end
100100

101+
context "when previously enqueued jobs were performed" do
102+
include ActiveJob::TestHelper
103+
104+
before { stub_const("HeavyLiftingJob", heavy_lifting_job) }
105+
106+
it "counts newly enqueued jobs" do
107+
heavy_lifting_job.perform_later
108+
expect {
109+
perform_enqueued_jobs
110+
hello_job.perform_later
111+
}.to have_enqueued_job(hello_job)
112+
end
113+
end
114+
101115
context "when job is retried" do
102116
include ActiveJob::TestHelper
103117

0 commit comments

Comments
 (0)