state_machines-activerecord 0.9.0 → 0.31.0

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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +10 -2
  4. data/lib/state_machines/integrations/active_record/locale.rb +12 -9
  5. data/lib/state_machines/integrations/active_record/version.rb +3 -1
  6. data/lib/state_machines/integrations/active_record.rb +59 -102
  7. data/lib/state_machines-activerecord.rb +2 -0
  8. metadata +36 -142
  9. data/test/files/en.yml +0 -5
  10. data/test/files/models/post.rb +0 -11
  11. data/test/integration_test.rb +0 -25
  12. data/test/machine_by_default_test.rb +0 -16
  13. data/test/machine_errors_test.rb +0 -19
  14. data/test/machine_multiple_test.rb +0 -17
  15. data/test/machine_nested_action_test.rb +0 -38
  16. data/test/machine_unmigrated_test.rb +0 -14
  17. data/test/machine_with_aliased_attribute_test.rb +0 -23
  18. data/test/machine_with_callbacks_test.rb +0 -172
  19. data/test/machine_with_column_state_attribute_test.rb +0 -44
  20. data/test/machine_with_complex_pluralization_scopes_test.rb +0 -16
  21. data/test/machine_with_conflicting_predicate_test.rb +0 -18
  22. data/test/machine_with_conflicting_state_name_test.rb +0 -29
  23. data/test/machine_with_custom_attribute_test.rb +0 -21
  24. data/test/machine_with_default_scope_test.rb +0 -18
  25. data/test/machine_with_different_column_default_test.rb +0 -27
  26. data/test/machine_with_different_integer_column_default_test.rb +0 -29
  27. data/test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb +0 -24
  28. data/test/machine_with_dirty_attribute_and_state_events_test.rb +0 -20
  29. data/test/machine_with_dirty_attributes_and_custom_attribute_test.rb +0 -32
  30. data/test/machine_with_dirty_attributes_during_loopback_test.rb +0 -22
  31. data/test/machine_with_dirty_attributes_test.rb +0 -35
  32. data/test/machine_with_dynamic_initial_state_test.rb +0 -99
  33. data/test/machine_with_event_attributes_on_autosave_test.rb +0 -48
  34. data/test/machine_with_event_attributes_on_custom_action_test.rb +0 -41
  35. data/test/machine_with_event_attributes_on_save_bang_test.rb +0 -82
  36. data/test/machine_with_event_attributes_on_save_test.rb +0 -244
  37. data/test/machine_with_event_attributes_on_validation_test.rb +0 -143
  38. data/test/machine_with_events_test.rb +0 -13
  39. data/test/machine_with_failed_action_test.rb +0 -40
  40. data/test/machine_with_failed_after_callbacks_test.rb +0 -35
  41. data/test/machine_with_failed_before_callbacks_test.rb +0 -36
  42. data/test/machine_with_initialized_state_test.rb +0 -41
  43. data/test/machine_with_internationalization_test.rb +0 -180
  44. data/test/machine_with_loopback_test.rb +0 -22
  45. data/test/machine_with_non_column_state_attribute_defined_test.rb +0 -29
  46. data/test/machine_with_same_column_default_test.rb +0 -26
  47. data/test/machine_with_same_integer_column_default_test.rb +0 -30
  48. data/test/machine_with_scopes_and_joins_test.rb +0 -38
  49. data/test/machine_with_scopes_and_owner_subclass_test.rb +0 -27
  50. data/test/machine_with_scopes_test.rb +0 -70
  51. data/test/machine_with_state_driven_validations_test.rb +0 -30
  52. data/test/machine_with_states_test.rb +0 -13
  53. data/test/machine_with_static_initial_state_test.rb +0 -167
  54. data/test/machine_with_transactions_test.rb +0 -26
  55. data/test/machine_with_validations_and_custom_attribute_test.rb +0 -21
  56. data/test/machine_with_validations_test.rb +0 -47
  57. data/test/machine_without_database_test.rb +0 -20
  58. data/test/machine_without_transactions_test.rb +0 -26
  59. data/test/model_test.rb +0 -12
  60. data/test/test_helper.rb +0 -58
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 570d0e44cce8dade9ceb135c6e24cfcafb7dc0325ee8f40d99658d663072e234
4
- data.tar.gz: 2195bc14693c748c3248c3ddd42bc0a26faccbdf78285c6d24f17e54bd3ec0fd
3
+ metadata.gz: 62bf9146491c433a75447414d5f9cfbab995f876eac289ddbca8ebf7dd9f6714
4
+ data.tar.gz: 5cc62a238e1e450ec00f3f0091130dba47accf257cd1cf2759fa1b682442a09a
5
5
  SHA512:
