rspec-sidekiq 3.1.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +24 -0
  3. data/LICENSE +12 -0
  4. data/README.md +198 -81
  5. data/lib/rspec/sidekiq/batch.rb +20 -2
  6. data/lib/rspec/sidekiq/configuration.rb +13 -2
  7. data/lib/rspec/sidekiq/matchers/base.rb +256 -0
  8. data/lib/rspec/sidekiq/matchers/be_delayed.rb +17 -3
  9. data/lib/rspec/sidekiq/matchers/enqueue_sidekiq_job.rb +87 -0
  10. data/lib/rspec/sidekiq/matchers/have_enqueued_sidekiq_job.rb +25 -0
  11. data/lib/rspec/sidekiq/matchers.rb +13 -8
  12. data/lib/rspec/sidekiq/sidekiq.rb +1 -1
  13. data/lib/rspec/sidekiq/version.rb +1 -1
  14. metadata +89 -39
  15. data/.gitattributes +0 -22
  16. data/.gitignore +0 -2
  17. data/.rspec +0 -4
  18. data/.simplecov +0 -5
  19. data/Gemfile +0 -9
  20. data/lib/rspec/sidekiq/matchers/have_enqueued_job.rb +0 -183
  21. data/rspec-sidekiq.gemspec +0 -39
  22. data/spec/rspec/sidekiq/batch_spec.rb +0 -83
  23. data/spec/rspec/sidekiq/helpers/retries_exhausted_spec.rb +0 -40
  24. data/spec/rspec/sidekiq/matchers/be_delayed_spec.rb +0 -238
  25. data/spec/rspec/sidekiq/matchers/be_expired_in_spec.rb +0 -57
  26. data/spec/rspec/sidekiq/matchers/be_processed_in_spec.rb +0 -114
  27. data/spec/rspec/sidekiq/matchers/be_retryable_spec.rb +0 -129
  28. data/spec/rspec/sidekiq/matchers/be_unique_spec.rb +0 -115
  29. data/spec/rspec/sidekiq/matchers/have_enqueued_job_spec.rb +0 -229
  30. data/spec/rspec/sidekiq/matchers/save_backtrace_spec.rb +0 -136
  31. data/spec/rspec/sidekiq/sidekiq_spec.rb +0 -15
  32. data/spec/spec_helper.rb +0 -29
  33. data/spec/support/factories.rb +0 -33
  34. data/spec/support/init.rb +0 -6
  35. data/spec/support/test_action_mailer.rb +0 -6
  36. data/spec/support/test_job.rb +0 -6
  37. data/spec/support/test_resource.rb +0 -10
  38. data/spec/support/test_worker.rb +0 -8
  39. data/spec/support/test_worker_alternative.rb +0 -8
