rspec-sidekiq 0.5.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +9 -9
  2. data/.gitattributes +22 -22
  3. data/.gitignore +1 -1
  4. data/.rspec +2 -2
  5. data/.simplecov +5 -0
  6. data/CHANGES.md +52 -35
  7. data/Gemfile +8 -2
  8. data/LICENSE +8 -8
  9. data/README.md +181 -135
  10. data/lib/rspec/sidekiq/batch.rb +46 -43
  11. data/lib/rspec/sidekiq/configuration.rb +12 -10
  12. data/lib/rspec/sidekiq/helpers/within_sidekiq_retries_exhausted_block.rb +11 -0
  13. data/lib/rspec/sidekiq/helpers.rb +2 -0
  14. data/lib/rspec/sidekiq/matchers/be_delayed.rb +67 -0
  15. data/lib/rspec/sidekiq/matchers/be_processed_in.rb +32 -32
  16. data/lib/rspec/sidekiq/matchers/be_retryable.rb +38 -38
  17. data/lib/rspec/sidekiq/matchers/be_unique.rb +28 -28
  18. data/lib/rspec/sidekiq/matchers/have_enqueued_job.rb +33 -33
  19. data/lib/rspec/sidekiq/matchers/have_enqueued_jobs.rb +11 -36
  20. data/lib/rspec/sidekiq/matchers.rb +10 -9
  21. data/lib/rspec/sidekiq/sidekiq.rb +24 -20
  22. data/lib/rspec/sidekiq/version.rb +4 -4
  23. data/lib/rspec-sidekiq.rb +7 -6
  24. data/rspec-sidekiq.gemspec +35 -34
  25. data/spec/rspec/sidekiq/batch_spec.rb +27 -0
  26. data/spec/rspec/sidekiq/helpers/retries_exhausted_spec.rb +18 -0
  27. data/spec/rspec/sidekiq/matchers/be_delayed_spec.rb +238 -0
  28. data/spec/rspec/sidekiq/matchers/be_processed_in_spec.rb +107 -28
  29. data/spec/rspec/sidekiq/matchers/be_retryable_spec.rb +128 -40
  30. data/spec/rspec/sidekiq/matchers/be_unique_spec.rb +49 -14
  31. data/spec/rspec/sidekiq/matchers/have_enqueued_job_spec.rb +73 -0
  32. data/spec/rspec/sidekiq/matchers/have_enqueued_jobs_spec.rb +9 -0
  33. data/spec/rspec/sidekiq/sidekiq_spec.rb +15 -0
  34. data/spec/rspec/sidekiq/version_spec.rb +4 -6
  35. data/spec/spec_helper.rb +27 -25
  36. data/spec/support/factories.rb +22 -0
  37. data/spec/support/init.rb +3 -3
  38. data/spec/support/test_worker.rb +7 -7
  39. data/spec/support/test_worker_alternative.rb +7 -7
  40. metadata +29 -21
  41. data/spec/support/test_worker_defaults.rb +0 -6
@@ -0,0 +1,15 @@
1
+ require "spec_helper"
2
+
3
+ describe RSpec::Sidekiq do
4
+ describe "#configure" do
5
+ it "yields with configuration" do
6
+ expect{ |block| RSpec::Sidekiq.configure(&block) }.to yield_with_args RSpec::Sidekiq.configuration
7
+ end
8
+ end
9
+
10
+ describe "#configuration" do
11
+ it "returns instance" do
12
+ expect(RSpec::Sidekiq.configuration).to be_a RSpec::Sidekiq::Configuration
13
+ end
14
+ end
15
+ end
@@ -1,7 +1,5 @@
1
- require "spec_helper"
2
-
3
- describe "Version" do
4
- subject { RSpec::Sidekiq::VERSION }
5
-
6
- expect_it { to eq("0.5.1") }
1
+ require "spec_helper"
2
+
3
+ describe RSpec::Sidekiq::VERSION do
4
+ expect_it { to eq("1.0.0") }
7
5
  end
data/spec/spec_helper.rb CHANGED
@@ -1,26 +1,28 @@
1
- require "simplecov"
2
- require "coveralls"
3
-
4
- require "sidekiq"
5
- require "rspec-sidekiq"
6
-
7
- require_relative "support/init"
8
-
9
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
10
- Coveralls::SimpleCov::Formatter,
11
- SimpleCov::Formatter::HTMLFormatter
12
- ]
13
- SimpleCov.start
14
-
15
- RSpec.configure do |config|
16
- config.alias_example_to :expect_it
17
-
18
- config.expect_with :rspec do |config|
19
- config.syntax = :expect
20
- end
21
- end
22
-
23
- RSpec::Core::MemoizedHelpers.module_eval do
24
- alias to should
25
- alias to_not should_not
1
+ require "simplecov"
2
+ require "coveralls"
3
+
4
+ require "sidekiq"
5
+ require "rspec-sidekiq"
6
+
7
+ require_relative "support/init"
8
+
9
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
10
+ Coveralls::SimpleCov::Formatter,
11
+ SimpleCov::Formatter::HTMLFormatter
12
+ ]
13
+ SimpleCov.start
14
+
15
+ RSpec.configure do |config|
16
+ config.alias_example_to :expect_it
17
+
18
+ config.expect_with :rspec do |config|
19
+ config.syntax = :expect
20
+ end
21
+
22
+ config.include RSpec::Sidekiq::Spec::Support::Factories
23
+ end
24
+
25
+ RSpec::Core::MemoizedHelpers.module_eval do
26
+ alias to should
27
+ alias to_not should_not
26
28
  end
