statesman 3.5.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +45 -225
  3. data/.rubocop.yml +1 -1
  4. data/.rubocop_todo.yml +26 -6
  5. data/CHANGELOG.md +69 -0
  6. data/Gemfile +9 -3
  7. data/Guardfile +2 -0
  8. data/README.md +77 -47
  9. data/Rakefile +2 -4
  10. data/lib/generators/statesman/active_record_transition_generator.rb +2 -0
  11. data/lib/generators/statesman/generator_helpers.rb +2 -0
  12. data/lib/generators/statesman/migration_generator.rb +2 -0
  13. data/lib/statesman/adapters/active_record.rb +88 -6
  14. data/lib/statesman/adapters/active_record_queries.rb +100 -36
  15. data/lib/statesman/adapters/active_record_transition.rb +2 -0
  16. data/lib/statesman/adapters/memory.rb +2 -0
  17. data/lib/statesman/adapters/memory_transition.rb +2 -0
  18. data/lib/statesman/callback.rb +2 -0
  19. data/lib/statesman/config.rb +2 -0
  20. data/lib/statesman/exceptions.rb +29 -2
  21. data/lib/statesman/guard.rb +3 -4
  22. data/lib/statesman/machine.rb +29 -7
  23. data/lib/statesman/railtie.rb +2 -0
  24. data/lib/statesman/utils.rb +2 -0
  25. data/lib/statesman/version.rb +3 -1
  26. data/lib/statesman.rb +2 -3
  27. data/lib/tasks/statesman.rake +3 -1
  28. data/spec/fixtures/add_constraints_to_most_recent_for_bacon_transitions_with_partial_index.rb +2 -0
  29. data/spec/fixtures/add_constraints_to_most_recent_for_bacon_transitions_without_partial_index.rb +2 -0
  30. data/spec/fixtures/add_most_recent_to_bacon_transitions.rb +2 -0
  31. data/spec/generators/statesman/active_record_transition_generator_spec.rb +2 -0
  32. data/spec/generators/statesman/migration_generator_spec.rb +2 -0
  33. data/spec/spec_helper.rb +3 -30
  34. data/spec/statesman/adapters/active_record_queries_spec.rb +165 -91
  35. data/spec/statesman/adapters/active_record_spec.rb +4 -0
  36. data/spec/statesman/adapters/active_record_transition_spec.rb +2 -0
  37. data/spec/statesman/adapters/memory_spec.rb +2 -0
  38. data/spec/statesman/adapters/memory_transition_spec.rb +2 -0
  39. data/spec/statesman/adapters/shared_examples.rb +2 -0
  40. data/spec/statesman/callback_spec.rb +2 -0
  41. data/spec/statesman/config_spec.rb +2 -0
  42. data/spec/statesman/guard_spec.rb +2 -0
  43. data/spec/statesman/machine_spec.rb +79 -4
  44. data/spec/statesman/utils_spec.rb +2 -0
  45. data/spec/support/active_record.rb +9 -12
  46. data/spec/support/generators_shared_examples.rb +2 -0
  47. data/statesman.gemspec +5 -3
  48. metadata +17 -22
  49. data/lib/generators/statesman/mongoid_transition_generator.rb +0 -25
  50. data/lib/generators/statesman/templates/mongoid_transition_model.rb.erb +0 -14
  51. data/lib/statesman/adapters/mongoid.rb +0 -66
  52. data/lib/statesman/adapters/mongoid_transition.rb +0 -10
  53. data/spec/generators/statesman/mongoid_transition_generator_spec.rb +0 -23
  54. data/spec/statesman/adapters/mongoid_spec.rb +0 -86
  55. data/spec/support/mongoid.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9fb352daa2f2ec337dd202cc2615a7e0925741a4
4
- data.tar.gz: 9de7812c9356e6e9f98a317b503220b3a7f7709b
2
+ SHA256:
3
+ metadata.gz: 75560d08df4affec82126fce63627c30902c534e0e8fd11dd89fdd1c94f66b6b
4
+ data.tar.gz: 3308c1cdff0e0cc32c2e964fac6c7e641bd841384c50d94eb824cae785822c3a
5
5
  SHA512:
