Skip to content

Commit c8e9cc0

Browse files
committed
fixup! Bring back proper message for case when expectation is set for future, but job is scheduled with no wait
1 parent 2022f55 commit c8e9cc0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/rspec/rails/matchers/active_job.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def queue_match?(job)
157157
def at_match?(job)
158158
return true unless @at
159159
return job[:at].nil? if @at == :no_wait
160+
return false unless job[:at]
160161

161162
values_match?(@at, Time.at(job[:at]))
162163
end

spec/rspec/rails/matchers/active_job_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,15 @@ def self.name; "LoggingJob"; end
225225
}.to have_enqueued_job.at(:no_wait)
226226
end
227227

228+
it "has an enqueued job when providing at and there is no wait" do
229+
date = Date.tomorrow.noon
230+
expect {
231+
expect {
232+
hello_job.perform_later
233+
}.to have_enqueued_job.at(date)
234+
}.to raise_error(/expected to enqueue exactly 1 jobs, at .+ but enqueued 0/)
235+
end
236+
228237
it "has an enqueued job when not providing at and there is a wait" do
229238
date = Date.tomorrow.noon
230239
expect {

0 commit comments

Comments
 (0)