@@ -0,0 +1,22 @@
1
+ module RSpec
2
+ module Sidekiq
3
+ module Spec
4
+ module Support
5
+ module Factories
6
+ def create_worker options = {}
7
+ clazz_name = "Worker#{ rand(36 ** 10).to_s 36 }"
8
+ clazz = Class.new do
9
+ include ::Sidekiq::Worker
10
+
11
+ sidekiq_options options
12
+
13
+ def perform
14
+ end
15
+ end
16
+ Object.const_set clazz_name, clazz
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
data/spec/support/init.rb CHANGED
@@ -1,3 +1,3 @@
1
- require_relative "test_worker"
2
- require_relative "test_worker_alternative"
3
- require_relative "test_worker_defaults"
1
+ require_relative "factories"
2
+ require_relative "test_worker"
3
+ require_relative "test_worker_alternative"
@@ -1,8 +1,8 @@
1
- class TestWorker
2
- include Sidekiq::Worker
3
-
4
- sidekiq_options queue: :data, retry: 5, unique: true
5
-
6
- def perform
7
- end
1
+ class TestWorker
2
+ include Sidekiq::Worker
3
+
4
+ sidekiq_options queue: :data, retry: 5, unique: true
5
+
6
+ def perform
7
+ end
8
8
  end
@@ -1,8 +1,8 @@
1
- class TestWorkerAlternative
2
- include Sidekiq::Worker
3
-
4
- sidekiq_options queue: "data", retry: false, unique: false
5
-
6
- def perform
7
- end
1
+ class TestWorkerAlternative
2
+ include Sidekiq::Worker
3
+
4
+ sidekiq_options queue: "data", retry: false, unique: false
5
+
6
+ def perform
7
+ end
8
8
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 1.0.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-09-10 00:00:00.000000000 Z
11
+ date: 2014-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: 2.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sidekiq
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,42 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 0.6.0
47
+ version: 0.7.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 0.6.0
54
+ version: 0.7.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: fuubar
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: '1.1'
61
+ version: 1.1.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - ! '>='
67
67
  - !ruby/object:Gem::Version
68
- version: '1.1'
68
+ version: 1.1.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - ! '>='
74
74
  - !ruby/object:Gem::Version
75
- version: '2.0'
75
+ version: 2.0.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - ! '>='
81
81
  - !ruby/object:Gem::Version
82
- version: '2.0'
82
+ version: 2.0.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: sidekiq
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -94,8 +94,7 @@ dependencies:
94
94
  - - ! '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: 2.4.0
97
- description: Simple testing of Sidekiq jobs via a collection of matchers and common
98
- tasks
97
+ description: Simple testing of Sidekiq jobs via a collection of matchers and helpers
99
98
  email: github@philostler.com
100
99
  executables: []
101
100
  extensions: []
@@ -104,6 +103,7 @@ files:
104
103
  - .gitattributes
105
104
  - .gitignore
106
105
  - .rspec
106
+ - .simplecov
107
107
  - CHANGES.md
108
108
  - Gemfile
109
109
  - LICENSE
@@ -111,6 +111,9 @@ files:
111
111
  - rspec-sidekiq.gemspec
112
112
  - lib/rspec/sidekiq/batch.rb
113
113
  - lib/rspec/sidekiq/configuration.rb
114
+ - lib/rspec/sidekiq/helpers/within_sidekiq_retries_exhausted_block.rb
115
+ - lib/rspec/sidekiq/helpers.rb
116
+ - lib/rspec/sidekiq/matchers/be_delayed.rb
114
117
  - lib/rspec/sidekiq/matchers/be_processed_in.rb
115
118
  - lib/rspec/sidekiq/matchers/be_retryable.rb
116
119
  - lib/rspec/sidekiq/matchers/be_unique.rb
@@ -120,15 +123,21 @@ files:
120
123
  - lib/rspec/sidekiq/sidekiq.rb
121
124
  - lib/rspec/sidekiq/version.rb
122
125
  - lib/rspec-sidekiq.rb
126
+ - spec/rspec/sidekiq/batch_spec.rb
127
+ - spec/rspec/sidekiq/helpers/retries_exhausted_spec.rb
128
+ - spec/rspec/sidekiq/matchers/be_delayed_spec.rb
123
129
  - spec/rspec/sidekiq/matchers/be_processed_in_spec.rb
124
130
  - spec/rspec/sidekiq/matchers/be_retryable_spec.rb
125
131
  - spec/rspec/sidekiq/matchers/be_unique_spec.rb
132
+ - spec/rspec/sidekiq/matchers/have_enqueued_job_spec.rb
133
+ - spec/rspec/sidekiq/matchers/have_enqueued_jobs_spec.rb
134
+ - spec/rspec/sidekiq/sidekiq_spec.rb
126
135
  - spec/rspec/sidekiq/version_spec.rb
127
136
  - spec/spec_helper.rb
137
+ - spec/support/factories.rb
128
138
  - spec/support/init.rb
129
139
  - spec/support/test_worker.rb
130
140
  - spec/support/test_worker_alternative.rb
131
- - spec/support/test_worker_defaults.rb
132
141
  homepage: http://github.com/philostler/rspec-sidekiq
133
142
  licenses:
134
143
  - MIT
@@ -149,9 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
158
  version: '0'
150
159
  requirements: []
151
160
  rubyforge_project:
152
- rubygems_version: 2.0.7
161
+ rubygems_version: 2.1.11
153
162
  signing_key:
154
163
  specification_version: 4
155
164
  summary: RSpec for Sidekiq
156
165
  test_files: []
157
- has_rdoc:
@@ -1,6 +0,0 @@
1
- class TestWorkerDefaults
2
- include Sidekiq::Worker
3
-
4
- def perform
5
- end
6
- end