6
- metadata.gz: dde59866fccfe87fbd05658fd0f0b5d92c2129ff3e448c75983722e7a5468cc3201f63dfb319442a60e536e4774ecfd61429d0e979e454abba568e10a1b7cc15
7
- data.tar.gz: f78734f5c798ae8f468d69d22e1983b95839dcf724e6b7c1e6563f81a3f1976930b6ff52d275163feaccd0419888a9d754f47d587a112df019a9c9804f21bd31
6
+ metadata.gz: 4633127d19fc427f41ac5343be2c31c8cd11aed017b2511048dbeaacb9e18e8de17f94d2c65fd1effe49f057987269bb4d290bd23a4b8aa450b8ad1f3ec9b321
7
+ data.tar.gz: 9e2443229c90ae33740efafe0e34f931cc8cb61d50fa72069b63ab4cc6e00677d282ff2f71c9a569c63928d5e2088bd4c8d4079e00ff061093937873e33c263c
data/LICENSE.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  Copyright (c) 2006-2012 Aaron Pfeifer
2
- Copyright (c) 2014-2023 Abdelkader Boudih
2
+ Copyright (c) 2014-2025 Abdelkader Boudih
3
3
 
4
4
  MIT License
5
5
 
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- [![Build Status](https://travis-ci.com/state-machines/state_machines-activerecord.svg?branch=master)](https://travis-ci.com/state-machines/state_machines-activerecord)
2
- [![Code Climate](https://codeclimate.com/github/state-machines/state_machines-activerecord.svg)](https://codeclimate.com/github/state-machines/state_machines-activerecord)
1
+ [![Build Status](https://github.com/state-machines/state_machines-activerecord/actions/workflows/ruby.yml/badge.svg)](https://github.com/state-machines/state_machines-activerecord/actions/workflows/ruby.yml)
3
2
 
4
3
  # StateMachines Active Record Integration
5
4
 
@@ -64,6 +63,15 @@ Vehicle.with_state(:parked) # also plural #with_states
64
63
  Vehicle.without_states(:first_gear, :second_gear) # also singular #without_state
65
64
  ```
66
65
 
66
+ #### Transparent Scopes
67
+ State scopes will return all records when `nil` is passed, making them perfect for search filters:
68
+
69
+ ```ruby
70
+ Vehicle.with_state(nil) # Returns all vehicles
71
+ Vehicle.with_state(params[:state]) # Returns all vehicles if params[:state] is nil
72
+ Vehicle.where(color: 'red').with_state(nil) # Returns all red vehicles (chainable)
73
+ ```
74
+
67
75
  ### State driven validations
68
76
 
69
77
  As mentioned in `StateMachines::Machine#state`, you can define behaviors,
@@ -1,12 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Use lazy evaluation to avoid circular dependencies with frozen default_messages
4
+ # This ensures messages can be updated after gem loading while maintaining thread safety
1
5
  { en: {
2
- activerecord: {
3
- errors: {
4
- messages: {
5
- invalid: StateMachines::Machine.default_messages[:invalid],
6
- invalid_event: StateMachines::Machine.default_messages[:invalid_event] % ['%{state}'],
7
- invalid_transition: StateMachines::Machine.default_messages[:invalid_transition] % ['%{event}']
8
- }
9
- }
6
+ activerecord: {
7
+ errors: {
8
+ messages: {
9
+ invalid: ->(*) { StateMachines::Machine.default_messages[:invalid] },
10
+ invalid_event: ->(*) { format(StateMachines::Machine.default_messages[:invalid_event], '%<state>s') },
11
+ invalid_transition: ->(*) { format(StateMachines::Machine.default_messages[:invalid_transition], '%<event>s') }
12
+ }
10
13
  }
14
+ }
11
15
  } }
12
-
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module StateMachines
2
4
  module Integrations
3
5
  module ActiveRecord
4
- VERSION = '0.9.0'
6
+ VERSION = '0.31.0'
5
7
  end
6
8
  end
7
9
  end
@@ -3,7 +3,7 @@ require 'active_record'
3
3
  require 'state_machines/integrations/active_record/version'
4
4
 
5
5
  module StateMachines
6
- module Integrations #:nodoc:
6
+ module Integrations # :nodoc:
7
7
  # Adds support for integrating state machines with ActiveRecord models.
8
8
  #
9
9
  # == Examples
@@ -78,16 +78,14 @@ module StateMachines
78
78
  # === Security implications
79
79
  #
80
80
  # Beware that public event attributes mean that events can be fired
81
- # whenever mass-assignment is being used. If you want to prevent malicious
82
- # users from tampering with events through URLs / forms, the attribute
83
- # should be protected like so:
84
- #
85
- # class Vehicle < ApplicationRecord
86
- # attr_protected :state_event
87
- # # attr_accessible ... # Alternative technique
88
- #
89
- # state_machine do
90
- # ...
81
+ # whenever mass-assignment is being used. If you want to prevent malicious
82
+ # users from tampering with events through URLs / forms, you should use
83
+ # Rails' strong parameters to control which attributes are permitted:
84
+ #
85
+ # class VehiclesController < ApplicationController
86
+ # def vehicle_params
87
+ # params.require(:vehicle).permit(:color, :make, :model)
88
+ # # Exclude state_event to prevent tampering
91
89
  # end
92
90
  # end
93
91
  #
@@ -95,8 +93,7 @@ module StateMachines
95
93
  # you can build two state machines (one public and one protected) like so:
96
94
  #
97
95
  # class Vehicle < ApplicationRecord
98
- # attr_protected :state_event # Prevent access to events in the first machine
99
- #
96
+ # # Define private machine
100
97
  # state_machine do
101
98
  # # Define private events here
102
99
  # end
@@ -105,6 +102,8 @@ module StateMachines
105
102
  # state_machine :public_state, :attribute => :state do
106
103
  # # Define public events here
107
104
  # end
105
+ #
106
+ # # Control access via strong parameters in your controller
108
107
  # end
109
108
  #
110
109
  # == Transactions
@@ -199,33 +198,43 @@ module StateMachines
199
198
  #
200
199
  # == Scopes
201
200
  #
202
- # To assist in filtering models with specific states, a series of named
203
- # scopes are defined on the model for finding records with or without a
201
+ # To assist in filtering models with specific states, a series of scopes
202
+ # are defined on the model for finding records with or without a
204
203
  # particular set of states.
205
204
  #
206
- # These named scopes are essentially the functional equivalent of the
205
+ # These scopes are essentially the functional equivalent of the
207
206
  # following definitions:
208
207
  #
209
208
  # class Vehicle < ApplicationRecord
210
209
  # # with_states also aliased to with_state
210
+ # scope :with_states, ->(states) { states.present? ? where(state: states) : all }
211
211
  #
212
- # named_scope :without_states, lambda {|*states| {:conditions => ['state NOT IN (?)', states]}}
213
212
  # # without_states also aliased to without_state
213
+ # scope :without_states, ->(states) { states.present? ? where.not(state: states) : all }
214
214
  # end
215
215
  #
216
216
  # *Note*, however, that the states are converted to their stored values
217
217
  # before being passed into the query.
218
218
  #
219
- # Because of the way named scopes work in ActiveRecord, they can be
219
+ # Because of the way scopes work in ActiveRecord, they can be
220
220
  # chained like so:
221
221
  #
222
- # Vehicle.with_state(:parked).all(:order => 'id DESC')
222
+ # Vehicle.with_state(:parked).order(id: :desc)
223
223
  #
224
224
  # Note that states can also be referenced by the string version of their
225
225
  # name:
226
226
  #
227
227
  # Vehicle.with_state('parked')
228
228
  #
229
+ # === Transparent Scopes
230
+ #
231
+ # When `nil` is passed to any of the state scopes, they return `all` records
232
+ # without applying any filters. This allows for more flexible scope chaining
233
+ # in search interfaces:
234
+ #
235
+ # Vehicle.with_state(params[:state]) # Returns all vehicles if params[:state] is nil
236
+ # Vehicle.where(color: 'red').with_state(nil) # Returns all red vehicles
237
+ #
229
238
  # == Callbacks
230
239
  #
231
240
  # All before/after transition callbacks defined for ActiveRecord models
@@ -266,7 +275,7 @@ module StateMachines
266
275
  # your callback to roll back. You can work around this issue like so:
267
276
  #
268
277
  # class TransitionLog < ApplicationRecord
269
- # establish_connection Rails.env.to_sym
278
+ # connects_to database: { writing: :primary, reading: :primary }
270
279
  # end
271
280
  #
272
281
  # class Vehicle < ApplicationRecord
@@ -279,7 +288,7 @@ module StateMachines
279
288
  # end
280
289
  # end
281
290
  #
282
- # The +TransitionLog+ model establishes a second connection to the database
291
+ # The +TransitionLog+ model establishes a separate connection to the database
283
292
  # that allows new records to be saved without being affected by rollbacks
284
293
  # in the +Vehicle+ model's transaction.
285
294
  #
@@ -304,65 +313,9 @@ module StateMachines
304
313
  # * (-) end transaction (if enabled)
305
314
  # * (9) after_commit
306
315
  #
307
- # == Observers
308
- #
309
- # In addition to support for ActiveRecord-like hooks, there is additional
310
- # support for ActiveRecord observers. Because of the way ActiveRecord
311
- # observers are designed, there is less flexibility around the specific
312
- # transitions that can be hooked in. However, a large number of hooks
313
- # *are* supported. For example, if a transition for a record's +state+
314
- # attribute changes the state from +parked+ to +idling+ via the +ignite+
315
- # event, the following observer methods are supported:
316
- # * before/after/after_failure_to-_ignite_from_parked_to_idling
317
- # * before/after/after_failure_to-_ignite_from_parked
318
- # * before/after/after_failure_to-_ignite_to_idling
319
- # * before/after/after_failure_to-_ignite
320
- # * before/after/after_failure_to-_transition_state_from_parked_to_idling
321
- # * before/after/after_failure_to-_transition_state_from_parked
322
- # * before/after/after_failure_to-_transition_state_to_idling
323
- # * before/after/after_failure_to-_transition_state
324
- # * before/after/after_failure_to-_transition
325
- #
326
- # The following class shows an example of some of these hooks:
327
- #
328
- # class VehicleObserver < ActiveRecord::Observer
329
- # def before_save(vehicle)
330
- # # log message
331
- # end
332
- #
333
- # # Callback for :ignite event *before* the transition is performed
334
- # def before_ignite(vehicle, transition)
335
- # # log message
336
- # end
337
- #
338
- # # Callback for :ignite event *after* the transition has been performed
339
- # def after_ignite(vehicle, transition)
340
- # # put on seatbelt
341
- # end
342
- #
343
- # # Generic transition callback *before* the transition is performed
344
- # def after_transition(vehicle, transition)
345
- # Audit.log(vehicle, transition)
346
- # end
347
- # end
348
- #
349
- # More flexible transition callbacks can be defined directly within the
350
- # model as described in StateMachines::Machine#before_transition
351
- # and StateMachines::Machine#after_transition.
352
- #
353
- # To define a single observer for multiple state machines:
354
- #
355
- # class StateMachineObserver < ActiveRecord::Observer
356
- # observe Vehicle, Switch, Project
357
- #
358
- # def after_transition(record, transition)
359
- # Audit.log(record, transition)
360
- # end
361
- # end
362
- #
363
316
  # == Internationalization
364
317
  #
365
- # In Rails 2.2+, any error message that is generated from performing invalid
318
+ # Any error message that is generated from performing invalid
366
319
  # transitions can be localized. The following default translations are used:
367
320
  #
368
321
  # en:
@@ -375,9 +328,6 @@ module StateMachines
375
328
  # # %{value} = attribute value, %{event} = Human event name, %{state} = Human current state name
376
329
  # invalid_transition: "cannot transition via %{event}"
377
330
  #
378
- # Notice that the interpolation syntax is %{key} in Rails 3+. In Rails 2.x,
379
- # the appropriate syntax is {{key}}.
380
- #
381
331
  # You can override these for a specific model like so:
382
332
  #
383
333
  # en:
@@ -417,7 +367,7 @@ module StateMachines
417
367
  include ActiveModel
418
368
 
419
369
  # The default options to use for state machines using this integration
420
- @defaults = {:action => :save, use_transactions: true}
370
+ @defaults = { action: :save, use_transactions: true }
421
371
  class << self
422
372
  # Classes that inherit from ActiveRecord::Base will automatically use
423
373
  # the ActiveRecord integration.
@@ -435,28 +385,29 @@ module StateMachines
435
385
 
436
386
  # Gets the db default for the machine's attribute
437
387
  def owner_class_attribute_default
438
- if owner_class.connected? && owner_class.table_exists?
439
- owner_class.column_defaults[attribute.to_s]
440
- end
388
+ return unless owner_class.connected? && owner_class.table_exists?
389
+
390
+ owner_class.column_defaults[attribute.to_s]
441
391
  end
442
392
 
443
393
  def define_state_initializer
444
- define_helper :instance, <<-end_eval, __FILE__, __LINE__ + 1
394
+ define_helper :instance, <<-END_EVAL, __FILE__, __LINE__ + 1
445
395
  def initialize(attributes = nil, *)
446
396
  super(attributes) do |*args|
447
- scoped_attributes = (attributes || {}).merge(self.class.scope_attributes)
397
+ attributes = (attributes || {}).transform_keys { |key| self.class.attribute_aliases[key.to_s] || key }
398
+ scoped_attributes = attributes.merge(self.class.scope_attributes)
448
399
 
449
400
  self.class.state_machines.initialize_states(self, {}, scoped_attributes)
450
401
  yield(*args) if block_given?
451
402
  end
452
403
  end
453
- end_eval
404
+ END_EVAL
454
405
  end
455
406
 
456
407
  # Uses around callbacks to run state events if using the :save hook
457
408
  def define_action_hook
458
409
  if action_hook == :save
459
- define_helper :instance, <<-end_eval, __FILE__, __LINE__ + 1
410
+ define_helper :instance, <<-END_EVAL, __FILE__, __LINE__ + 1
460
411
  def save(*, **)
461
412
  self.class.state_machine(#{name.inspect}).send(:around_save, self) { super }
462
413
  end
@@ -469,15 +420,15 @@ module StateMachines
469
420
  def changed_for_autosave?
470
421
  super || self.class.state_machines.any? {|name, machine| machine.action == :save && machine.read(self, :event)}
471
422
  end
472
- end_eval
423
+ END_EVAL
473
424
  else
474
425
  super
475
426
  end
476
427
  end
477
428
 
478
429
  # Runs state events around the machine's :save action
479
- def around_save(object)
480
- object.class.state_machines.transitions(object, action).perform { yield }
430
+ def around_save(object, &)
431
+ object.class.state_machines.transitions(object, action).perform(&)
481
432
  end
482
433
 
483
434
  # Creates a scope for finding records *with* a particular state or
@@ -515,17 +466,23 @@ module StateMachines
515
466
 
516
467
  private
517
468
 
518
- # Defines a new named scope with the given name
519
- def create_scope(name, scope)
520
- lambda { |model, values| model.where(scope.call(values)) }
521
- end
469
+ # Defines a new scope with the given name
470
+ def create_scope(_name, scope)
471
+ ->(model, values) { values.present? ? model.where(scope.call(values)) : model.all }
472
+ end
522
473
 
523
- # ActiveModel's use of method_missing / respond_to for attribute methods
524
- # breaks both ancestor lookups and defined?(super). Need to special-case
525
- # the existence of query attribute methods.
526
- def owner_class_ancestor_has_method?(scope, method)
527
- scope == :instance && method == "#{attribute}?" ? owner_class : super
528
- end
474
+ # Generates the results for the given scope based on one or more states to filter by
475
+ def run_scope(scope, machine, klass, states)
476
+ values = states.flatten.compact.map { |state| machine.states.fetch(state).value }
477
+ scope.call(klass, values)
478
+ end
479
+
480
+ # ActiveModel's use of method_missing / respond_to for attribute methods
481
+ # breaks both ancestor lookups and defined?(super). Need to special-case
482
+ # the existence of query attribute methods.
483
+ def owner_class_ancestor_has_method?(scope, method)
484
+ scope == :instance && method == "#{attribute}?" ? owner_class : super
485
+ end
529
486
  end
530
487
  register(ActiveRecord)
531
488
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support'
2
4
  require 'state_machines/integrations/active_record'
3
5
 
metadata CHANGED
@@ -1,114 +1,113 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: state_machines-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih
8
8
  - Aaron Pfeifer
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2023-06-30 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: state_machines-activemodel
14
+ name: activerecord
16
15
  requirement: !ruby/object:Gem::Requirement
17
16
  requirements:
18
17
  - - ">="
19
18
  - !ruby/object:Gem::Version
20
- version: 0.9.0
19
+ version: '7.1'
21
20
  type: :runtime
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
24
  - - ">="
26
25
  - !ruby/object:Gem::Version
27
- version: 0.9.0
26
+ version: '7.1'
28
27
  - !ruby/object:Gem::Dependency
29
- name: activerecord
28
+ name: state_machines-activemodel
30
29
  requirement: !ruby/object:Gem::Requirement
31
30
  requirements:
32
31
  - - ">="
33
32
  - !ruby/object:Gem::Version
34
- version: '6.0'
33
+ version: 0.10.0
35
34
  type: :runtime
36
35
  prerelease: false
37
36
  version_requirements: !ruby/object:Gem::Requirement
38
37
  requirements:
39
38
  - - ">="
40
39
  - !ruby/object:Gem::Version
41
- version: '6.0'
40
+ version: 0.10.0
42
41
  - !ruby/object:Gem::Dependency
43
- name: rake
42
+ name: appraisal
44
43
  requirement: !ruby/object:Gem::Requirement
45
44
  requirements:
46
- - - "~>"
45
+ - - ">="
47
46
  - !ruby/object:Gem::Version
48
- version: '13.0'
47
+ version: '1'
49
48
  type: :development
50
49
  prerelease: false
51
50
  version_requirements: !ruby/object:Gem::Requirement
52
51
  requirements:
53
- - - "~>"
52
+ - - ">="
54
53
  - !ruby/object:Gem::Version
55
- version: '13.0'
54
+ version: '1'
56
55
  - !ruby/object:Gem::Dependency
57
- name: sqlite3
56
+ name: minitest
58
57
  requirement: !ruby/object:Gem::Requirement
59
58
  requirements:
60
- - - "~>"
59
+ - - ">="
61
60
  - !ruby/object:Gem::Version
62
- version: '1.3'
61
+ version: 5.4.0
63
62
  type: :development
64
63
  prerelease: false
65
64
  version_requirements: !ruby/object:Gem::Requirement
66
65
  requirements:
67
- - - "~>"
66
+ - - ">="
68
67
  - !ruby/object:Gem::Version
69
- version: '1.3'
68
+ version: 5.4.0
70
69
  - !ruby/object:Gem::Dependency
71
- name: appraisal
70
+ name: minitest-reporters
72
71
  requirement: !ruby/object:Gem::Requirement
73
72
  requirements:
74
73
  - - ">="
75
74
  - !ruby/object:Gem::Version
76
- version: '1'
75
+ version: '0'
77
76
  type: :development
78
77
  prerelease: false
79
78
  version_requirements: !ruby/object:Gem::Requirement
80
79
  requirements:
81
80
  - - ">="
82
81
  - !ruby/object:Gem::Version
83
- version: '1'
82
+ version: '0'
84
83
  - !ruby/object:Gem::Dependency
85
- name: minitest
84
+ name: rake
86
85
  requirement: !ruby/object:Gem::Requirement
87
86
  requirements:
88
- - - ">="
87
+ - - "~>"
89
88
  - !ruby/object:Gem::Version
90
- version: 5.4.0
89
+ version: '13.0'
91
90
  type: :development
92
91
  prerelease: false
93
92
  version_requirements: !ruby/object:Gem::Requirement
94
93
  requirements:
95
- - - ">="
94
+ - - "~>"
96
95
  - !ruby/object:Gem::Version
97
- version: 5.4.0
96
+ version: '13.0'
98
97
  - !ruby/object:Gem::Dependency
99
- name: minitest-reporters
98
+ name: sqlite3
100
99
  requirement: !ruby/object:Gem::Requirement
101
100
  requirements:
102
- - - ">="
101
+ - - "~>"
103
102
  - !ruby/object:Gem::Version
104
- version: '0'
103
+ version: '1.3'
105
104
  type: :development
106
105
  prerelease: false
107
106
  version_requirements: !ruby/object:Gem::Requirement
108
107
  requirements:
109
- - - ">="
108
+ - - "~>"
110
109
  - !ruby/object:Gem::Version
111
- version: '0'
110
+ version: '1.3'
112
111
  description: Adds support for creating state machines for attributes on ActiveRecord
113
112
  email:
114
113
  - terminale@gmail.com
@@ -123,63 +122,11 @@ files:
123
122
  - lib/state_machines/integrations/active_record.rb
124
123
  - lib/state_machines/integrations/active_record/locale.rb
125
124
  - lib/state_machines/integrations/active_record/version.rb
126
- - test/files/en.yml
127
- - test/files/models/post.rb
128
- - test/integration_test.rb
129
- - test/machine_by_default_test.rb
130
- - test/machine_errors_test.rb
131
- - test/machine_multiple_test.rb
132
- - test/machine_nested_action_test.rb
133
- - test/machine_unmigrated_test.rb
134
- - test/machine_with_aliased_attribute_test.rb
135
- - test/machine_with_callbacks_test.rb
136
- - test/machine_with_column_state_attribute_test.rb
137
- - test/machine_with_complex_pluralization_scopes_test.rb
138
- - test/machine_with_conflicting_predicate_test.rb
139
- - test/machine_with_conflicting_state_name_test.rb
140
- - test/machine_with_custom_attribute_test.rb
141
- - test/machine_with_default_scope_test.rb
142
- - test/machine_with_different_column_default_test.rb
143
- - test/machine_with_different_integer_column_default_test.rb
144
- - test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
145
- - test/machine_with_dirty_attribute_and_state_events_test.rb
146
- - test/machine_with_dirty_attributes_and_custom_attribute_test.rb
147
- - test/machine_with_dirty_attributes_during_loopback_test.rb
148
- - test/machine_with_dirty_attributes_test.rb
149
- - test/machine_with_dynamic_initial_state_test.rb
150
- - test/machine_with_event_attributes_on_autosave_test.rb
151
- - test/machine_with_event_attributes_on_custom_action_test.rb
152
- - test/machine_with_event_attributes_on_save_bang_test.rb
153
- - test/machine_with_event_attributes_on_save_test.rb
154
- - test/machine_with_event_attributes_on_validation_test.rb
155
- - test/machine_with_events_test.rb
156
- - test/machine_with_failed_action_test.rb
157
- - test/machine_with_failed_after_callbacks_test.rb
158
- - test/machine_with_failed_before_callbacks_test.rb
159
- - test/machine_with_initialized_state_test.rb
160
- - test/machine_with_internationalization_test.rb
161
- - test/machine_with_loopback_test.rb
162
- - test/machine_with_non_column_state_attribute_defined_test.rb
163
- - test/machine_with_same_column_default_test.rb
164
- - test/machine_with_same_integer_column_default_test.rb
165
- - test/machine_with_scopes_and_joins_test.rb
166
- - test/machine_with_scopes_and_owner_subclass_test.rb
167
- - test/machine_with_scopes_test.rb
168
- - test/machine_with_state_driven_validations_test.rb
169
- - test/machine_with_states_test.rb
170
- - test/machine_with_static_initial_state_test.rb
171
- - test/machine_with_transactions_test.rb
172
- - test/machine_with_validations_and_custom_attribute_test.rb
173
- - test/machine_with_validations_test.rb
174
- - test/machine_without_database_test.rb
175
- - test/machine_without_transactions_test.rb
176
- - test/model_test.rb
177
- - test/test_helper.rb
178
125
  homepage: https://github.com/state-machines/state_machines-activerecord/
179
126
  licenses:
180
127
  - MIT
181
- metadata: {}
182
- post_install_message:
128
+ metadata:
129
+ rubygems_mfa_required: 'true'
183
130
  rdoc_options: []
184
131
  require_paths:
185
132
  - lib
@@ -187,67 +134,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
187
134
  requirements:
188
135
  - - ">="
189
136
  - !ruby/object:Gem::Version
190
- version: '3.0'
137
+ version: '3.1'
191
138
  required_rubygems_version: !ruby/object:Gem::Requirement
192
139
  requirements:
193
140
  - - ">="
194
141
  - !ruby/object:Gem::Version
195
142
  version: '0'
196
143
  requirements: []
197
- rubygems_version: 3.4.10
198
- signing_key:
144
+ rubygems_version: 3.6.9
199
145
  specification_version: 4
200
146
  summary: State machines Active Record Integration
201
- test_files:
202
- - test/files/en.yml
203
- - test/files/models/post.rb
204
- - test/integration_test.rb
205
- - test/machine_by_default_test.rb
206
- - test/machine_errors_test.rb
207
- - test/machine_multiple_test.rb
208
- - test/machine_nested_action_test.rb
209
- - test/machine_unmigrated_test.rb
210
- - test/machine_with_aliased_attribute_test.rb
211
- - test/machine_with_callbacks_test.rb
212
- - test/machine_with_column_state_attribute_test.rb
213
- - test/machine_with_complex_pluralization_scopes_test.rb
214
- - test/machine_with_conflicting_predicate_test.rb
215
- - test/machine_with_conflicting_state_name_test.rb
216
- - test/machine_with_custom_attribute_test.rb
217
- - test/machine_with_default_scope_test.rb
218
- - test/machine_with_different_column_default_test.rb
219
- - test/machine_with_different_integer_column_default_test.rb
220
- - test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
221
- - test/machine_with_dirty_attribute_and_state_events_test.rb
222
- - test/machine_with_dirty_attributes_and_custom_attribute_test.rb
223
- - test/machine_with_dirty_attributes_during_loopback_test.rb
224
- - test/machine_with_dirty_attributes_test.rb
225
- - test/machine_with_dynamic_initial_state_test.rb
226
- - test/machine_with_event_attributes_on_autosave_test.rb
227
- - test/machine_with_event_attributes_on_custom_action_test.rb
228
- - test/machine_with_event_attributes_on_save_bang_test.rb
229
- - test/machine_with_event_attributes_on_save_test.rb
230
- - test/machine_with_event_attributes_on_validation_test.rb
231
- - test/machine_with_events_test.rb
232
- - test/machine_with_failed_action_test.rb
233
- - test/machine_with_failed_after_callbacks_test.rb
234
- - test/machine_with_failed_before_callbacks_test.rb
235
- - test/machine_with_initialized_state_test.rb
236
- - test/machine_with_internationalization_test.rb
237
- - test/machine_with_loopback_test.rb
238
- - test/machine_with_non_column_state_attribute_defined_test.rb
239
- - test/machine_with_same_column_default_test.rb
240
- - test/machine_with_same_integer_column_default_test.rb
241
- - test/machine_with_scopes_and_joins_test.rb
242
- - test/machine_with_scopes_and_owner_subclass_test.rb
243
- - test/machine_with_scopes_test.rb
244
- - test/machine_with_state_driven_validations_test.rb
245
- - test/machine_with_states_test.rb
246
- - test/machine_with_static_initial_state_test.rb
247
- - test/machine_with_transactions_test.rb
248
- - test/machine_with_validations_and_custom_attribute_test.rb
249
- - test/machine_with_validations_test.rb
250
- - test/machine_without_database_test.rb
251
- - test/machine_without_transactions_test.rb
252
- - test/model_test.rb
253
- - test/test_helper.rb
147
+ test_files: []
data/test/files/en.yml DELETED
@@ -1,5 +0,0 @@
1
- en:
2
- activerecord:
3
- errors:
4
- messages:
5
- invalid_transition: "cannot transition"