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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzgyMTA1YzA0ZTU2MjU3YjJhNGQ0NzI0YmVkMjJkYTdmYTc3MzUzMg==
4
+ ZWJhYzU3ZmMzNzNmNDVmZDVlZWFkZjkwMWZlZjBjNjVkM2RjOTRkNg==
5
5
  data.tar.gz: !binary |-
6
- YzE0MzllMDU3MmQyZjI0MGM0YzA4ZTFhZjkxMjVkN2QxODNmNjdhZg==
6
+ OTY2YWY0ZDU0ZTM5NDVlNTkwY2FhNTA1YzFlNDdlYjZkZThmNWU0Ng==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NWIzZGE3MmZjM2I1MmQzN2M5NTdiOGY0ZmZhMjc0Nzg2NmQ1OTk4ZDE3M2I0
10
- OTMyMjk2ZWMzODkxMDQ5OTIyZWEyYTM5NGVlYWEwMjU2MDhjOGI1NTBmMzFl
11
- Yjc2ODY0YjQ0MDNkMWY1ZGY4OThkZWNmYmQwZGE1NjFhN2I4NWM=
9
+ YjA2ZGJiNjAzNmVmMDA5ZWRlOWMwMTM5OTNmMzNjMzU3OTllNjAzYTM2YTYx
10
+ ODVkZTc4NDA5MmY3NjYyMjY5ZDM2N2JiY2QzMzY3N2U5ZjZlNzBmNzlmOTFm
11
+ OWZkOTUzNDM3NmM3NmYyZDM3M2UzYjRhYzgzNDNjNzU1ZjI3NzE=
12
12
  data.tar.gz: !binary |-
13
- ZjdjYzcyMGE1OTE2NTU4MmMzNWUyNGMyYjU2NzBkNWUxNTUxMDgwZjMyMDM2
14
- N2MyNjVhNjVlZDQ0ZmY4Yzg3MzY2ZjVlMWQ0NWM1Yzg0OTk0OWFiZjRmMzk5
15
- OTc1ZGRlM2RiZmFlNmNjMTY5MDIyZDFjMzJhZmY1OTNjMTdlMDU=
13
+ ZjlhZDhjMmRhMmQ3NjkwZTQxMzA5ZDA1MjBkMTRjOGFjOTA0ODU1OTM4NzRm
14
+ MmNlNDE3MmQ5YjliNzQyNzU1OGNjY2Q4M2E4YTg1MzY2ZDNkY2UwZjhiNDYy
15
+ YTI5ZDk3Y2NjNTEzZjIzNWQ2N2VhNzI0MWRlYTliMDlhNDEzZTY=
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.5.0
2
+ ---
3
+ * Adds stub support for Sidekiq::Batch [kmayer#17]
4
+
1
5
  0.4.0
2
6
  ---
3
7
  * Bug fix for matcher failure if sidekiq_options were defined as strings vs symbols [mhuffnagle#16 & philostler]
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- MIT License
1
+ The MIT License (MIT)
2
2
 
3
3
  Copyright (c) 2013 Phil Ostler
4
4
 
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
- Yes do it! If there's a feature missing that you'd love them get in on the action!
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
@@ -2,4 +2,5 @@ require "sidekiq/testing"
2
2
 
3
3
  require "rspec/sidekiq/configuration"
4
4
  require "rspec/sidekiq/matchers"
5
- require "rspec/sidekiq/sidekiq"
5
+ require "rspec/sidekiq/sidekiq"
6
+ require "rspec/sidekiq/batch"
@@ -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
@@ -7,4 +7,4 @@ require "rspec/sidekiq/matchers/have_enqueued_jobs"
7
7
 
8
8
  RSpec.configure do |config|
9
9
  config.include RSpec::Sidekiq::Matchers
10
- end
10
+ end
@@ -23,7 +23,7 @@ module RSpec
23
23
  @actual = @klass.get_sidekiq_options["queue"]
24
24
  @actual.to_s == @expected.to_s
25
25
  end
26
-
26
+
27
27
  def negative_failure_message
28
28
  "expected #{@klass} to not be processed in the #{@expected} queue"
29
29
  end
@@ -29,7 +29,7 @@ module RSpec
29
29
  @actual = @klass.get_sidekiq_options["retry"]
30
30
  @actual == @expected
31
31
  end
32
-
32
+
33
33
  def negative_failure_message
34
34
  "expected #{@klass} to not #{description}"
35
35
  end
@@ -19,7 +19,7 @@ module RSpec
19
19
  @actual = @klass.get_sidekiq_options["unique"]
20
20
  @actual == true
21
21
  end
22
-
22
+
23
23
  def negative_failure_message
24
24
  "expected #{@klass} to not be unique in the queue"
25
25
  end
@@ -24,7 +24,7 @@ module RSpec
24
24
  @actual = klass.jobs.map { |job| job["args"] }
25
25
  @actual.include? @expected
26
26
  end
27
-
27
+
28
28
  def negative_failure_message
29
29
  "expected to not have an enqueued #{@klass} job with arguments #{@expected}"
30
30
  end
@@ -27,7 +27,7 @@ module RSpec
27
27
  @actual = klass.jobs.size
28
28
  @actual == @expected
29
29
  end
30
-
30
+
31
31
  def negative_failure_message
32
32
  "expected #{@klass} to not have #{@expected} enqueued job#{jobs_description}"
33
33
  end
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Sidekiq
3
- VERSION = "0.4.0"
3
+ VERSION = "0.5.0"
4
4
  end
5
- end
5
+ end
@@ -25,5 +25,5 @@ describe "Be Processed In matcher" do
25
25
  context "when queue is specified as a symbol" do
26
26
  expect_it { to be_processed_in :data }
27
27
  end
28
- end
28
+ end
29
29
  end
@@ -37,5 +37,5 @@ describe "Be Retryable matcher" do
37
37
  subject { TestWorkerAlternative }
38
38
  expect_it { to be_retryable false }
39
39
  end
40
- end
40
+ end
41
41
  end
@@ -11,5 +11,5 @@ describe "Be Unique matcher" do
11
11
 
12
12
  describe "one liner syntax" do
13
13
  expect_it { to be_unique }
14
- end
14
+ end
15
15
  end
@@ -3,5 +3,5 @@ require "spec_helper"
3
3
  describe "Version" do
4
4
  subject { RSpec::Sidekiq::VERSION }
5
5
 
6
- expect_it { to eq("0.4.0") }
6
+ expect_it { to eq("0.5.0") }
7
7
  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.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-05-15 00:00:00.000000000 Z
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.3
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: