state_machines-activerecord 0.8.0 → 0.100.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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +20 -7
  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 +88 -175
  7. data/lib/state_machines-activerecord.rb +2 -0
  8. metadata +36 -154
  9. data/.gitignore +0 -22
  10. data/.travis.yml +0 -19
  11. data/Appraisals +0 -34
  12. data/Gemfile +0 -6
  13. data/Rakefile +0 -9
  14. data/gemfiles/active_record_5.1.gemfile +0 -14
  15. data/gemfiles/active_record_5.2.gemfile +0 -14
  16. data/gemfiles/active_record_6.0.gemfile +0 -14
  17. data/gemfiles/active_record_6.1.gemfile +0 -14
  18. data/gemfiles/active_record_edge.gemfile +0 -14
  19. data/log/.gitkeep +0 -0
  20. data/state_machines-activerecord.gemspec +0 -28
  21. data/test/files/en.yml +0 -5
  22. data/test/files/models/post.rb +0 -11
  23. data/test/integration_test.rb +0 -25
  24. data/test/machine_by_default_test.rb +0 -16
  25. data/test/machine_errors_test.rb +0 -19
  26. data/test/machine_multiple_test.rb +0 -17
  27. data/test/machine_nested_action_test.rb +0 -38
  28. data/test/machine_unmigrated_test.rb +0 -14
  29. data/test/machine_with_aliased_attribute_test.rb +0 -23
  30. data/test/machine_with_callbacks_test.rb +0 -172
  31. data/test/machine_with_column_state_attribute_test.rb +0 -44
  32. data/test/machine_with_complex_pluralization_scopes_test.rb +0 -16
  33. data/test/machine_with_conflicting_predicate_test.rb +0 -18
  34. data/test/machine_with_conflicting_state_name_test.rb +0 -29
  35. data/test/machine_with_custom_attribute_test.rb +0 -21
  36. data/test/machine_with_default_scope_test.rb +0 -18
  37. data/test/machine_with_different_column_default_test.rb +0 -27
  38. data/test/machine_with_different_integer_column_default_test.rb +0 -29
  39. data/test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb +0 -24
  40. data/test/machine_with_dirty_attribute_and_state_events_test.rb +0 -20
  41. data/test/machine_with_dirty_attributes_and_custom_attribute_test.rb +0 -32
  42. data/test/machine_with_dirty_attributes_during_loopback_test.rb +0 -22
  43. data/test/machine_with_dirty_attributes_test.rb +0 -35
  44. data/test/machine_with_dynamic_initial_state_test.rb +0 -99
  45. data/test/machine_with_event_attributes_on_autosave_test.rb +0 -48
  46. data/test/machine_with_event_attributes_on_custom_action_test.rb +0 -41
  47. data/test/machine_with_event_attributes_on_save_bang_test.rb +0 -82
  48. data/test/machine_with_event_attributes_on_save_test.rb +0 -244
  49. data/test/machine_with_event_attributes_on_validation_test.rb +0 -143
  50. data/test/machine_with_events_test.rb +0 -13
  51. data/test/machine_with_failed_action_test.rb +0 -40
  52. data/test/machine_with_failed_after_callbacks_test.rb +0 -35
  53. data/test/machine_with_failed_before_callbacks_test.rb +0 -36
  54. data/test/machine_with_initialized_state_test.rb +0 -41
  55. data/test/machine_with_internationalization_test.rb +0 -180
  56. data/test/machine_with_loopback_test.rb +0 -22
  57. data/test/machine_with_non_column_state_attribute_defined_test.rb +0 -29
  58. data/test/machine_with_same_column_default_test.rb +0 -26
  59. data/test/machine_with_same_integer_column_default_test.rb +0 -30
  60. data/test/machine_with_scopes_and_joins_test.rb +0 -37
  61. data/test/machine_with_scopes_and_owner_subclass_test.rb +0 -27
  62. data/test/machine_with_scopes_test.rb +0 -70
  63. data/test/machine_with_state_driven_validations_test.rb +0 -30
  64. data/test/machine_with_states_test.rb +0 -13
  65. data/test/machine_with_static_initial_state_test.rb +0 -166
  66. data/test/machine_with_transactions_test.rb +0 -26
  67. data/test/machine_with_validations_and_custom_attribute_test.rb +0 -21
  68. data/test/machine_with_validations_test.rb +0 -47
  69. data/test/machine_without_database_test.rb +0 -20
  70. data/test/machine_without_transactions_test.rb +0 -26
  71. data/test/model_test.rb +0 -12
  72. data/test/test_helper.rb +0 -52
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.8.0
4
+ version: 0.100.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: 2020-12-31 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.8.0
19
+ version: '7.2'
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.8.0
26
+ version: '7.2'
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: '5.1'
33
+ version: 0.100.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: '5.1'
40
+ version: 0.100.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
@@ -117,81 +116,17 @@ executables: []
117
116
  extensions: []