data/.simplecov DELETED
@@ -1,5 +0,0 @@
1
- SimpleCov.start do
2
- add_filter '/spec/'
3
-
4
- coverage_dir 'tmp/spec_coverage'
5
- end
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- platforms :rbx do
4
- gem 'rubysl', '~> 2.0'
5
- gem 'psych'
6
- gem 'rubinius-developer_tools'
7
- end
8
-
9
- gemspec
@@ -1,183 +0,0 @@
1
- module RSpec
2
- module Sidekiq
3
- module Matchers
4
- def have_enqueued_sidekiq_job(*expected_arguments)
5
- HaveEnqueuedJob.new expected_arguments
6
- end
7
-
8
- def have_enqueued_job(*expected_arguments)
9
- warn "[DEPRECATION] `have_enqueued_job` is deprecated. Please use `have_enqueued_sidekiq_job` instead."
10
- have_enqueued_sidekiq_job(*expected_arguments)
11
- end
12
-
13
- class JobOptionParser
14
- attr_reader :job
15
-
16
- def initialize(job)
17
- @job = job
18
- end
19
-
20
- def matches?(option, value)
21
- raise ArgumentError, "Option `#{option}` is not defined." unless %w(in at).include?(option.to_s)
22
- send("#{option}_evaluator", value)
23
- end
24
-
25
- private
26
-
27
- def at_evaluator(value)
28
- return false if job['at'].to_s.empty?
29
- value.to_time.to_i == Time.at(job['at']).to_i
30
- end
31
-
32
- def in_evaluator(value)
33
- return false if job['at'].to_s.empty?
34
- (Time.now + value).to_i == Time.at(job['at']).to_i
35
- end
36
- end
37
-
38
- class JobMatcher
39
- attr_reader :jobs
40
-
41
- def initialize(klass)
42
- @jobs = unwrap_jobs(klass.jobs)
43
- end
44
-
45
- def present?(arguments, options)
46
- !!find_job(arguments, options)
47
- end
48
-
49
- private
50
-
51
- def matches?(job, arguments, options)
52
- arguments_matches?(job, arguments) &&
53
- options_matches?(job, options)
54
- end
55
-
56
- def arguments_matches?(job, arguments)
57
- arguments_got = job_arguments(job)
58
- contain_exactly?(arguments, arguments_got)
59
- end
60
-
61
- def options_matches?(job, options)
62
- options.all? do |option, value|
63
- parser = JobOptionParser.new(job)
64
- parser.matches?(option, value)
65
- end
66
- end
67
-
68
- def find_job(arguments, options)
69
- jobs.find { |job| matches?(job, arguments, options) }
70
- end
71
-
72
- def job_arguments(job)
73
- args = job['args']
74
- return args[0]['arguments'] if args.is_a?(Array) && args[0].is_a?(Hash) && args[0].has_key?('arguments')
75
- args
76
- end
77
-
78
- def unwrap_jobs(jobs)
79
- return jobs if jobs.is_a?(Array)
80
- jobs.values.flatten
81
- end
82
-
83
- def contain_exactly?(expected, got)
84
- exactly = RSpec::Matchers::BuiltIn::ContainExactly.new(expected)
85
- exactly.matches?(got)
86
- end
87
- end
88
-
89
- class HaveEnqueuedJob
90
- attr_reader :klass, :expected_arguments, :actual_arguments, :expected_options, :actual_options
91
-
92
- def initialize(expected_arguments)
93
- @expected_arguments = normalize_arguments(expected_arguments)
94
- @expected_options = {}
95
- end
96
-
97
- def matches?(klass)
98
- @klass = klass
99
- @actual_arguments = unwrapped_job_arguments(klass.jobs)
100
- @actual_options = unwrapped_job_options(klass.jobs)
101
- JobMatcher.new(klass).present?(expected_arguments, expected_options)
102
- end
103
-
104
- def at(timestamp)
105
- @expected_options['at'] = timestamp
106
- self
107
- end
108
-
109
- def in(interval)
110
- @expected_options['in'] = interval
111
- self
112
- end
113
-
114
- def description
115
- "have an enqueued #{klass} job with arguments #{expected_arguments}"
116
- end
117
-
118
- def failure_message
119
- message = ["expected to have an enqueued #{klass} job"]
120
- message << " arguments: #{expected_arguments}" if expected_arguments
121
- message << " options: #{expected_options}" if expected_options.any?
122
- message << "found"
123
- message << " arguments: #{actual_arguments}" if expected_arguments
124
- message << " options: #{actual_options}" if expected_options.any?
125
- message.join("\n")
126
- end
127
-
128
- def failure_message_when_negated
129
- message = ["expected not to have an enqueued #{klass} job"]
130
- message << " arguments: #{expected_arguments}" if expected_arguments.any?
131
- message << " options: #{expected_options}" if expected_options.any?
132
- message.join("\n")
133
- end
134
-
135
- private
136
-
137
- def unwrapped_job_options(jobs)
138
- jobs = jobs.values if jobs.is_a?(Hash)
139
- jobs.flatten.map do |job|
140
- { 'at' => job['at'] }
141
- end
142
- end
143
-
144
- def unwrapped_job_arguments(jobs)
145
- if jobs.is_a? Hash
146
- jobs.values.flatten.map do |job|
147
- map_arguments(job)
148
- end
149
- else
150
- map_arguments(jobs)
151
- end.map { |job| job.flatten }
152
- end
153
-
154
- def map_arguments(job)
155
- args = job_arguments(job) || job
156
- if args.respond_to?(:any?) && args.any? { |e| e.is_a? Hash }
157
- args.map { |a| map_arguments(a) }
158
- else
159
- args
160
- end
161
- end
162
-
163
- def job_arguments(hash)
164
- hash['arguments'] || hash['args'] if hash.is_a? Hash
165
- end
166
-
167
- def normalize_arguments(args)
168
- if args.is_a?(Array)
169
- args.map{ |x| normalize_arguments(x) }
170
- elsif args.is_a?(Hash)
171
- args.each_with_object({}) do |(key, value), hash|
172
- hash[key.to_s] = normalize_arguments(value)
173
- end
174
- elsif args.is_a?(Symbol)
175
- args.to_s
176
- else
177
- args
178
- end
179
- end
180
- end
181
- end
182
- end
183
- end
@@ -1,39 +0,0 @@
1
- require File.expand_path('../lib/rspec/sidekiq/version', __FILE__)
2
-
3
- Gem::Specification.new do |s|
4
- s.name = 'rspec-sidekiq'
5
- s.version = RSpec::Sidekiq::VERSION
6
- s.platform = Gem::Platform::RUBY
7
- s.author = 'Phil Ostler'
8
- s.email = 'github@philostler.com'
9
- s.homepage = 'http://github.com/philostler/rspec-sidekiq'
10
- s.summary = 'RSpec for Sidekiq'
11
- s.description = 'Simple testing of Sidekiq jobs via a collection of matchers and helpers'
12
- s.license = 'MIT'
13
-
14
- s.add_dependency 'rspec-core', '~> 3.0', '>= 3.0.0'
15
- s.add_dependency 'sidekiq', '>= 2.4.0'
16
-
17
- s.add_development_dependency 'rspec'
18
- s.add_development_dependency 'coveralls'
19
- s.add_development_dependency 'fuubar'
20
- s.add_development_dependency 'activejob'
21
- s.add_development_dependency 'actionmailer'
22
- s.add_development_dependency 'activerecord'
23
- s.add_development_dependency 'activemodel'
24
- s.add_development_dependency 'activesupport'
25
-
26
-
27
- s.files = Dir['.gitattributes'] +
28
- Dir['.gitignore'] +
29
- Dir['.rspec'] +
30
- Dir['.simplecov'] +
31
- Dir['.travis'] +
32
- Dir['CHANGES.md'] +
33
- Dir['Gemfile'] +
34
- Dir['LICENSE'] +
35
- Dir['README.md'] +
36
- Dir['rspec-sidekiq.gemspec'] +
37
- Dir['**/*.rb']
38
- s.require_paths = ['lib']
39
- end
@@ -1,83 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe 'Batch' do
4
- module Sidekiq
5
- module Batch
6
- class Status
7
- end
8
- end
9
- end
10
-
11
- load File.expand_path(File.join(File.dirname(__FILE__), '../../../lib/rspec/sidekiq/batch.rb'))
12
-
13
- describe 'NullObject' do
14
- describe '#method_missing' do
15
- it 'returns itself' do
16
- batch = Sidekiq::Batch.new
17
- expect(batch.non_existent_method).to eq(batch)
18
- end
19
- end
20
- end
21
-
22
- describe 'NullBatch' do
23
- end
24
-
25
- describe 'NullStatus' do
26
- let(:batch) { Sidekiq::Batch.new }
27
-
28
- subject { batch.status }
29
-
30
- describe '#total' do
31
- it 'returns 0 when no jobs' do
32
- expect(subject.total).to eq(0)
33
- end
34
-
35
- it 'returns 1 when 1 job' do
36
- batch.jobs do
37
- TestWorker.perform_async('5')
38
- end
39
-
40
- expect(subject.total).to eq(1)
41
- end
42
- end
43
-
44
- describe '#failures' do
45
- it 'returns 0' do
46
- expect(subject.failures).to eq(0)
47
- end
48
- end
49
-
50
- describe '#bid' do
51
- it 'returns a bid' do
52
- expect(subject.bid).to_not be_nil
53
- end
54
- end
55
-
56
- describe '#join' do
57
- class MyCallback
58
- def on_event(status, options); end
59
- end
60
-
61
- class OtherCallback
62
- def foo(status, options); end
63
- end
64
-
65
- before(:each) do
66
- batch.on(:event, MyCallback, my_arg: 42)
67
- batch.on(:event, 'OtherCallback#foo', my_arg: 23)
68
- end
69
-
70
- it 'executes callbacks' do
71
- expect_any_instance_of(MyCallback).to receive(:on_event).with(subject, { my_arg: 42 })
72
- expect_any_instance_of(OtherCallback).to receive(:foo).with(subject, { my_arg: 23 })
73
- subject.join
74
- end
75
- end
76
-
77
- describe '#initialize' do
78
- it 'uses default argument values when none are provided' do
79
- expect { Sidekiq::Batch::Status.new }.to_not raise_error
80
- end
81
- end
82
- end
83
- end
@@ -1,40 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe 'Retries Exhausted block' do
4
- class FooClass < TestWorkerAlternative
5
- sidekiq_retries_exhausted do |msg, exception|
6
- bar('hello')
7
- foo(msg)
8
- baz(exception)
9
- end
10
-
11
- def self.bar(input)
12
- end
13
-
14
- def self.foo(msg)
15
- end
16
-
17
- def self.baz(exception)
18
- end
19
- end
20
-
21
- it 'executes whatever is within the block' do
22
- FooClass.within_sidekiq_retries_exhausted_block { expect(FooClass).to receive(:bar).with('hello') }
23
- end
24
-
25
- it 'passes message and exception to the block' do
26
- args = { 'args' => ['a', 'b']}
27
- exception = StandardError.new('something went wrong')
28
- FooClass.within_sidekiq_retries_exhausted_block(args, exception) do
29
- expect(FooClass).to receive(:foo).with(FooClass.default_retries_exhausted_message.merge(args))
30
- expect(FooClass).to receive(:baz).with(exception)
31
- end
32
- end
33
-
34
- it 'sets a default value for the message and exception' do
35
- FooClass.within_sidekiq_retries_exhausted_block do
36
- expect(FooClass).to receive(:foo).with(FooClass.default_retries_exhausted_message)
37
- expect(FooClass).to receive(:baz).with(FooClass.default_retries_exhausted_exception)
38
- end
39
- end
40
- end
@@ -1,238 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe RSpec::Sidekiq::Matchers::BeDelayed do
4
- let(:delay_subject) { RSpec::Sidekiq::Matchers::BeDelayed.new }
5
- let(:delay_with_arguments_subject) { RSpec::Sidekiq::Matchers::BeDelayed.new Object }
6
- let(:delay_for_subject) { RSpec::Sidekiq::Matchers::BeDelayed.new.for 3600 }
7
- let(:delay_for_with_arguments_subject) { RSpec::Sidekiq::Matchers::BeDelayed.new(Object).for 3600 }
8
- let(:delay_until_subject) { RSpec::Sidekiq::Matchers::BeDelayed.new.until Time.now + 3600 }
9
- let(:delay_until_with_arguments_subject) { RSpec::Sidekiq::Matchers::BeDelayed.new(Object).until Time.now + 3600 }
10
- before(:each) do
11
- delay_subject.matches? Object.method :nil?
12
- delay_with_arguments_subject.matches? Object.method :is_a?
13
-
14
- delay_for_subject.matches? Object.method :nil?
15
- delay_for_with_arguments_subject.matches? Object.method :is_a?
16
-
17
- delay_until_subject.matches? Object.method :nil?
18
- delay_until_with_arguments_subject.matches? Object.method :is_a?
19
- end
20
-
21
- describe 'expected usage' do
22
- it 'matches' do
23
- Object.delay_for(3600).is_a? Object
24
-
25
- expect(Object.method :is_a?).to be_delayed(Object).for 3600
26
- end
27
- end
28
-
29
- describe '#be_delayed_job' do
30
- it 'returns instance' do
31
- expect(be_delayed).to be_a RSpec::Sidekiq::Matchers::BeDelayed
32
- end
33
- end
34
-
35
- describe '#description' do
36
- context 'when expected is a delay' do
37
- it 'returns description' do
38
- expect(delay_subject.description).to eq 'be delayed'
39
- end
40
- end
41
-
42
- context 'when expected is a delay with arguments' do
43
- it 'returns description' do
44
- expect(delay_with_arguments_subject.description).to eq 'be delayed with arguments [Object]'
45
- end
46
- end
47
-
48
- context 'when expected is a delay for' do
49
- it 'returns description' do
50
- expect(delay_for_subject.description).to eq 'be delayed for 3600 seconds'
51
- end
52
- end
53
-
54
- context 'when expected is a delay for with arguments' do
55
- it 'returns description' do
56
- expect(delay_for_with_arguments_subject.description).to eq 'be delayed for 3600 seconds with arguments [Object]'
57
- end
58
- end
59
-
60
- context 'when expected is a delay until' do
61
- it 'returns description' do
62
- expect(delay_until_subject.description).to eq "be delayed until #{Time.now + 3600}"
63
- end
64
- end
65
-
66
- context 'when expected is a delay until with arguments' do
67
- it 'returns description' do
68
- expect(delay_until_with_arguments_subject.description).to eq "be delayed until #{Time.now + 3600} with arguments [Object]"
69
- end
70
- end
71
- end
72
-
73
- describe '#failure_message' do
74
- context 'when expected is a delay' do
75
- it 'returns message' do
76
- expect(delay_subject.failure_message).to eq 'expected Object.nil? to be delayed'
77
- end
78
- end
79
-
80
- context 'when expected is a delay with arguments' do
81
- it 'returns message' do
82
- expect(delay_with_arguments_subject.failure_message).to eq 'expected Object.is_a? to be delayed with arguments [Object]'
83
- end
84
- end
85
-
86
- context 'when expected is a delay for' do
87
- it 'returns message' do
88
- expect(delay_for_subject.failure_message).to eq 'expected Object.nil? to be delayed for 3600 seconds'
89
- end
90
- end
91
-
92
- context 'when expected is a delay for with arguments' do
93
- it 'returns message' do
94
- expect(delay_for_with_arguments_subject.failure_message).to eq 'expected Object.is_a? to be delayed for 3600 seconds with arguments [Object]'
95
- end
96
- end
97
-
98
- context 'when expected is a delay until' do
99
- it 'returns message' do
100
- expect(delay_until_subject.failure_message).to eq "expected Object.nil? to be delayed until #{Time.now + 3600}"
101
- end
102
- end
103
-
104
- context 'when expected is a delay until with arguments' do
105
- it 'returns message' do
106
- expect(delay_until_with_arguments_subject.failure_message).to eq "expected Object.is_a? to be delayed until #{Time.now + 3600} with arguments [Object]"
107
- end
108
- end
109
- end
110
-
111
- describe '#matches?' do
112
- context 'when condition matches' do
113
- context 'when expected is a delay' do
114
- it 'returns true' do
115
- Object.delay.nil?
116
-
117
- expect(delay_subject.matches? Object.method :nil?).to be true
118
- end
119
- end
120
-
121
- context 'when expected is a delay with arguments' do
122
- it 'returns true' do
123
- Object.delay.is_a? Object
124
-
125
- expect(delay_with_arguments_subject.matches? Object.method :is_a?).to be true
126
- end
127
- end
128
-
129
- context 'when expected is a delay for' do
130
- it 'returns true' do
131
- Object.delay_for(3600).nil?
132
-
133
- expect(delay_for_subject.matches? Object.method :nil?).to be true
134
- end
135
- end
136
-
137
- context 'when expected is a delay for with arguments' do
138
- it 'returns true' do
139
- Object.delay_for(3600).is_a? Object
140
-
141
- expect(delay_for_with_arguments_subject.matches? Object.method :is_a?).to be true
142
- end
143
- end
144
-
145
- context 'when expected is a delay until' do
146
- it 'returns true' do
147
- Object.delay_until(Time.now + 3600).nil?
148
-
149
- expect(delay_until_subject.matches? Object.method :nil?).to be true
150
- end
151
- end
152
-
153
- context 'when expected is a delay until with arguments' do
154
- it 'returns true' do
155
- Object.delay_until(Time.now + 3600).is_a? Object
156
-
157
- expect(delay_until_with_arguments_subject.matches? Object.method :is_a?).to be true
158
- end
159
- end
160
- end
161
-
162
- context 'when condition does not match' do
163
- context 'when expected is a delay' do
164
- it 'returns false' do
165
- expect(delay_subject.matches? Object.method :nil?).to be false
166
- end
167
- end
168
-
169
- context 'when expected is a delay with arguments' do
170
- it 'returns false' do
171
- expect(delay_with_arguments_subject.matches? Object.method :is_a?).to be false
172
- end
173
- end
174
-
175
- context 'when expected is a delay for' do
176
- it 'returns false' do
177
- expect(delay_for_subject.matches? Object.method :nil?).to be false
178
- end
179
- end
180
-
181
- context 'when expected is a delay for with arguments' do
182
- it 'returns false' do
183
- expect(delay_for_with_arguments_subject.matches? Object.method :is_a?).to be false
184
- end
185
- end
186
-
187
- context 'when expected is a delay until' do
188
- it 'returns false' do
189
- expect(delay_until_subject.matches? Object.method :nil?).to be false
190
- end
191
- end
192
-
193
- context 'when expected is a delay until with arguments' do
194
- it 'returns false' do
195
- expect(delay_until_with_arguments_subject.matches? Object.method :is_a?).to be false
196
- end
197
- end
198
- end
199
- end
200
-
201
- describe '#failure_message_when_negated' do
202
- context 'when expected is a delay' do
203
- it 'returns message' do
204
- expect(delay_subject.failure_message_when_negated).to eq 'expected Object.nil? to not be delayed'
205
- end
206
- end
207
-
208
- context 'when expected is a delay with arguments' do
209
- it 'returns message' do
210
- expect(delay_with_arguments_subject.failure_message_when_negated).to eq 'expected Object.is_a? to not be delayed with arguments [Object]'
211
- end
212
- end
213
-
214
- context 'when expected is a delay for' do
215
- it 'returns message' do
216
- expect(delay_for_subject.failure_message_when_negated).to eq 'expected Object.nil? to not be delayed for 3600 seconds'
217
- end
218
- end
219
-
220
- context 'when expected is a delay for with arguments' do
221
- it 'returns message' do
222
- expect(delay_for_with_arguments_subject.failure_message_when_negated).to eq 'expected Object.is_a? to not be delayed for 3600 seconds with arguments [Object]'
223
- end
224
- end
225
-
226
- context 'when expected is a delay until' do
227
- it 'returns message' do
228
- expect(delay_until_subject.failure_message_when_negated).to eq "expected Object.nil? to not be delayed until #{Time.now + 3600}"
229
- end
230
- end
231
-
232
- context 'when expected is a delay until with arguments' do
233
- it 'returns message' do
234
- expect(delay_until_with_arguments_subject.failure_message_when_negated).to eq "expected Object.is_a? to not be delayed until #{Time.now + 3600} with arguments [Object]"
235
- end
236
- end
237
- end
238
- end
@@ -1,57 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe RSpec::Sidekiq::Matchers::BeExpiredIn do
4
- let(:subject) { RSpec::Sidekiq::Matchers::BeExpiredIn.new 1 }
5
- let(:worker) { create_worker expires_in: 1 }
6
-
7
- describe '#be_expired_in' do
8
- it 'returns instance' do
9
- expect(be_expired_in 1).to be_a RSpec::Sidekiq::Matchers::BeExpiredIn
10
- end
11
- end
12
-
13
- describe 'expected usage' do
14
- it 'matches' do
15
- expect(worker).to be_expired_in 1
16
- end
17
-
18
- context 'with negated' do
19
- it 'matches' do
20
- expect(worker).to_not be_expired_in 2
21
- end
22
- end
23
- end
24
-
25
- describe '#failure_message' do
26
- it 'returns message' do
27
- subject.matches? worker
28
- expect(subject.failure_message).to eq "expected to expire in #{worker.sidekiq_options['expires_in']} but expired in #{subject.instance_variable_get(:@expected_argument)}"
29
- end
30
- end
31
-
32
- describe '#matches?' do
33
- context 'when expected equals actual' do
34
- it 'returns true' do
35
- expect(subject.matches? worker).to be true
36
- end
37
- end
38
- context 'when expected is not equal to actual' do
39
- it 'returns false' do
40
- expect(RSpec::Sidekiq::Matchers::BeExpiredIn.new(2).matches? worker). to be false
41
- end
42
- end
43
- end
44
-
45
- describe '#failure_message_when_negated' do
46
- it 'returns message' do
47
- subject.matches? worker
48
- expect(subject.failure_message_when_negated).to eq "expected to not expire in #{subject.instance_variable_get(:@expected_argument)}"
49
- end
50
- end
51
-
52
- describe '#description' do
53
- it 'returns message' do
54
- expect(subject.description).to eq "to expire in #{subject.instance_variable_get(:@expected_argument)}"
55
- end
56
- end
57
- end