6
- metadata.gz: fbd8b2b4b822b2f7148cb7b47111153e6cd18831e227cf6c72ca073904866025eb3e1d433f503e778853734c0f522e674ad29cad44ec5bc29fdfda7e55130275
7
- data.tar.gz: d55e7635f0773babcc1b5ef9da6f75a4144c8812ce305b93e1762e6100e658bd73f2989bb867efcb0be42225f1dfa49a67aeb064c1c287df62720c8afc693d4b
6
+ metadata.gz: 7cb81b50c75c21841f729fa91635cc6470397bafdc683b0ccdee1809e99cc2961ab3084d3fcd256b1b062d1362b6a17e2c7d63ea63dad9d6bc7ae8143d982542
7
+ data.tar.gz: 3885a1f4459572a92f3c47c6544d5a6eab1e8c38d0adb4206dbde7ad331953090822e3c2930eef695139e96a88df47bf55f4b2eb9df084d5724edab0e97c36ea
data/.circleci/config.yml CHANGED
@@ -1,3 +1,4 @@
1
+ ---
1
2
  version: 2
2
3
 
3
4
  references:
@@ -11,7 +12,7 @@ references:
11
12
  - type: cache-restore
12
13
  key: statesman-{{ checksum "Gemfile" }}-{{ checksum "~/RAILS_VERSION.txt" }}
13
14
 
14
- - run: gem install bundler
15
+ - run: gem install bundler -v 1.3
15
16
 
16
17
  - run: bundle install --path vendor/bundle
17
18
 
@@ -30,129 +31,12 @@ references:
30
31
  path: /tmp/test-results
31
32
 
32
33
  jobs:
33
- build-ruby241-rails-429-mongo:
34
+ build-ruby249-rails-429-mysql:
34
35
  docker:
35
- - image: circleci/ruby:2.4.1-node
36
- environment:
37
- - RAILS_VERSION=4.2.9
38
- - DATABASE_DEPENDENCY_PORT=27017
39
- - image: circleci/mongo:3
40
- steps: *steps
41
- build-ruby241-rails-429-mysql:
42
- docker:
43
- - image: circleci/ruby:2.4.1-node
44
- environment:
45
- - RAILS_VERSION=4.2.9
46
- - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
47
- - EXCLUDE_MONGOID=true
48
- - DATABASE_DEPENDENCY_PORT=3306
49
- - image: circleci/mysql:5.7.18
50
- environment:
51
- - MYSQL_ALLOW_EMPTY_PASSWORD=true
52
- - MYSQL_USER=root
53
- - MYSQL_PASSWORD=
54
- - MYSQL_DATABASE=statesman_test
55
- steps: *steps
56
- build-ruby241-rails-429-postgres:
57
- docker:
58
- - image: circleci/ruby:2.4.1-node
59
- environment:
60
- - RAILS_VERSION=4.2.9
61
- - DATABASE_URL=postgres://postgres@localhost/statesman_test
62
- - EXCLUDE_MONGOID=true
63
- - DATABASE_DEPENDENCY_PORT=5432
64
- - image: circleci/postgres:9.6
65
- environment:
66
- - POSTGRES_USER=postgres
67
- - POSTGRES_DB=statesman_test
68
- steps: *steps
69
- build-ruby241-rails-505-mongo:
70
- docker:
71
- - image: circleci/ruby:2.4.1-node
72
- environment:
73
- - RAILS_VERSION=5.0.5
74
- - DATABASE_DEPENDENCY_PORT=27017
75
- - image: circleci/mongo:3
76
- steps: *steps
77
- build-ruby241-rails-505-mysql:
78
- docker:
79
- - image: circleci/ruby:2.4.1-node
80
- environment:
81
- - RAILS_VERSION=5.0.5
82
- - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
83
- - EXCLUDE_MONGOID=true
84
- - DATABASE_DEPENDENCY_PORT=3306
85
- - image: circleci/mysql:5.7.18
86
- environment:
87
- - MYSQL_ALLOW_EMPTY_PASSWORD=true
88
- - MYSQL_USER=root
89
- - MYSQL_PASSWORD=
90
- - MYSQL_DATABASE=statesman_test
91
- steps: *steps
92
- build-ruby241-rails-505-postgres:
93
- docker:
94
- - image: circleci/ruby:2.4.1-node
95
- environment:
96
- - RAILS_VERSION=5.0.5
97
- - DATABASE_URL=postgres://postgres@localhost/statesman_test
98
- - EXCLUDE_MONGOID=true
99
- - DATABASE_DEPENDENCY_PORT=5432
100
- - image: circleci/postgres:9.6
101
- environment:
102
- - POSTGRES_USER=postgres
103
- - POSTGRES_DB=statesman_test
104
- steps: *steps
105
- build-ruby241-rails-513-mongo:
106
- docker:
107
- - image: circleci/ruby:2.4.1-node
108
- environment:
109
- - RAILS_VERSION=5.1.3
110
- - DATABASE_DEPENDENCY_PORT=27017
111
- - image: circleci/mongo:3
112
- steps: *steps
113
- build-ruby241-rails-513-mysql:
114
- docker:
115
- - image: circleci/ruby:2.4.1-node
116
- environment:
117
- - RAILS_VERSION=5.1.3
118
- - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
119
- - EXCLUDE_MONGOID=true
120
- - DATABASE_DEPENDENCY_PORT=3306
121
- - image: circleci/mysql:5.7.18
122
- environment:
123
- - MYSQL_ALLOW_EMPTY_PASSWORD=true
124
- - MYSQL_USER=root
125
- - MYSQL_PASSWORD=
126
- - MYSQL_DATABASE=statesman_test
127
- steps: *steps
128
- build-ruby241-rails-513-postgres:
129
- docker:
130
- - image: circleci/ruby:2.4.1-node
131
- environment:
132
- - RAILS_VERSION=5.1.3
133
- - DATABASE_URL=postgres://postgres@localhost/statesman_test
134
- - EXCLUDE_MONGOID=true
135
- - DATABASE_DEPENDENCY_PORT=5432
136
- - image: circleci/postgres:9.6
137
- environment:
138
- - POSTGRES_USER=postgres
139
- - POSTGRES_DB=statesman_test
140
- steps: *steps
141
- build-ruby233-rails-429-mongo:
142
- docker:
143
- - image: circleci/ruby:2.3.3-node
144
- environment:
145
- - RAILS_VERSION=4.2.9
146
- - DATABASE_DEPENDENCY_PORT=27017
147
- - image: circleci/mongo:3
148
- steps: *steps
149
- build-ruby233-rails-429-mysql:
150
- docker:
151
- - image: circleci/ruby:2.3.3-node
36
+ - image: circleci/ruby:2.4.9-node
152
37
  environment:
153
38
  - RAILS_VERSION=4.2.9
154
39
  - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
155
- - EXCLUDE_MONGOID=true
156
40
  - DATABASE_DEPENDENCY_PORT=3306
157
41
  - image: circleci/mysql:5.7.18
158
42
  environment:
@@ -161,34 +45,24 @@ jobs:
161
45
  - MYSQL_PASSWORD=
162
46
  - MYSQL_DATABASE=statesman_test
163
47
  steps: *steps
164
- build-ruby233-rails-429-postgres:
48
+ build-ruby249-rails-429-postgres:
165
49
  docker:
166
- - image: circleci/ruby:2.3.3-node
50
+ - image: circleci/ruby:2.4.9-node
167
51
  environment:
168
52
  - RAILS_VERSION=4.2.9
169
53
  - DATABASE_URL=postgres://postgres@localhost/statesman_test
170
- - EXCLUDE_MONGOID=true
171
54
  - DATABASE_DEPENDENCY_PORT=5432
172
55
  - image: circleci/postgres:9.6
173
56
  environment:
174
57
  - POSTGRES_USER=postgres