118
117
  extra_rdoc_files: []
119
118
  files:
120
- - ".gitignore"
121
- - ".travis.yml"
122
- - Appraisals
123
- - Gemfile
124
119
  - LICENSE.txt
125
120
  - README.md
126
- - Rakefile
127
- - gemfiles/active_record_5.1.gemfile
128
- - gemfiles/active_record_5.2.gemfile
129
- - gemfiles/active_record_6.0.gemfile
130
- - gemfiles/active_record_6.1.gemfile
131
- - gemfiles/active_record_edge.gemfile
132
121
  - lib/state_machines-activerecord.rb
133
122
  - lib/state_machines/integrations/active_record.rb
134
123
  - lib/state_machines/integrations/active_record/locale.rb
135
124
  - lib/state_machines/integrations/active_record/version.rb
136
- - log/.gitkeep
137
- - state_machines-activerecord.gemspec
138
- - test/files/en.yml
139
- - test/files/models/post.rb
140
- - test/integration_test.rb
141
- - test/machine_by_default_test.rb
142
- - test/machine_errors_test.rb
143
- - test/machine_multiple_test.rb
144
- - test/machine_nested_action_test.rb
145
- - test/machine_unmigrated_test.rb
146
- - test/machine_with_aliased_attribute_test.rb
147
- - test/machine_with_callbacks_test.rb
148
- - test/machine_with_column_state_attribute_test.rb
149
- - test/machine_with_complex_pluralization_scopes_test.rb
150
- - test/machine_with_conflicting_predicate_test.rb
151
- - test/machine_with_conflicting_state_name_test.rb
152
- - test/machine_with_custom_attribute_test.rb
153
- - test/machine_with_default_scope_test.rb
154
- - test/machine_with_different_column_default_test.rb
155
- - test/machine_with_different_integer_column_default_test.rb
156
- - test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
157
- - test/machine_with_dirty_attribute_and_state_events_test.rb
158
- - test/machine_with_dirty_attributes_and_custom_attribute_test.rb
159
- - test/machine_with_dirty_attributes_during_loopback_test.rb
160
- - test/machine_with_dirty_attributes_test.rb
161
- - test/machine_with_dynamic_initial_state_test.rb
162
- - test/machine_with_event_attributes_on_autosave_test.rb
163
- - test/machine_with_event_attributes_on_custom_action_test.rb
164
- - test/machine_with_event_attributes_on_save_bang_test.rb
165
- - test/machine_with_event_attributes_on_save_test.rb
166
- - test/machine_with_event_attributes_on_validation_test.rb
167
- - test/machine_with_events_test.rb
168
- - test/machine_with_failed_action_test.rb
169
- - test/machine_with_failed_after_callbacks_test.rb
170
- - test/machine_with_failed_before_callbacks_test.rb
171
- - test/machine_with_initialized_state_test.rb
172
- - test/machine_with_internationalization_test.rb
173
- - test/machine_with_loopback_test.rb
174
- - test/machine_with_non_column_state_attribute_defined_test.rb
175
- - test/machine_with_same_column_default_test.rb
176
- - test/machine_with_same_integer_column_default_test.rb
177
- - test/machine_with_scopes_and_joins_test.rb
178
- - test/machine_with_scopes_and_owner_subclass_test.rb
179
- - test/machine_with_scopes_test.rb
180
- - test/machine_with_state_driven_validations_test.rb
181
- - test/machine_with_states_test.rb
182
- - test/machine_with_static_initial_state_test.rb
183
- - test/machine_with_transactions_test.rb
184
- - test/machine_with_validations_and_custom_attribute_test.rb
185
- - test/machine_with_validations_test.rb
186
- - test/machine_without_database_test.rb
187
- - test/machine_without_transactions_test.rb
188
- - test/model_test.rb
189
- - test/test_helper.rb
190
125
  homepage: https://github.com/state-machines/state_machines-activerecord/
