Skip to content

Commit

Permalink
Improve enqueued_job at specs from #2350
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Jun 10, 2020
1 parent 85a146c commit 4e360fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions spec/rspec/rails/matchers/active_job_spec.rb
Expand Up @@ -225,10 +225,10 @@ def self.name; "LoggingJob"; end
}.to have_enqueued_job.at(time)
end

skip_freeze_time = method_defined?(:freeze_time) ? false : "#freeze_time is undefined"
it "works with time offsets", skip: skip_freeze_time do
freeze_time do
time = Time.current
it "works with time offsets" do
# note that Time.current does not replicate Rails behavior for 5 seconds from now.
time = Time.current.change(usec: 0)
travel_to time do
expect { hello_job.set(wait: 5).perform_later }.to have_enqueued_job.at(time + 5)
end
end
Expand Down

0 comments on commit 4e360fb

Please sign in to comment.