rspec-sidekiq 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGES.md +4 -0
- data/LICENSE +1 -1
- data/README.md +9 -4
- data/lib/rspec-sidekiq.rb +2 -1
- data/lib/rspec/sidekiq/batch.rb +33 -0
- data/lib/rspec/sidekiq/matchers.rb +1 -1
- data/lib/rspec/sidekiq/matchers/be_processed_in.rb +1 -1
- data/lib/rspec/sidekiq/matchers/be_retryable.rb +1 -1
- data/lib/rspec/sidekiq/matchers/be_unique.rb +1 -1
- data/lib/rspec/sidekiq/matchers/have_enqueued_job.rb +1 -1
- data/lib/rspec/sidekiq/matchers/have_enqueued_jobs.rb +1 -1
- data/lib/rspec/sidekiq/version.rb +2 -2
- data/spec/rspec/sidekiq/matchers/be_processed_in_spec.rb +1 -1
- data/spec/rspec/sidekiq/matchers/be_retryable_spec.rb +1 -1
- data/spec/rspec/sidekiq/matchers/be_unique_spec.rb +1 -1
- data/spec/rspec/sidekiq/version_spec.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWJhYzU3ZmMzNzNmNDVmZDVlZWFkZjkwMWZlZjBjNjVkM2RjOTRkNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTY2YWY0ZDU0ZTM5NDVlNTkwY2FhNTA1YzFlNDdlYjZkZThmNWU0Ng==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjA2ZGJiNjAzNmVmMDA5ZWRlOWMwMTM5OTNmMzNjMzU3OTllNjAzYTM2YTYx
|
10
|
+
ODVkZTc4NDA5MmY3NjYyMjY5ZDM2N2JiY2QzMzY3N2U5ZjZlNzBmNzlmOTFm
|
11
|
+
OWZkOTUzNDM3NmM3NmYyZDM3M2UzYjRhYzgzNDNjNzU1ZjI3NzE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjlhZDhjMmRhMmQ3NjkwZTQxMzA5ZDA1MjBkMTRjOGFjOTA0ODU1OTM4NzRm
|
14
|
+
MmNlNDE3MmQ5YjliNzQyNzU1OGNjY2Q4M2E4YTg1MzY2ZDNkY2UwZjhiNDYy
|
15
|
+
YTI5ZDk3Y2NjNTEzZjIzNWQ2N2VhNzI0MWRlYTliMDlhNDEzZTY=
|
data/CHANGES.md
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
[![Travis CI][travis_ci_badge]][travis_ci]
|
6
6
|
[![Coveralls][coveralls_badge]][coveralls]
|
7
7
|
[![Gemnasium][gemnasium_badge]][gemnasium]
|
8
|
+
[![coderwall][coderwall_badge]][coderwall]
|
8
9
|
|
9
10
|
*Simple testing of Sidekiq jobs via a collection of matchers and common tasks*
|
10
11
|
|
@@ -26,7 +27,9 @@ end
|
|
26
27
|
```
|
27
28
|
```rspec-sidekiq``` requires ```sidekiq/testing``` by default so there is no need to include the line ```require "sidekiq/testing"``` inside your ```spec_helper.rb```.
|
28
29
|
|
29
|
-
*This has the effect of not pushing enqueued jobs to Redis but to a ```job``` array to enable testing ([see Sidekiq's testing wiki](https://github.com/mperham/sidekiq/wiki/Testing)). Thus, only include ```gem "rspec-sidekiq"``` in environments where this behaviour is required, such as the ```test``` group
|
30
|
+
*This has the effect of not pushing enqueued jobs to Redis but to a ```job``` array to enable testing ([see Sidekiq's testing wiki](https://github.com/mperham/sidekiq/wiki/Testing)). Thus, only include ```gem "rspec-sidekiq"``` in environments where this behaviour is required, such as the ```test``` group.*
|
31
|
+
|
32
|
+
If you are using Sidekiq Batches ([Sidekiq Pro feature](https://github.com/mperham/sidekiq/wiki/Batches)), ```rspec-sidekiq``` replaces the implementation (using the NullObject pattern) enabling testing without a Redis instance.
|
30
33
|
|
31
34
|
## Configuration
|
32
35
|
If you wish to modify the default behaviour, add the following to your ```spec_helper.rb``` file
|
@@ -98,10 +101,10 @@ describe AwesomeJob do
|
|
98
101
|
it { should be_processed_in :download }
|
99
102
|
it { should be_retryable false }
|
100
103
|
it { should be_unique }
|
101
|
-
|
104
|
+
|
102
105
|
it "enqueues another awesome job" do
|
103
106
|
subject.perform
|
104
|
-
|
107
|
+
|
105
108
|
expect(AnotherAwesomeJob).to have_enqueued_job("Awesome", true)
|
106
109
|
end
|
107
110
|
end
|
@@ -111,12 +114,14 @@ end
|
|
111
114
|
```bundle exec rspec spec```
|
112
115
|
|
113
116
|
## Contribute
|
114
|
-
|
117
|
+
Please do! If there's a feature missing that you'd love to see then get in on the action!
|
115
118
|
|
116
119
|
Issues/Pull Requests/Comments bring them on...
|
117
120
|
|
118
121
|
[code_climate]: https://codeclimate.com/github/philostler/rspec-sidekiq
|
119
122
|
[code_climate_badge]: https://codeclimate.com/github/philostler/rspec-sidekiq.png
|
123
|
+
[coderwall]: https://coderwall.com/philostler
|
124
|
+
[coderwall_badge]: https://api.coderwall.com/philostler/endorsecount.png
|
120
125
|
[coveralls]: https://coveralls.io/r/philostler/rspec-sidekiq
|
121
126
|
[coveralls_badge]: https://coveralls.io/repos/philostler/rspec-sidekiq/badge.png?branch=master
|
122
127
|
[gem_version_badge]: https://badge.fury.io/rb/rspec-sidekiq.png
|
data/lib/rspec-sidekiq.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
if defined?(Sidekiq::Batch)
|
2
|
+
module RSpec
|
3
|
+
module Sidekiq
|
4
|
+
class NullObject
|
5
|
+
def initialize(*)
|
6
|
+
end
|
7
|
+
|
8
|
+
def method_missing(*args, &block)
|
9
|
+
self
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class NullBatch < NullObject
|
14
|
+
def jobs(*)
|
15
|
+
yield
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class NullStatus < NullObject
|
20
|
+
def join
|
21
|
+
::Sidekiq::Worker.drain_all
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
RSpec.configure do |config|
|
28
|
+
config.before(:each) do
|
29
|
+
Sidekiq::Batch.stub(:new) { RSpec::Sidekiq::NullBatch.new }
|
30
|
+
Sidekiq::Batch::Status.stub(:new) { RSpec::Sidekiq::NullStatus.new }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phil Ostler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- LICENSE
|
110
110
|
- README.md
|
111
111
|
- rspec-sidekiq.gemspec
|
112
|
+
- lib/rspec/sidekiq/batch.rb
|
112
113
|
- lib/rspec/sidekiq/configuration.rb
|
113
114
|
- lib/rspec/sidekiq/matchers/be_processed_in.rb
|
114
115
|
- lib/rspec/sidekiq/matchers/be_retryable.rb
|
@@ -148,8 +149,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
149
|
version: '0'
|
149
150
|
requirements: []
|
150
151
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.0.
|
152
|
+
rubygems_version: 2.0.7
|
152
153
|
signing_key:
|
153
154
|
specification_version: 4
|
154
155
|
summary: RSpec for Sidekiq
|
155
156
|
test_files: []
|
157
|
+
has_rdoc:
|