File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,26 @@ Feature: have_enqueued_job matcher
39
39
When I run `rspec spec/jobs/upload_backups_job_spec.rb`
40
40
Then the examples should all pass
41
41
42
+ Scenario : Checking passed arguments to job - block syntax
43
+ Given a file named "spec/jobs/upload_backups_job_spec.rb" with:
44
+ """ruby
45
+ require "rails_helper"
46
+
47
+ RSpec.describe UploadBackupsJob do
48
+ it "matches with enqueued job" do
49
+ ActiveJob::Base.queue_adapter = :test
50
+ expect {
51
+ UploadBackupsJob.perform_later('backups.txt', rand(100), 'uninteresting third argument')
52
+ }.to have_enqueued_job.with { |file_name, seed|
53
+ expect(file_name).to eq 'backups.txt'
54
+ expect(seed).to be < 100
55
+ }
56
+ end
57
+ end
58
+ """
59
+ When I run `rspec spec/jobs/upload_backups_job_spec.rb`
60
+ Then the examples should all pass
61
+
42
62
Scenario : Checking job enqueued time
43
63
Given a file named "spec/jobs/upload_backups_job_spec.rb" with:
44
64
"""ruby
Original file line number Diff line number Diff line change @@ -240,6 +240,14 @@ def matches?(job)
240
240
# expect {
241
241
# HelloJob.set(queue: "low").perform_later(42)
242
242
# }.to have_enqueued_job.with(42).on_queue("low").at(:no_wait)
243
+ #
244
+ # expect {
245
+ # HelloJob.perform_later('rspec_rails', %w[ world rspec rails ], 42)
246
+ # }.to have_enqueued_job.with { |_from, to, times|
247
+ # # I don't want to check argument `from`
248
+ # expect(to).to include 'rspec'
249
+ # expect(times).to eq 42
250
+ # }
243
251
def have_enqueued_job ( job = nil )
244
252
check_active_job_adapter
245
253
ActiveJob ::HaveEnqueuedJob . new ( job )
You can’t perform that action at this time.
0 commit comments