175
58
  - POSTGRES_DB=statesman_test
176
59
  steps: *steps
177
- build-ruby233-rails-505-mongo:
178
- docker:
179
- - image: circleci/ruby:2.3.3-node
180
- environment:
181
- - RAILS_VERSION=5.0.5
182
- - DATABASE_DEPENDENCY_PORT=27017
183
- - image: circleci/mongo:3
184
- steps: *steps
185
- build-ruby233-rails-505-mysql:
60
+ build-ruby249-rails-505-mysql:
186
61
  docker:
187
- - image: circleci/ruby:2.3.3-node
62
+ - image: circleci/ruby:2.4.9-node
188
63
  environment:
189
64
  - RAILS_VERSION=5.0.5
190
65
  - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
191
- - EXCLUDE_MONGOID=true
192
66
  - DATABASE_DEPENDENCY_PORT=3306
193
67
  - image: circleci/mysql:5.7.18
194
68
  environment:
@@ -197,34 +71,24 @@ jobs:
197
71
  - MYSQL_PASSWORD=
198
72
  - MYSQL_DATABASE=statesman_test
199
73
  steps: *steps
200
- build-ruby233-rails-505-postgres:
74
+ build-ruby249-rails-505-postgres:
201
75
  docker:
202
- - image: circleci/ruby:2.3.3-node
76
+ - image: circleci/ruby:2.4.9-node
203
77
  environment:
204
78
  - RAILS_VERSION=5.0.5
205
79
  - DATABASE_URL=postgres://postgres@localhost/statesman_test
206
- - EXCLUDE_MONGOID=true
207
80
  - DATABASE_DEPENDENCY_PORT=5432
208
81
  - image: circleci/postgres:9.6
209
82
  environment:
210
83
  - POSTGRES_USER=postgres
211
84
  - POSTGRES_DB=statesman_test
212
85
  steps: *steps
213
- build-ruby233-rails-513-mongo:
214
- docker:
215
- - image: circleci/ruby:2.3.3-node
216
- environment:
217
- - RAILS_VERSION=5.1.3
218
- - DATABASE_DEPENDENCY_PORT=27017
219
- - image: circleci/mongo:3
220
- steps: *steps
221
- build-ruby233-rails-513-mysql:
86
+ build-ruby249-rails-513-mysql:
222
87
  docker:
223
- - image: circleci/ruby:2.3.3-node
88
+ - image: circleci/ruby:2.4.9-node
224
89
  environment:
225
90
  - RAILS_VERSION=5.1.3
226
91
  - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
227
- - EXCLUDE_MONGOID=true
228
92
  - DATABASE_DEPENDENCY_PORT=3306
229
93
  - image: circleci/mysql:5.7.18
230
94
  environment:
@@ -233,34 +97,24 @@ jobs:
233
97
  - MYSQL_PASSWORD=
234
98
  - MYSQL_DATABASE=statesman_test
235
99
  steps: *steps
236
- build-ruby233-rails-513-postgres:
100
+ build-ruby249-rails-513-postgres:
237
101
  docker:
238
- - image: circleci/ruby:2.3.3-node
102
+ - image: circleci/ruby:2.4.9-node
239
103
  environment:
240
104
  - RAILS_VERSION=5.1.3
241
105
  - DATABASE_URL=postgres://postgres@localhost/statesman_test
242
- - EXCLUDE_MONGOID=true
243
106
  - DATABASE_DEPENDENCY_PORT=5432
244
107
  - image: circleci/postgres:9.6
245
108
  environment:
246
109
  - POSTGRES_USER=postgres
247
110
  - POSTGRES_DB=statesman_test
248
111
  steps: *steps
249
- build-ruby227-rails-429-mongo:
250
- docker:
251
- - image: circleci/ruby:2.2.7-node
252
- environment:
253
- - RAILS_VERSION=4.2.9
254
- - DATABASE_DEPENDENCY_PORT=27017
255
- - image: circleci/mongo:3
256
- steps: *steps
257
- build-ruby227-rails-429-mysql:
112
+ build-ruby265-rails-600-mysql:
258
113
  docker:
259
- - image: circleci/ruby:2.2.7-node
114
+ - image: circleci/ruby:2.6.5-node
260
115
  environment:
261
- - RAILS_VERSION=4.2.9
116
+ - RAILS_VERSION=6.0.0
262
117
  - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
263
- - EXCLUDE_MONGOID=true
264
118
  - DATABASE_DEPENDENCY_PORT=3306
265
119
  - image: circleci/mysql:5.7.18
266
120
  environment:
@@ -269,34 +123,24 @@ jobs:
269
123
  - MYSQL_PASSWORD=
270
124
  - MYSQL_DATABASE=statesman_test
271
125
  steps: *steps
272
- build-ruby227-rails-429-postgres:
126
+ build-ruby265-rails-600-postgres:
273
127
  docker:
274
- - image: circleci/ruby:2.2.7-node
128
+ - image: circleci/ruby:2.6.5-node
275
129
  environment:
276
- - RAILS_VERSION=4.2.9
130
+ - RAILS_VERSION=6.0.0
277
131
  - DATABASE_URL=postgres://postgres@localhost/statesman_test
278
- - EXCLUDE_MONGOID=true
279
132
  - DATABASE_DEPENDENCY_PORT=5432
280
133
  - image: circleci/postgres:9.6
281
134
  environment:
282
135
  - POSTGRES_USER=postgres
283
136
  - POSTGRES_DB=statesman_test
284
137
  steps: *steps
285
- build-ruby227-rails-505-mongo:
138
+ build-ruby265-rails-master-mysql:
286
139
  docker:
287
- - image: circleci/ruby:2.2.7-node
140
+ - image: circleci/ruby:2.6.5-node
288
141
  environment:
289
- - RAILS_VERSION=5.0.5
290
- - DATABASE_DEPENDENCY_PORT=27017
291
- - image: circleci/mongo:3
292
- steps: *steps
293
- build-ruby227-rails-505-mysql:
294
- docker:
295
- - image: circleci/ruby:2.2.7-node
296
- environment:
297
- - RAILS_VERSION=5.0.5
142
+ - RAILS_VERSION=master
298
143
  - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
299
- - EXCLUDE_MONGOID=true
300
144
  - DATABASE_DEPENDENCY_PORT=3306
301
145
  - image: circleci/mysql:5.7.18
302
146
  environment:
@@ -305,11 +149,11 @@ jobs:
305
149
  - MYSQL_PASSWORD=
306
150
  - MYSQL_DATABASE=statesman_test
307
151
  steps: *steps
308
- build-ruby227-rails-505-postgres:
152
+ build-ruby265-rails-master-postgres:
309
153
  docker:
310
- - image: circleci/ruby:2.2.7-node
154
+ - image: circleci/ruby:2.6.5-node
311
155
  environment:
312
- - RAILS_VERSION=5.0.5
156
+ - RAILS_VERSION=master
313
157
  - DATABASE_URL=postgres://postgres@localhost/statesman_test
314
158
  - EXCLUDE_MONGOID=true
315
159
  - DATABASE_DEPENDENCY_PORT=5432
@@ -318,21 +162,12 @@ jobs:
318
162
  - POSTGRES_USER=postgres
319
163
  - POSTGRES_DB=statesman_test
320
164
  steps: *steps
321
- build-ruby227-rails-513-mongo:
165
+ build-ruby249-rails-523-mysql:
322
166
  docker:
323
- - image: circleci/ruby:2.2.7-node
167
+ - image: circleci/ruby:2.4.9-node
324
168
  environment:
325
- - RAILS_VERSION=5.1.3
326
- - DATABASE_DEPENDENCY_PORT=27017
327
- - image: circleci/mongo:3
328
- steps: *steps
329
- build-ruby227-rails-513-mysql:
330
- docker:
331
- - image: circleci/ruby:2.2.7-node
332
- environment:
333
- - RAILS_VERSION=5.1.3
169
+ - RAILS_VERSION=5.2.3
334
170
  - DATABASE_URL=mysql2://root@127.0.0.1/statesman_test