191
126
  licenses:
192
127
  - MIT
193
- metadata: {}
194
- post_install_message:
128
+ metadata:
129
+ rubygems_mfa_required: 'true'
195
130
  rdoc_options: []
196
131
  require_paths:
197
132
  - lib
@@ -199,67 +134,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
199
134
  requirements:
200
135
  - - ">="
201
136
  - !ruby/object:Gem::Version
202
- version: 2.2.2
137
+ version: '3.2'
203
138
  required_rubygems_version: !ruby/object:Gem::Requirement
204
139
  requirements:
205
140
  - - ">="
206
141
  - !ruby/object:Gem::Version
207
142
  version: '0'
208
143
  requirements: []
209
- rubygems_version: 3.0.3
210
- signing_key:
144
+ rubygems_version: 3.6.9
211
145
  specification_version: 4
212
146
  summary: State machines Active Record Integration
213
- test_files:
214
- - test/files/en.yml
215
- - test/files/models/post.rb
216
- - test/integration_test.rb
217
- - test/machine_by_default_test.rb
218
- - test/machine_errors_test.rb
219
- - test/machine_multiple_test.rb
220
- - test/machine_nested_action_test.rb
221
- - test/machine_unmigrated_test.rb
222
- - test/machine_with_aliased_attribute_test.rb
223
- - test/machine_with_callbacks_test.rb
224
- - test/machine_with_column_state_attribute_test.rb
225
- - test/machine_with_complex_pluralization_scopes_test.rb
226
- - test/machine_with_conflicting_predicate_test.rb
227
- - test/machine_with_conflicting_state_name_test.rb
228
- - test/machine_with_custom_attribute_test.rb
229
- - test/machine_with_default_scope_test.rb
230
- - test/machine_with_different_column_default_test.rb
231
- - test/machine_with_different_integer_column_default_test.rb
232
- - test/machine_with_dirty_attribute_and_custom_attributes_during_loopback_test.rb
233
- - test/machine_with_dirty_attribute_and_state_events_test.rb
234
- - test/machine_with_dirty_attributes_and_custom_attribute_test.rb
235
- - test/machine_with_dirty_attributes_during_loopback_test.rb
236
- - test/machine_with_dirty_attributes_test.rb
237
- - test/machine_with_dynamic_initial_state_test.rb
238
- - test/machine_with_event_attributes_on_autosave_test.rb
239
- - test/machine_with_event_attributes_on_custom_action_test.rb
240
- - test/machine_with_event_attributes_on_save_bang_test.rb
241
- - test/machine_with_event_attributes_on_save_test.rb
242
- - test/machine_with_event_attributes_on_validation_test.rb
243
- - test/machine_with_events_test.rb
244
- - test/machine_with_failed_action_test.rb
245
- - test/machine_with_failed_after_callbacks_test.rb
246
- - test/machine_with_failed_before_callbacks_test.rb
247
- - test/machine_with_initialized_state_test.rb
248
- - test/machine_with_internationalization_test.rb
249
- - test/machine_with_loopback_test.rb
250
- - test/machine_with_non_column_state_attribute_defined_test.rb
251
- - test/machine_with_same_column_default_test.rb
252
- - test/machine_with_same_integer_column_default_test.rb
253
- - test/machine_with_scopes_and_joins_test.rb
254
- - test/machine_with_scopes_and_owner_subclass_test.rb
255
- - test/machine_with_scopes_test.rb
256
- - test/machine_with_state_driven_validations_test.rb
257
- - test/machine_with_states_test.rb
258
- - test/machine_with_static_initial_state_test.rb
259
- - test/machine_with_transactions_test.rb
260
- - test/machine_with_validations_and_custom_attribute_test.rb
261
- - test/machine_with_validations_test.rb
262
- - test/machine_without_database_test.rb
263
- - test/machine_without_transactions_test.rb
264
- - test/model_test.rb
265
- - test/test_helper.rb
147
+ test_files: []
data/.gitignore DELETED
@@ -1,22 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- tmp
16
- *.bundle
17
- *.so
18
- *.o
19
- *.a
20
- log/active_record.log
21
- .idea/
22
- *.lock
data/.travis.yml DELETED
@@ -1,19 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
-
4
- rvm:
5
- - 2.5.8
6
- - 2.6.6
7
- - 2.7.2
8
- - jruby
9
-
10
- gemfile:
11
- - gemfiles/active_record_5.1.gemfile
12
- - gemfiles/active_record_5.2.gemfile
13
- - gemfiles/active_record_6.0.gemfile
14
- - gemfiles/active_record_6.1.gemfile
15
- - gemfiles/active_record_edge.gemfile
16
-
17
- matrix:
18
- allow_failures:
19
- - rvm: jruby
data/Appraisals DELETED
@@ -1,34 +0,0 @@
1
- appraise "active_record_5.1" do
2
- gem "sqlite3", platforms: [:mri, :rbx]
3
- gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
4
- gem "activerecord", github: 'rails/rails', branch: '5-1-stable'
5
- gem "activemodel", github: 'rails/rails', branch: '5-1-stable'
6
- end
7
-
8
- appraise "active_record_5.2" do
9
- gem "sqlite3", platforms: [:mri, :rbx]
10
- gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
11
- gem "activerecord", github: 'rails/rails', branch: '5-2-stable'
12
- gem "activemodel", github: 'rails/rails', branch: '5-2-stable'
13
- end
14
-
15
- appraise 'active_record_6.0' do
16
- gem "sqlite3", platforms: [:mri, :rbx]
17
- gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
18
- gem "activerecord", github: 'rails/rails', branch: '6-0-stable'
19
- gem "activemodel", github: 'rails/rails', branch: '6-0-stable'
20
- end
21
-
22
- appraise 'active_record_6.1' do
23
- gem "sqlite3", platforms: [:mri, :rbx]
24
- gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
25
- gem "activerecord", github: 'rails/rails', branch: '6-1-stable'
26
- gem "activemodel", github: 'rails/rails', branch: '6-1-stable'
27
- end
28
-
29
- appraise "active_record_edge" do
30
- gem "sqlite3", platforms: [:mri, :rbx]
31
- gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
32
- gem "activerecord", github: 'rails/rails', branch: 'master'
33
- gem "activemodel", github: 'rails/rails', branch: 'master'
34
- end
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
3
-
4
- platforms :mri do
5
- gem 'pry-byebug'
6
- end
data/Rakefile DELETED
@@ -1,9 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rake/testtask'
3
-
4
- Rake::TestTask.new do |t|
5
- t.pattern = 'test/*_test.rb'
6
- end
7
-
8
- desc 'Default: run all tests.'
9
- task :default => :test
@@ -1,14 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "sqlite3", platforms: [:mri, :rbx]
6
- gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
7
- gem "activerecord", github: "rails/rails", branch: "5-1-stable"
8
- gem "activemodel", github: "rails/rails", branch: "5-1-stable"
9
-
10
- platforms :mri do
11
- gem "pry-byebug"
12
- end
13
-
14
- gemspec path: "../"
@@ -1,14 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "sqlite3", platforms: [:mri, :rbx]
6
- gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
7
- gem "activerecord", github: "rails/rails", branch: "5-2-stable"
8
- gem "activemodel", github: "rails/rails", branch: "5-2-stable"
9
-
10
- platforms :mri do
11
- gem "pry-byebug"
12
- end
13
-
14
- gemspec path: "../"
@@ -1,14 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "sqlite3", platforms: [:mri, :rbx]
6
- gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
7
- gem "activerecord", github: "rails/rails", branch: "6-0-stable"
8
- gem "activemodel", github: "rails/rails", branch: "6-0-stable"
9
-
10
- platforms :mri do
11
- gem "pry-byebug"
12
- end
13
-
14
- gemspec path: "../"
@@ -1,14 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "sqlite3", platforms: [:mri, :rbx]
6
- gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
7
- gem "activerecord", github: "rails/rails", branch: "6-1-stable"
8
- gem "activemodel", github: "rails/rails", branch: "6-1-stable"
9
-
10
- platforms :mri do
11
- gem "pry-byebug"
12
- end
13
-
14
- gemspec path: "../"
@@ -1,14 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "sqlite3", platforms: [:mri, :rbx]
6
- gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
7
- gem "activerecord", github: "rails/rails", branch: "master"
8
- gem "activemodel", github: "rails/rails", branch: "master"
9
-
10
- platforms :mri do
11
- gem "pry-byebug"
12
- end
13
-
14
- gemspec path: "../"
data/log/.gitkeep DELETED
File without changes
@@ -1,28 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'state_machines/integrations/active_record/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'state_machines-activerecord'
8
- spec.version = StateMachines::Integrations::ActiveRecord::VERSION
9
- spec.authors = ['Abdelkader Boudih', 'Aaron Pfeifer']
10
- spec.email = %w(terminale@gmail.com aaron@pluginaweek.org)
11
- spec.summary = %q(State machines Active Record Integration)
12
- spec.description = %q(Adds support for creating state machines for attributes on ActiveRecord)
13
- spec.homepage = 'https://github.com/state-machines/state_machines-activerecord/'
14
- spec.license = 'MIT'
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.test_files = spec.files.grep(/^test\//)
18
- spec.required_ruby_version = '>= 2.2.2'
19
- spec.require_paths = ['lib']
20
-
21
- spec.add_dependency 'state_machines-activemodel', '>= 0.8.0'
22
- spec.add_dependency 'activerecord' , '>= 5.1'
23
- spec.add_development_dependency 'rake', '~> 13.0'
24
- spec.add_development_dependency 'sqlite3', '~> 1.3'
25
- spec.add_development_dependency 'appraisal', '>= 1'
26
- spec.add_development_dependency 'minitest' , '>= 5.4.0'
27
- spec.add_development_dependency 'minitest-reporters'
28
- end
data/test/files/en.yml DELETED
@@ -1,5 +0,0 @@
1
- en:
2
- activerecord:
3
- errors:
4
- messages:
5
- invalid_transition: "cannot transition"
@@ -1,11 +0,0 @@
1
- ActiveRecord::Base.connection.create_table(:posts, :force => true) do |t|
2
- t.string :title
3
- t.string :content
4
- t.string :state
5
- end
6
-
7
- class Post < ActiveRecord::Base
8
- state_machine initial: :draft do
9
-
10
- end
11
- end
@@ -1,25 +0,0 @@
1
- require_relative 'test_helper'
2
-
3
- class IntegrationTest < BaseTestCase
4
- def test_should_have_an_integration_name
5
- assert_equal :active_record, StateMachines::Integrations::ActiveRecord.integration_name
6
- end
7
-
8
- def test_should_be_before_activemodel
9
- integrations = StateMachines::Integrations.list.to_a
10
- assert StateMachines::Integrations::ActiveRecord, integrations.first
11
- assert StateMachines::Integrations::ActiveModel, integrations.last
12
- end
13
-
14
- def test_should_match_if_class_inherits_from_active_record
15
- assert StateMachines::Integrations::ActiveRecord.matches?(new_model)
16
- end
17
-
18
- def test_should_not_match_if_class_does_not_inherit_from_active_record
19
- refute StateMachines::Integrations::ActiveRecord.matches?(Class.new)
20
- end
21
-
22
- def test_should_have_defaults
23
- assert_equal({action: :save, use_transactions: true}, StateMachines::Integrations::ActiveRecord.defaults)
24
- end
25
- end
@@ -1,16 +0,0 @@
1
- require_relative 'test_helper'
2
-
3
- class MachineByDefaultTest < BaseTestCase
4
- def setup
5
- @model = new_model
6
- @machine = StateMachines::Machine.new(@model)
7
- end
8
-
9
- def test_should_use_save_as_action
10
- assert_equal :save, @machine.action
11
- end
12
-
13
- def test_should_use_transactions
14
- assert_equal true, @machine.use_transactions
15
- end
16
- end
@@ -1,19 +0,0 @@
1
- require_relative 'test_helper'
2
-
3
- class MachineErrorsTest < BaseTestCase
4
- def setup
5
- @model = new_model
6
- @machine = StateMachines::Machine.new(@model)
7
- @record = @model.new
8
- end
9
-
10
- def test_should_be_able_to_describe_current_errors
11
- @record.errors.add(:id, 'cannot be blank')
12
- @record.errors.add(:state, 'is invalid')
13
- assert_equal ['Id cannot be blank', 'State is invalid'], @machine.errors_for(@record).split(', ').sort
14
- end
15
-
16
- def test_should_describe_as_halted_with_no_errors
17
- assert_equal 'Transition halted', @machine.errors_for(@record)
18
- end
19
- end
@@ -1,17 +0,0 @@
1
- require_relative 'test_helper'
2
-
3
- class MachineMultipleTest < BaseTestCase
4
- def setup
5
- @model = new_model do
6
- connection.add_column table_name, :status, :string
7
- end
8
- @state_machine = StateMachines::Machine.new(@model, :initial => :parked)
9
- @status_machine = StateMachines::Machine.new(@model, :status, :initial => :idling)
10
- end
11
-
12
- def test_should_should_initialize_each_state
13
- record = @model.new
14
- assert_equal 'parked', record.state
15
- assert_equal 'idling', record.status
16
- end
17
- end
@@ -1,38 +0,0 @@
1
- require_relative 'test_helper'
2
-
3
- class MachineNestedActionTest < BaseTestCase
4
- def setup
5
- @callbacks = []
6
-
7
- @model = new_model
8
- @machine = StateMachines::Machine.new(@model)
9
- @machine.event :ignite do
10
- transition :parked => :idling
11
- end
12
-
13
- @record = @model.new(:state => 'parked')
14
- end
15
-
16
- def test_should_allow_transition_prior_to_creation_if_skipping_action
17
- record = @record
18
- @model.before_create { record.ignite(false) }
19
- result = @record.save
20
-
21
- assert_equal true, result
22
- assert_equal "idling", @record.state
23
- @record.reload
24
- assert_equal "idling", @record.state
25
- end
26
-
27
- def test_should_allow_transition_after_creation
28
- record = @record
29
- @model.after_create { record.ignite }
30
- result = @record.save
31
-
32
- assert_equal true, result
33
- assert_equal "idling", @record.state
34
- @record.reload
35
- assert_equal "idling", @record.state
36
- end
37
- end
38
-
@@ -1,14 +0,0 @@
1
- require_relative 'test_helper'
2
-
3
- class MachineUnmigratedTest < BaseTestCase
4
- def setup
5
- @model = new_model(false)
6
-
7
- # Drop the table so that it definitely doesn't exist
8
- @model.connection.drop_table(@model.table_name) if @model.table_exists?
9
- end
10
-
11
- def test_should_allow_machine_creation
12
- assert_nothing_raised { StateMachines::Machine.new(@model) }
13
- end
14
- end