Skip to content

Commit

Permalink
fixup! Bring back proper message for case when expectation is set for…
Browse files Browse the repository at this point in the history
… future, but job is scheduled with no wait
  • Loading branch information
pirj committed Nov 15, 2019
1 parent 2022f55 commit c8e9cc0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rspec/rails/matchers/active_job.rb
Expand Up @@ -157,6 +157,7 @@ def queue_match?(job)
def at_match?(job)
return true unless @at
return job[:at].nil? if @at == :no_wait
return false unless job[:at]

values_match?(@at, Time.at(job[:at]))
end
Expand Down
9 changes: 9 additions & 0 deletions spec/rspec/rails/matchers/active_job_spec.rb
Expand Up @@ -225,6 +225,15 @@ def self.name; "LoggingJob"; end
}.to have_enqueued_job.at(:no_wait)
end

it "has an enqueued job when providing at and there is no wait" do
date = Date.tomorrow.noon
expect {
expect {
hello_job.perform_later
}.to have_enqueued_job.at(date)
}.to raise_error(/expected to enqueue exactly 1 jobs, at .+ but enqueued 0/)
end

it "has an enqueued job when not providing at and there is a wait" do
date = Date.tomorrow.noon
expect {
Expand Down

0 comments on commit c8e9cc0

Please sign in to comment.