335
- - EXCLUDE_MONGOID=true
336
171
  - DATABASE_DEPENDENCY_PORT=3306
337
172
  - image: circleci/mysql:5.7.18
338
173
  environment:
@@ -341,13 +176,12 @@ jobs:
341
176
  - MYSQL_PASSWORD=
342
177
  - MYSQL_DATABASE=statesman_test
343
178
  steps: *steps
344
- build-ruby227-rails-513-postgres:
179
+ build-ruby249-rails-523-postgres:
345
180
  docker:
346
- - image: circleci/ruby:2.2.7-node
181
+ - image: circleci/ruby:2.4.9-node
347
182
  environment:
348
- - RAILS_VERSION=5.1.3
183
+ - RAILS_VERSION=5.2.3
349
184
  - DATABASE_URL=postgres://postgres@localhost/statesman_test
350
- - EXCLUDE_MONGOID=true
351
185
  - DATABASE_DEPENDENCY_PORT=5432
352
186
  - image: circleci/postgres:9.6
353
187
  environment:
@@ -355,34 +189,20 @@ jobs:
355
189
  - POSTGRES_DB=statesman_test
356
190
  steps: *steps
357
191
 
192
+
358
193
  workflows:
359
194
  version: 2
360
195
  tests:
361
196
  jobs:
362
- - build-ruby241-rails-429-mongo
363
- - build-ruby241-rails-429-mysql
364
- - build-ruby241-rails-429-postgres
365
- - build-ruby241-rails-505-mongo
366
- - build-ruby241-rails-505-mysql
367
- - build-ruby241-rails-505-postgres
368
- - build-ruby241-rails-513-mongo
369
- - build-ruby241-rails-513-mysql
370
- - build-ruby241-rails-513-postgres
371
- - build-ruby233-rails-429-mongo
372
- - build-ruby233-rails-429-mysql
373
- - build-ruby233-rails-429-postgres
374
- - build-ruby233-rails-505-mongo
375
- - build-ruby233-rails-505-mysql
376
- - build-ruby233-rails-505-postgres
377
- - build-ruby233-rails-513-mongo
378
- - build-ruby233-rails-513-mysql
379
- - build-ruby233-rails-513-postgres
380
- - build-ruby227-rails-429-mongo
381
- - build-ruby227-rails-429-mysql
382
- - build-ruby227-rails-429-postgres
383
- - build-ruby227-rails-505-mongo
384
- - build-ruby227-rails-505-mysql
385
- - build-ruby227-rails-505-postgres
386
- - build-ruby227-rails-513-mongo
387
- - build-ruby227-rails-513-mysql
388
- - build-ruby227-rails-513-postgres
197
+ - build-ruby249-rails-429-mysql
198
+ - build-ruby249-rails-429-postgres
199
+ - build-ruby249-rails-505-mysql
200
+ - build-ruby249-rails-505-postgres
201
+ - build-ruby249-rails-513-mysql
202
+ - build-ruby249-rails-513-postgres
203
+ - build-ruby249-rails-523-mysql
204
+ - build-ruby249-rails-523-postgres
205
+ - build-ruby265-rails-600-mysql
206
+ - build-ruby265-rails-600-postgres
207
+ - build-ruby265-rails-master-mysql
208
+ - build-ruby265-rails-master-postgres
data/.rubocop.yml CHANGED
@@ -4,4 +4,4 @@ inherit_gem:
4
4
  gc_ruboconfig: rubocop.yml
5
5
 
6
6
  AllCops:
7
- TargetRubyVersion: 2.2
7
+ TargetRubyVersion: 2.4
data/.rubocop_todo.yml CHANGED
@@ -1,20 +1,31 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-06-07 12:21:30 +0100 using RuboCop version 0.56.0.
3
+ # on 2019-08-17 15:19:58 +0100 using RuboCop version 0.61.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 4
9
+ Gemspec/RequiredRubyVersion:
10
+ Enabled: false # We want to allow Ruby 2.2 even though we don't test on it
11
+
12
+ # Offense count: 5
10
13
  Metrics/AbcSize:
