Skip to content

Commit b28ca05

Browse files
committed
Cleanup readme for prerelease
1 parent cbbcc84 commit b28ca05

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

README.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
**Welcome @wspurgin as new maintainer for `rspec-sidekiq`!**
22

3-
# RSpec for Sidekiq
4-
53
[![RubyGems][gem_version_badge]][ruby_gems]
64
[![Github Actions CI][github_actions_badge]][github_actions]
75

@@ -65,33 +63,31 @@ expect { AwesomeJob.set(queue: "high").perform_async }.to enqueue_sidekiq_job.on
6563
specific_time = 1.hour.from_now
6664
expect { AwesomeJob.perform_at(specific_time) }.to enqueue_sidekiq_job.at(specific_time)
6765

66+
# In a specific interval (be mindful of freezing or managing time here)
67+
freeze_time do
68+
expect { AwesomeJob.perform_in(1.hour) }.to enqueue_sidekiq_job.in(1.hour)
69+
end
70+
6871
# Combine and chain them as desired
6972
expect { AwesomeJob.perform_at(specific_time, "Awesome!") }.to(
7073
enqueue_sidekiq_job(AwesomeJob)
7174
.with("Awesome!")
7275
.on("default")
7376
.at(specific_time)
7477
)
75-
76-
# In a specific interval (be mindful of freezing or managing time here)
77-
freeze_time do
78-
expect { AwesomeJob.perform_in(1.hour) }.to enqueue_sidekiq_job.in(1.hour)
79-
end
8078
```
8179

8280
### have_enqueued_sidekiq_job
83-
*Describes that there should be an enqueued job with the specified arguments*
84-
85-
**Note:** When using rspec-rails >= 3.4, use `have_enqueued_sidekiq_job` instead to
86-
prevent a name clash with rspec-rails' ActiveJob matcher.
81+
*Describes that there should be an enqueued job with the **specified
82+
arguments***
8783

8884
```ruby
8985
AwesomeJob.perform_async 'Awesome', true
9086
# test with...
9187
expect(AwesomeJob).to have_enqueued_sidekiq_job('Awesome', true)
9288
```
9389

94-
You can use the built-in args matchers too:
90+
You can use the built-in RSpec args matchers too:
9591
```ruby
9692
AwesomeJob.perform_async({"something" => "Awesome", "extra" => "stuff"})
9793

@@ -157,10 +153,10 @@ expect(Sidekiq::Worker).to have_enqueued_sidekiq_job(
157153
#### Testing a job is _not_ enqueued
158154

159155
The negative case for `have_enqueued_sidekiq_job` is provided, but it's
160-
important to remember that `have_enqueued_sidekiq_job` is an expectation of
161-
specific _arguments_. In other words, passing no arguments to
162-
`have_enqueued_sidekiq_job` is implicitly telling the matcher to look for jobs
163-
_without_ arguments.
156+
important to remember that `have_enqueued_sidekiq_job` is an expectation that a
157+
job is enqueued _with specific arguments_. In other words, passing no arguments
158+
to `have_enqueued_sidekiq_job` is implicitly telling the matcher to look for
159+
jobs _without_ arguments.
164160

165161
In short, unless you tell the matcher that _no_ jobs with _any_ arguments should be enqueued, you'll get the wrong result:
166162

0 commit comments

Comments
 (0)