rspec-enqueue_sidekiq_job 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ad9b3f850dedc1c1060928be0bccb5c71bc384c40077efbe44aca66bb33ae7e
4
- data.tar.gz: 11f8b9465a3721b8b55b940a566ebbfbd0e017c07c469d7a90d5545dc8736320
3
+ metadata.gz: b97b2ee706f603920828b8ee122a3b47b2beb5099dd7ae95e3d5f007508c7948
4
+ data.tar.gz: 69e34ea50e0cdd337c5aadd9d7cc87742946d950b3fcc69045ca4b5c130e3538
5
5
  SHA512:
6
- metadata.gz: eadeff14bbbd5cd3d663c83f0e0e6963cbdbee137a0bad1031b4b58c6921ac7acfec1e6e6177bd1e6d03ff1b61c725cd2299e53a8bba26d5919b6252f2aa5ca4
7
- data.tar.gz: f05275a12abeb533885cd13638e70efe1ec229e60571709d9bfb49136f3eae4a0294528a5ce71f6c66defdec70c61aeebb3d884af04e8dec040a53890ce7e975
6
+ metadata.gz: 3f689afe37fa8ae98e30081f0873bc735b9a4a91793597651818efb1c18378e05ceb7fa1d361663bcc9307117037067e0ec6fc7ee04036dfa5701c902c9d28c9
7
+ data.tar.gz: 185e782c55203982ee913571d2dfacfd645129402b602b5e6af939bd95ce7a6268606f8e15a06e7c076a1198828daba90552dfc7c9d4170693c8b5771310b7c1
@@ -31,6 +31,7 @@ module RSpec
31
31
 
32
32
  def initialize(worker_class)
33
33
  @worker_class = worker_class
34
+ @expected_count = nil
34
35
  end
35
36
 
36
37
  def with(*expected_arguments)
@@ -56,11 +57,26 @@ module RSpec
56
57
  self
57
58
  end
58
59
 
60
+ def times
61
+ self
62
+ end
63
+
64
+ def exactly(times)
65
+ @expected_count = times
66
+ self
67
+ end
68
+
69
+ def twice
70
+ exactly(2).times
71
+ end
72
+
59
73
  def matches?(block)
60
- filter(enqueued_in_block(block)).one?
74
+ filter(enqueued_in_block(block)).count == (expected_count || 1)
61
75
  end
62
76
 
63
77
  def does_not_match?(block)
78
+ raise 'counts are not supported with negation' if expected_count
79
+
64
80
  filter(enqueued_in_block(block)).none?
65
81
  end
66
82
 
@@ -69,6 +85,7 @@ module RSpec
69
85
  message << " arguments: #{expected_arguments}" if expected_arguments
70
86
  message << " in: #{expected_in.inspect}" if expected_in
71
87
  message << " at: #{expected_at}" if expected_at
88
+ message << " exactly #{expected_count} times" if expected_count
72
89
  message.join("\n")
73
90
  end
74
91
 
@@ -77,6 +94,7 @@ module RSpec
77
94
  message << " arguments: #{expected_arguments}" if expected_arguments
78
95
  message << " in: #{expected_in.inspect}" if expected_in
79
96
  message << " at: #{expected_at}" if expected_at
97
+ message << " exactly #{expected_count} times" if expected_count
80
98
  message.join("\n")
81
99
  end
82
100
 
@@ -122,7 +140,7 @@ module RSpec
122
140
  expected_in.from_now.to_i == actual_time.to_i
123
141
  end
124
142
 
125
- attr_reader :worker_class, :expected_arguments, :expected_at, :expected_in
143
+ attr_reader :worker_class, :expected_arguments, :expected_at, :expected_in, :expected_count
126
144
  end
127
145
 
128
146
  private_constant :Matcher
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module EnqueueSidekiqJob
3
- VERSION = '1.1.1'.freeze
3
+ VERSION = '1.2.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-enqueue_sidekiq_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Pirozhkov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-21 00:00:00.000000000 Z
11
+ date: 2021-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0'
140
140
  requirements: []
141
- rubygems_version: 3.1.2
141
+ rubygems_version: 3.2.3
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: RSpec matcher to check enqueueing of Sidekiq jobs