11
14
  Max: 18
12
15
 
13
16
  # Offense count: 4
14
- # Configuration parameters: CountComments.
17
+ # Configuration parameters: CountComments, ExcludedMethods.
15
18
  Metrics/MethodLength:
16
19
  Max: 14
17
20
 
21
+ # Offense count: 2
22
+ # Cop supports --auto-correct.
23
+ # Configuration parameters: SkipBlocks, EnforcedStyle.
24
+ # SupportedStyles: described_class, explicit
25
+ RSpec/DescribedClass:
26
+ Exclude:
27
+ - 'spec/statesman/adapters/active_record_queries_spec.rb'
28
+
18
29
  # Offense count: 7
19
30
  # Configuration parameters: Max.
20
31
  RSpec/ExampleLength:
@@ -29,6 +40,12 @@ RSpec/ExpectInHook:
29
40
  - 'spec/statesman/adapters/active_record_spec.rb'
30
41
  - 'spec/statesman/machine_spec.rb'
31
42
 
43
+ # Offense count: 3
44
+ RSpec/ImplicitBlockExpectation:
45
+ Exclude:
46
+ - 'spec/statesman/adapters/active_record_spec.rb'
47
+ - 'spec/statesman/adapters/shared_examples.rb'
48
+
32
49
  # Offense count: 1
33
50
  # Configuration parameters: AssignmentOnly.
34
51
  RSpec/InstanceVariable:
@@ -40,6 +57,11 @@ RSpec/IteratedExpectation:
40
57
  Exclude:
41
58
  - 'spec/statesman/machine_spec.rb'
42
59
 
60
+ # Offense count: 1
61
+ RSpec/LeakyConstantDeclaration:
62
+ Exclude:
63
+ - 'spec/statesman/adapters/active_record_queries_spec.rb'
64
+
43
65
  # Offense count: 3
44
66
  RSpec/LetSetup:
45
67
  Exclude:
@@ -66,16 +88,14 @@ RSpec/NestedGroups:
66
88
  RSpec/ScatteredSetup:
67
89
  Exclude:
68
90
  - 'spec/statesman/adapters/active_record_spec.rb'
69
- - 'spec/statesman/adapters/mongoid_spec.rb'
70
91
  - 'spec/statesman/adapters/shared_examples.rb'
71
92
  - 'spec/statesman/machine_spec.rb'
72
93
 
73
94
  # Offense count: 8
74
- # Configuration parameters: IgnoreSymbolicNames.
95
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
75
96
  RSpec/VerifiedDoubles:
76
97
  Exclude:
77
98
  - 'spec/generators/statesman/active_record_transition_generator_spec.rb'
78
99
  - 'spec/generators/statesman/migration_generator_spec.rb'
79
100
  - 'spec/statesman/adapters/active_record_spec.rb'
80
- - 'spec/statesman/adapters/mongoid_spec.rb'
81
101
  - 'spec/statesman/adapters/shared_examples.rb'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,72 @@
