delayed_job_groups_plugin 0.2.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/.rubocop.yml +8 -0
- data/.travis.yml +10 -20
- data/Appraisals +12 -0
- data/CHANGELOG.md +24 -1
- data/Gemfile +2 -0
- data/README.md +4 -3
- data/Rakefile +2 -0
- data/delayed_job_groups.gemspec +18 -18
- data/gemfiles/rails_5.2.gemfile +9 -0
- data/gemfiles/rails_6.0.gemfile +8 -0
- data/lib/delayed/job_groups/compatibility.rb +2 -2
- data/lib/delayed/job_groups/job_extensions.rb +7 -8
- data/lib/delayed/job_groups/job_group.rb +9 -17
- data/lib/delayed/job_groups/plugin.rb +13 -9
- data/lib/delayed/job_groups/version.rb +2 -2
- data/lib/delayed/job_groups/yaml_loader.rb +17 -0
- data/lib/delayed_job_groups_plugin.rb +2 -1
- data/lib/generators/delayed_job_groups_plugin/install_generator.rb +3 -3
- data/lib/generators/delayed_job_groups_plugin/templates/{migration.rb → migration.erb} +2 -2
- data/spec/db/schema.rb +2 -2
- data/spec/delayed/job_groups/job_group_spec.rb +22 -23
- data/spec/delayed/job_groups/plugin_spec.rb +133 -84
- data/spec/delayed/job_groups/yaml_loader_spec.rb +43 -0
- data/spec/spec_helper.rb +12 -12
- data/spec/support/destroyed_model.rb +3 -3
- metadata +83 -41
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Delayed::JobGroups::YamlLoader do
|
4
|
+
class Foo; end
|
5
|
+
|
6
|
+
describe "#load" do
|
7
|
+
context "with a correct yaml object representation" do
|
8
|
+
let(:yaml) { '--- !ruby/object:Foo {}' }
|
9
|
+
|
10
|
+
it "deserializes from YAML properly" do
|
11
|
+
expect(Delayed::JobGroups::YamlLoader.load(yaml)).to be_a(Foo)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "with incorrect yaml object representations" do
|
16
|
+
let(:not_yaml1) { 'foo' }
|
17
|
+
let(:not_yaml2) { 1 }
|
18
|
+
|
19
|
+
it "deserializes from YAML properly" do
|
20
|
+
expect(Delayed::JobGroups::YamlLoader.load(not_yaml1)).to eq('foo')
|
21
|
+
expect(Delayed::JobGroups::YamlLoader.load(not_yaml2)).to eq(1)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#dump" do
|
27
|
+
context "with an object" do
|
28
|
+
let(:object) { Foo.new }
|
29
|
+
|
30
|
+
it "serializes into YAML properly" do
|
31
|
+
expect(Delayed::JobGroups::YamlLoader.dump(object)).to eq("--- !ruby/object:Foo {}\n")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "with a nil object" do
|
36
|
+
let(:object) { nil }
|
37
|
+
|
38
|
+
it "serializes into YAML properly" do
|
39
|
+
expect(Delayed::JobGroups::YamlLoader.dump(object)).to eq(nil)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'simplecov'
|
4
4
|
require 'coveralls'
|
5
5
|
|
6
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter
|
7
|
-
SimpleCov::Formatter::HTMLFormatter,
|
8
|
-
|
9
|
-
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
7
|
+
[SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
|
8
|
+
)
|
9
|
+
|
10
10
|
SimpleCov.start do
|
11
|
-
|
11
|
+
add_filter 'spec'
|
12
12
|
end
|
13
13
|
|
14
|
+
require 'rspec/its'
|
14
15
|
require 'database_cleaner'
|
15
16
|
require 'delayed_job_groups_plugin'
|
16
17
|
require 'yaml'
|
@@ -30,27 +31,26 @@ ActiveRecord::Base.logger = Delayed::Worker.logger
|
|
30
31
|
ActiveRecord::Migration.verbose = false
|
31
32
|
|
32
33
|
db_adapter = ENV.fetch('ADAPTER', 'sqlite3')
|
33
|
-
|
34
|
-
ActiveRecord::Base.establish_connection(
|
34
|
+
db_config = YAML.safe_load(File.read('spec/db/database.yml'))
|
35
|
+
ActiveRecord::Base.establish_connection(db_config[db_adapter])
|
35
36
|
require 'db/schema'
|
36
37
|
|
37
38
|
RSpec.configure do |config|
|
38
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
39
39
|
config.order = 'random'
|
40
40
|
|
41
41
|
config.before(:suite) do
|
42
42
|
DatabaseCleaner.clean_with(:truncation)
|
43
43
|
end
|
44
44
|
|
45
|
-
config.before
|
45
|
+
config.before do
|
46
46
|
DatabaseCleaner.strategy = :transaction
|
47
47
|
end
|
48
48
|
|
49
|
-
config.before
|
49
|
+
config.before do
|
50
50
|
DatabaseCleaner.start
|
51
51
|
end
|
52
52
|
|
53
|
-
config.after
|
53
|
+
config.after do
|
54
54
|
DatabaseCleaner.clean
|
55
55
|
end
|
56
56
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
RSpec::Matchers.define :have_been_destroyed do
|
4
4
|
match do |actual|
|
@@ -6,10 +6,10 @@ RSpec::Matchers.define :have_been_destroyed do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
description do
|
9
|
-
|
9
|
+
'model should have been destroyed'
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
failure_message do |actual|
|
13
13
|
"expected #{actual.class}(id: #{actual.id}) to have been destroyed"
|
14
14
|
end
|
15
15
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delayed_job_groups_plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Turkel
|
8
8
|
- Randy Burkes
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-10-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: delayed_job
|
@@ -31,48 +31,62 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '4.1'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '4.1'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: appraisal
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: activerecord
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
45
59
|
requirements:
|
46
60
|
- - ">="
|
47
61
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
62
|
+
version: '5.2'
|
49
63
|
- - "<"
|
50
64
|
- !ruby/object:Gem::Version
|
51
|
-
version: '
|
52
|
-
type: :
|
65
|
+
version: '6.1'
|
66
|
+
type: :runtime
|
53
67
|
prerelease: false
|
54
68
|
version_requirements: !ruby/object:Gem::Requirement
|
55
69
|
requirements:
|
56
70
|
- - ">="
|
57
71
|
- !ruby/object:Gem::Version
|
58
|
-
version: '
|
72
|
+
version: '5.2'
|
59
73
|
- - "<"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '6.1'
|
62
76
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
77
|
+
name: coveralls_reborn
|
64
78
|
requirement: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: 0.18.0
|
69
83
|
type: :development
|
70
84
|
prerelease: false
|
71
85
|
version_requirements: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: 0.18.0
|
76
90
|
- !ruby/object:Gem::Dependency
|
77
91
|
name: database_cleaner
|
78
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,7 +102,7 @@ dependencies:
|
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: '1.2'
|
90
104
|
- !ruby/object:Gem::Dependency
|
91
|
-
name:
|
105
|
+
name: mime-types
|
92
106
|
requirement: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - ">="
|
@@ -102,41 +116,35 @@ dependencies:
|
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
118
|
- !ruby/object:Gem::Dependency
|
105
|
-
name:
|
119
|
+
name: rake
|
106
120
|
requirement: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
111
|
-
- - "<"
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version: '2.99'
|
124
|
+
version: '0'
|
114
125
|
type: :development
|
115
126
|
prerelease: false
|
116
127
|
version_requirements: !ruby/object:Gem::Requirement
|
117
128
|
requirements:
|
118
129
|
- - ">="
|
119
130
|
- !ruby/object:Gem::Version
|
120
|
-
version: '
|
121
|
-
- - "<"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: '2.99'
|
131
|
+
version: '0'
|
124
132
|
- !ruby/object:Gem::Dependency
|
125
|
-
name:
|
133
|
+
name: rspec
|
126
134
|
requirement: !ruby/object:Gem::Requirement
|
127
135
|
requirements:
|
128
136
|
- - "~>"
|
129
137
|
- !ruby/object:Gem::Version
|
130
|
-
version:
|
138
|
+
version: '3'
|
131
139
|
type: :development
|
132
140
|
prerelease: false
|
133
141
|
version_requirements: !ruby/object:Gem::Requirement
|
134
142
|
requirements:
|
135
143
|
- - "~>"
|
136
144
|
- !ruby/object:Gem::Version
|
137
|
-
version:
|
145
|
+
version: '3'
|
138
146
|
- !ruby/object:Gem::Dependency
|
139
|
-
name:
|
147
|
+
name: rspec-its
|
140
148
|
requirement: !ruby/object:Gem::Requirement
|
141
149
|
requirements:
|
142
150
|
- - ">="
|
@@ -150,19 +158,33 @@ dependencies:
|
|
150
158
|
- !ruby/object:Gem::Version
|
151
159
|
version: '0'
|
152
160
|
- !ruby/object:Gem::Dependency
|
153
|
-
name:
|
161
|
+
name: salsify_rubocop
|
154
162
|
requirement: !ruby/object:Gem::Requirement
|
155
163
|
requirements:
|
156
|
-
- -
|
164
|
+
- - '='
|
157
165
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
166
|
+
version: 0.52.1.1
|
159
167
|
type: :development
|
160
168
|
prerelease: false
|
161
169
|
version_requirements: !ruby/object:Gem::Requirement
|
162
170
|
requirements:
|
163
|
-
- -
|
171
|
+
- - '='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.52.1.1
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: simplecov
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
type: :development
|
182
|
+
prerelease: false
|
183
|
+
version_requirements: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
164
186
|
- !ruby/object:Gem::Version
|
165
|
-
version: '
|
187
|
+
version: '0'
|
166
188
|
- !ruby/object:Gem::Dependency
|
167
189
|
name: sqlite3
|
168
190
|
requirement: !ruby/object:Gem::Requirement
|
@@ -177,6 +199,20 @@ dependencies:
|
|
177
199
|
- - ">="
|
178
200
|
- !ruby/object:Gem::Version
|
179
201
|
version: '0'
|
202
|
+
- !ruby/object:Gem::Dependency
|
203
|
+
name: timecop
|
204
|
+
requirement: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
type: :development
|
210
|
+
prerelease: false
|
211
|
+
version_requirements: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
180
216
|
description: Aggregates Delayed::Job jobs into groups with group level management
|
181
217
|
and lifecycle callbacks
|
182
218
|
email:
|
@@ -188,25 +224,31 @@ extra_rdoc_files: []
|
|
188
224
|
files:
|
189
225
|
- ".gitignore"
|
190
226
|
- ".rspec"
|
227
|
+
- ".rubocop.yml"
|
191
228
|
- ".travis.yml"
|
229
|
+
- Appraisals
|
192
230
|
- CHANGELOG.md
|
193
231
|
- Gemfile
|
194
232
|
- LICENSE.txt
|
195
233
|
- README.md
|
196
234
|
- Rakefile
|
197
235
|
- delayed_job_groups.gemspec
|
236
|
+
- gemfiles/rails_5.2.gemfile
|
237
|
+
- gemfiles/rails_6.0.gemfile
|
198
238
|
- lib/delayed/job_groups/compatibility.rb
|
199
239
|
- lib/delayed/job_groups/job_extensions.rb
|
200
240
|
- lib/delayed/job_groups/job_group.rb
|
201
241
|
- lib/delayed/job_groups/plugin.rb
|
202
242
|
- lib/delayed/job_groups/version.rb
|
243
|
+
- lib/delayed/job_groups/yaml_loader.rb
|
203
244
|
- lib/delayed_job_groups_plugin.rb
|
204
245
|
- lib/generators/delayed_job_groups_plugin/install_generator.rb
|
205
|
-
- lib/generators/delayed_job_groups_plugin/templates/migration.
|
246
|
+
- lib/generators/delayed_job_groups_plugin/templates/migration.erb
|
206
247
|
- spec/db/database.yml
|
207
248
|
- spec/db/schema.rb
|
208
249
|
- spec/delayed/job_groups/job_group_spec.rb
|
209
250
|
- spec/delayed/job_groups/plugin_spec.rb
|
251
|
+
- spec/delayed/job_groups/yaml_loader_spec.rb
|
210
252
|
- spec/spec_helper.rb
|
211
253
|
- spec/support/destroyed_model.rb
|
212
254
|
homepage: https://github.com/salsify/delayed_job_groups_plugin
|
@@ -222,22 +264,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
264
|
requirements:
|
223
265
|
- - ">="
|
224
266
|
- !ruby/object:Gem::Version
|
225
|
-
version: '
|
267
|
+
version: '2.5'
|
226
268
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
269
|
requirements:
|
228
270
|
- - ">="
|
229
271
|
- !ruby/object:Gem::Version
|
230
272
|
version: '0'
|
231
273
|
requirements: []
|
232
|
-
|
233
|
-
|
234
|
-
signing_key:
|
274
|
+
rubygems_version: 3.0.8
|
275
|
+
signing_key:
|
235
276
|
specification_version: 4
|
236
277
|
summary: Delayed::Job job groups plugin
|
237
278
|
test_files:
|
238
|
-
- spec/db/database.yml
|
239
|
-
- spec/db/schema.rb
|
240
|
-
- spec/delayed/job_groups/job_group_spec.rb
|
241
|
-
- spec/delayed/job_groups/plugin_spec.rb
|
242
279
|
- spec/spec_helper.rb
|
243
280
|
- spec/support/destroyed_model.rb
|
281
|
+
- spec/delayed/job_groups/plugin_spec.rb
|
282
|
+
- spec/delayed/job_groups/job_group_spec.rb
|
283
|
+
- spec/delayed/job_groups/yaml_loader_spec.rb
|
284
|
+
- spec/db/schema.rb
|
285
|
+
- spec/db/database.yml
|