rspec-que 1.0.2 → 1.1.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
  SHA1:
3
- metadata.gz: c87929df7a2ab03510e1653ccb1ba7fa9ff111a2
4
- data.tar.gz: 287d5af413397c3b36ee0f829bdedcef80516680
3
+ metadata.gz: d6a12c44d1b6bad7658728316b396cb78200148d
4
+ data.tar.gz: 189ad9ef1800b8af4c2d0d3507e91b8f2f7885fa
5
5
  SHA512:
6
- metadata.gz: 1dc9f76fa67c0d436178467558280eb4f8341022519e57a78f37aec92d15e8be246bc0c949205f89e22706d399466fe18cd6cc00dc94a6890cbec88276acb35a
7
- data.tar.gz: b5d2acb3261a82ed8883d4318c97578fe39f45ae7df048250c24d881578239f816f613044a83f8fa233ab5b7a80e9254aeb8cc14ecfea5d1ea86ad0363549020
6
+ metadata.gz: 8a93dd08c6c065956a0bfafcc7652c45752dbe9e07b59f5b7379b386e1265b3621232c81bc438fb001ca3cd64aba14b53f21fc2933f59615b8b954940f110a91
7
+ data.tar.gz: caa89b6ce6ba4fbef248ce61ac66ade1ef0b74fe007c3ea813ff8c2579907a3dedd4e6cc78b8a287f67a778d760fdb1dfd885b113404a5634fcb599042216178
data/README.md CHANGED
@@ -3,7 +3,18 @@
3
3
  This gem defines a matcher for checking that Que jobs have been enqueued,
4
4
  in the style of [rspec-activejob](https://github.com/gocardless/rspec-activejob).
5
5
 
6
+ ## Installation
7
+
8
+ Add the dependency to your application's Gemfile:
9
+
10
+ gem 'rspec-que', '~> 1.1.0'
11
+
12
+ And then install from your Gemfile:
13
+
14
+ $ bundle
15
+
6
16
  ## Usage
17
+
7
18
  The matcher expects a block of code, and will expect that code to enqueue a job
8
19
  in Que. The matcher can take a class for the job as its arguments. It can also
9
20
  expect the job to be queued with arguments via `.with(arg1, arg2)` or at a
@@ -32,8 +32,12 @@ module RSpec
32
32
  end
33
33
 
34
34
  def at(the_time)
35
- matcher = QueuedAt.new(the_time)
36
- @matchers << matcher
35
+ @matchers << QueuedAt.new(the_time)
36
+ self
37
+ end
38
+
39
+ def of_priority(priority)
40
+ @matchers << QueuedPriority.new(priority)
37
41
  self
38
42
  end
39
43
 
@@ -162,6 +166,28 @@ module RSpec
162
166
  end
163
167
  end
164
168
  end
169
+
170
+ class QueuedPriority
171
+ def initialize(priority)
172
+ @priority = priority
173
+ end
174
+
175
+ def matches?(job)
176
+ job[:priority] == @priority
177
+ end
178
+
179
+ def desc
180
+ "of priority #{@priority}"
181
+ end
182
+
183
+ def failed_msg(candidates)
184
+ if candidates.length == 1
185
+ "job of priority #{candidates.first[:priority]}"
186
+ else
187
+ "jobs of priority #{candidates.map { |c| c[:priority] }}"
188
+ end
189
+ end
190
+ end
165
191
  end
166
192
  end
167
193
  end
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Que
3
- VERSION = '1.0.2'.freeze
3
+ VERSION = '1.1.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-que
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoCardless Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-29 00:00:00.000000000 Z
11
+ date: 2017-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-mocks
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '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
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec-its
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '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
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '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
68
  version: '0'
69
69
  description: |2
@@ -91,17 +91,17 @@ require_paths:
91
91
  - lib
92
92
  required_ruby_version: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - '>='
99
+ - - ">="
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubyforge_project:
104
- rubygems_version: 2.0.14.1
104
+ rubygems_version: 2.6.8
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: RSpec matchers to test Que