1
+ ## v6.0.0, 20th December 2019
2
+
3
+ **Breaking changes**
4
+
5
+ - Drop official support for Ruby 2.2 and 2.3 following our [compatibility
6
+ policy](https://github.com/gocardless/statesman/blob/master/docs/COMPATIBILITY.md).
7
+
8
+
9
+ ## v5.2.0, 17th December 2019
10
+
11
+ - Issue `most_recent_transition_join` query as a single-line string [#381](https://github.com/gocardless/statesman/pull/381)
12
+
13
+ ## v5.1.0, 22th November 2019
14
+
15
+ - Correct `Statesman::Adapters::ActiveRecordQueries` error text [@Bramjetten](https://github.com/gocardless/statesman/pull/376)
16
+ - Removes duplicate `map` call [Isaac Seymour](https://github.com/gocardless/statesman/pull/362)
17
+ - Update changelog with instructions of how to use `ActiveRecordQueries` added
18
+ in v5.0.0
19
+ - Pass exception into `after_transition_failure` and `after_guard_failure` callbacks [@credric-cordenier](https://github.com/gocardless/statesman/pull/378)
20
+
21
+ ## v5.0.0, 11th November 2019
22
+
23
+ - Adds new syntax and restrictions to ActiveRecordQueries [PR#358](https://github.com/gocardless/statesman/pull/358). With the introduction of this, defining `self.transition_class` or `self.initial_state` is deprecated and will be removed in the next major release.
24
+ Change
25
+ ```ruby
26
+ include Statesman::Adapters::ActiveRecordQueries
27
+ def self.initial_state
28
+ :initial
29
+ end
30
+ def self.transition_class
31
+ MyTransition
32
+ end
33
+ ```
34
+ to
35
+ ```ruby
36
+ include Statesman::Adapters::ActiveRecordQueries[
37
+ initial_state: :inital,
38
+ transition_class: MyTransition
39
+ ]
40
+ ```
41
+
42
+ ## v4.1.4, 11th November 2019
43
+
44
+ - Reverts the breaking changes from [PR#358](https://github.com/gocardless/statesman/pull/358) & `v4.1.3` that where included in the last minor release. If you have changed your code to work with these changes `v5.0.0` will be a copy of `v4.1.3` with a bugfix applied.
45
+
46
+ ## v4.1.3, 6th November 2019
47
+
48
+ - Add accessible from / to state attributes on the `TransitionFailedError` to avoid parsing strings [@ahjmorton](https://github.com/gocardless/statesman/pull/367)
49
+ - Add `after_transition_failure` mechanism [@credric-cordenier](https://github.com/gocardless/statesman/pull/366)
50
+
51
+ ## v4.1.2, 17th August 2019
52
+
53
+ - Add support for Rails 6 [@greysteil](https://github.com/gocardless/statesman/pull/360)
54
+
55
+ ## v4.1.1, 6th July 2019
56
+
57
+ - Fix statesman index detection for indexes that start t-z [@hmarr](https://github.com/gocardless/statesman/pull/354)
58
+ - Correct access of metadata via `state_machine` [@glenpike](https://github.com/gocardless/statesman/pull/349)
59
+
60
+ ## v4.1.0, 10 April 2019
61
+
62
+ - Add better support for mysql (and others) in `transition_conflict_error?` [@greysteil](https://github.com/greysteil) (https://github.com/gocardless/statesman/pull/342)
63
+
64
+ ## v4.0.0, 22 February 2019
65
+
66
+ - Forces Statesman to use a new transactions with `requires_new: true` (https://github.com/gocardless/statesman/pull/249)
67
+ - Fixes an issue with `after_commit` transition blocks that where being
68
+ executed even if the transaction rolled back. ([patch](https://github.com/gocardless/statesman/pull/338) by [@matid](https://github.com/matid))
69
+
1
70
  ## v3.5.0, 2 November 2018
2
71
 
3
72
  - Expose `most_recent_transition_join` - ActiveRecords `or` requires that both
data/Gemfile CHANGED
@@ -1,12 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
- gem "rails", "~> #{ENV['RAILS_VERSION']}" if ENV["RAILS_VERSION"]
7
+ # rubocop:disable Bundler/DuplicatedGem
8
+ if ENV['RAILS_VERSION'] == 'master'
9
+ gem "rails", git: "https://github.com/rails/rails"
10
+ elsif ENV['RAILS_VERSION']
11
+ gem "rails", "~> #{ENV['RAILS_VERSION']}"
12
+ end
13
+ # rubocop:enable Bundler/DuplicatedGem
6
14
 
7
15
  group :development do
8
- gem "mongoid", ">= 3.1" unless ENV["EXCLUDE_MONGOID"]
9
-
10
16
  # test/unit is no longer bundled with Ruby 2.2, but required by Rails
11
17
  gem "test-unit", "~> 3.0" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.2.0")
12
18
  end
data/Guardfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # A sample Guardfile
2
4
  # More info at https://github.com/guard/guard#readme
3
5