granite-form 0.1.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -2
  3. data/.github/workflows/{ci.yml → ruby.yml} +22 -4
  4. data/.rubocop.yml +1 -1
  5. data/.rubocop_todo.yml +3 -3
  6. data/Appraisals +1 -2
  7. data/CHANGELOG.md +14 -0
  8. data/README.md +0 -2
  9. data/Rakefile +4 -0
  10. data/docker-compose.yml +14 -0
  11. data/gemfiles/rails.5.0.gemfile +0 -1
  12. data/gemfiles/rails.5.1.gemfile +0 -1
  13. data/gemfiles/rails.5.2.gemfile +0 -1
  14. data/granite-form.gemspec +16 -15
  15. data/lib/granite/form/active_record/associations.rb +1 -1
  16. data/lib/granite/form/base.rb +1 -2
  17. data/lib/granite/form/config.rb +10 -10
  18. data/lib/granite/form/errors.rb +0 -15
  19. data/lib/granite/form/model/associations/base.rb +0 -4
  20. data/lib/granite/form/model/associations/collection/embedded.rb +2 -1
  21. data/lib/granite/form/model/associations/collection/proxy.rb +1 -1
  22. data/lib/granite/form/model/associations/embeds_any.rb +7 -0
  23. data/lib/granite/form/model/associations/embeds_many.rb +9 -58
  24. data/lib/granite/form/model/associations/embeds_one.rb +7 -36
  25. data/lib/granite/form/model/associations/nested_attributes.rb +8 -8
  26. data/lib/granite/form/model/associations/persistence_adapters/active_record.rb +0 -4
  27. data/lib/granite/form/model/associations/persistence_adapters/base.rb +0 -4
  28. data/lib/granite/form/model/associations/references_many.rb +0 -32
  29. data/lib/granite/form/model/associations/references_one.rb +0 -28
  30. data/lib/granite/form/model/associations/reflections/embeds_any.rb +1 -1
  31. data/lib/granite/form/model/associations/reflections/references_any.rb +0 -4
  32. data/lib/granite/form/model/associations/reflections/references_many.rb +3 -1
  33. data/lib/granite/form/model/associations/reflections/references_one.rb +3 -3
  34. data/lib/granite/form/model/associations/reflections/singular.rb +0 -8
  35. data/lib/granite/form/model/associations.rb +0 -6
  36. data/lib/granite/form/model/attributes/attribute.rb +1 -1
  37. data/lib/granite/form/model/attributes/base.rb +14 -17
  38. data/lib/granite/form/model/attributes/collection.rb +1 -1
  39. data/lib/granite/form/model/attributes/dictionary.rb +1 -1
  40. data/lib/granite/form/model/attributes/localized.rb +1 -1
  41. data/lib/granite/form/model/attributes/reference_many.rb +1 -1
  42. data/lib/granite/form/model/attributes/reference_one.rb +1 -9
  43. data/lib/granite/form/model/attributes/reflections/attribute.rb +0 -6
  44. data/lib/granite/form/model/attributes/reflections/base.rb +9 -12
  45. data/lib/granite/form/model/attributes/reflections/reference_one.rb +0 -10
  46. data/lib/granite/form/model/persistence.rb +1 -19
  47. data/lib/granite/form/model/validations/nested.rb +1 -1
  48. data/lib/granite/form/model.rb +0 -2
  49. data/lib/granite/form/types/active_support/time_zone.rb +22 -0
  50. data/lib/granite/form/types/array.rb +17 -0
  51. data/lib/granite/form/types/big_decimal.rb +15 -0
  52. data/lib/granite/form/types/boolean.rb +38 -0
  53. data/lib/granite/form/types/date.rb +15 -0
  54. data/lib/granite/form/types/date_time.rb +15 -0
  55. data/lib/granite/form/types/float.rb +15 -0
  56. data/lib/granite/form/types/hash_with_action_controller_parameters.rb +18 -0
  57. data/lib/granite/form/types/integer.rb +13 -0
  58. data/lib/granite/form/types/object.rb +30 -0
  59. data/lib/granite/form/types/string.rb +13 -0
  60. data/lib/granite/form/types/time.rb +15 -0
  61. data/lib/granite/form/types/uuid.rb +22 -0
  62. data/lib/granite/form/types.rb +15 -0
  63. data/lib/granite/form/version.rb +1 -1
  64. data/lib/granite/form.rb +19 -118
  65. data/spec/{lib/granite → granite}/form/active_record/associations_spec.rb +16 -18
  66. data/spec/{lib/granite → granite}/form/active_record/nested_attributes_spec.rb +0 -1
  67. data/spec/{lib/granite → granite}/form/config_spec.rb +22 -10
  68. data/spec/granite/form/extensions_spec.rb +12 -0
  69. data/spec/{lib/granite → granite}/form/model/associations/embeds_many_spec.rb +29 -305
  70. data/spec/{lib/granite → granite}/form/model/associations/embeds_one_spec.rb +27 -212
  71. data/spec/granite/form/model/associations/nested_attributes_spec.rb +23 -0
  72. data/spec/{lib/granite → granite}/form/model/associations/persistence_adapters/active_record_spec.rb +0 -0
  73. data/spec/granite/form/model/associations/references_many_spec.rb +251 -0
  74. data/spec/granite/form/model/associations/references_one_spec.rb +173 -0
  75. data/spec/{lib/granite → granite}/form/model/associations/reflections/embeds_any_spec.rb +1 -2
  76. data/spec/{lib/granite → granite}/form/model/associations/reflections/embeds_many_spec.rb +18 -26
  77. data/spec/{lib/granite → granite}/form/model/associations/reflections/embeds_one_spec.rb +16 -23
  78. data/spec/{lib/granite → granite}/form/model/associations/reflections/references_many_spec.rb +1 -1
  79. data/spec/{lib/granite → granite}/form/model/associations/reflections/references_one_spec.rb +1 -22
  80. data/spec/{lib/granite → granite}/form/model/associations/validations_spec.rb +0 -3
  81. data/spec/{lib/granite → granite}/form/model/associations_spec.rb +3 -24
  82. data/spec/{lib/granite → granite}/form/model/attributes/attribute_spec.rb +4 -46
  83. data/spec/{lib/granite → granite}/form/model/attributes/base_spec.rb +11 -2
  84. data/spec/{lib/granite → granite}/form/model/attributes/collection_spec.rb +0 -0
  85. data/spec/{lib/granite → granite}/form/model/attributes/dictionary_spec.rb +0 -0
  86. data/spec/{lib/granite → granite}/form/model/attributes/localized_spec.rb +1 -1
  87. data/spec/{lib/granite → granite}/form/model/attributes/reflections/attribute_spec.rb +0 -12
  88. data/spec/{lib/granite → granite}/form/model/attributes/reflections/base_spec.rb +1 -1
  89. data/spec/{lib/granite → granite}/form/model/attributes/reflections/collection_spec.rb +0 -0
  90. data/spec/{lib/granite → granite}/form/model/attributes/reflections/dictionary_spec.rb +0 -0
  91. data/spec/{lib/granite → granite}/form/model/attributes/reflections/localized_spec.rb +0 -0
  92. data/spec/{lib/granite → granite}/form/model/attributes/reflections/represents_spec.rb +0 -0
  93. data/spec/{lib/granite → granite}/form/model/attributes/represents_spec.rb +0 -0
  94. data/spec/{lib/granite → granite}/form/model/attributes_spec.rb +0 -0
  95. data/spec/{lib/granite → granite}/form/model/conventions_spec.rb +0 -0
  96. data/spec/{lib/granite → granite}/form/model/dirty_spec.rb +1 -1
  97. data/spec/{lib/granite → granite}/form/model/persistence_spec.rb +0 -2
  98. data/spec/{lib/granite → granite}/form/model/primary_spec.rb +1 -1
  99. data/spec/{lib/granite → granite}/form/model/representation_spec.rb +0 -0
  100. data/spec/{lib/granite → granite}/form/model/scopes_spec.rb +0 -0
  101. data/spec/{lib/granite → granite}/form/model/validations/associated_spec.rb +2 -4
  102. data/spec/{lib/granite → granite}/form/model/validations/nested_spec.rb +57 -15
  103. data/spec/{lib/granite → granite}/form/model/validations_spec.rb +0 -0
  104. data/spec/{lib/granite → granite}/form/model_spec.rb +0 -0
  105. data/spec/granite/form/types/active_support/time_zone_spec.rb +24 -0
  106. data/spec/granite/form/types/array_spec.rb +13 -0
  107. data/spec/granite/form/types/big_decimal_spec.rb +19 -0
  108. data/spec/granite/form/types/boolean_spec.rb +21 -0
  109. data/spec/granite/form/types/date_spec.rb +18 -0
  110. data/spec/granite/form/types/date_time_spec.rb +20 -0
  111. data/spec/granite/form/types/float_spec.rb +19 -0
  112. data/spec/granite/form/types/hash_with_action_controller_parameters_spec.rb +22 -0
  113. data/spec/granite/form/types/integer_spec.rb +18 -0
  114. data/spec/granite/form/types/object_spec.rb +40 -0
  115. data/spec/granite/form/types/string_spec.rb +13 -0
  116. data/spec/granite/form/types/time_spec.rb +31 -0
  117. data/spec/granite/form/types/uuid_spec.rb +21 -0
  118. data/spec/{lib/granite → granite}/form_spec.rb +0 -0
  119. data/spec/spec_helper.rb +0 -15
  120. data/spec/support/active_record.rb +20 -0
  121. data/spec/{shared → support/shared}/nested_attribute_examples.rb +3 -21
  122. data/spec/support/shared/type_examples.rb +7 -0
  123. metadata +173 -123
  124. data/.github/workflows/main.yml +0 -29
  125. data/gemfiles/rails.4.2.gemfile +0 -15
  126. data/lib/granite/form/model/callbacks.rb +0 -72
  127. data/lib/granite/form/model/lifecycle.rb +0 -309
  128. data/spec/lib/granite/form/model/associations/nested_attributes_spec.rb +0 -119
  129. data/spec/lib/granite/form/model/associations/references_many_spec.rb +0 -572
  130. data/spec/lib/granite/form/model/associations/references_one_spec.rb +0 -445
  131. data/spec/lib/granite/form/model/callbacks_spec.rb +0 -337
  132. data/spec/lib/granite/form/model/lifecycle_spec.rb +0 -356
  133. data/spec/lib/granite/form/model/typecasting_spec.rb +0 -193
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: granite-form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - pyromaniac
7
+ - Toptal Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-28 00:00:00.000000000 Z
11
+ date: 2022-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: '5.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4.0'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '4.0'
33
+ version: '5.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '4.0'
40
+ version: '5.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: appraisal
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: database_cleaner
56
+ name: bump
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
70
+ name: database_cleaner
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,21 +81,21 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rspec
84
+ name: pg
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 3.7.0
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 3.7.0
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rspec-its
98
+ name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,21 +109,21 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rubocop
112
+ name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '='
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.52.1
117
+ version: 3.7.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '='
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.52.1
124
+ version: 3.7.0
125
125
  - !ruby/object:Gem::Dependency
126
- name: sqlite3
126
+ name: rspec-its
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '='
144
+ - !ruby/object:Gem::Version
145
+ version: 0.52.1
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '='
151
+ - !ruby/object:Gem::Version
152
+ version: 0.52.1
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: uuidtools
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -156,28 +170,28 @@ dependencies:
156
170
  requirements:
157
171
  - - ">="
158
172
  - !ruby/object:Gem::Version
159
- version: '4.0'
173
+ version: '5.0'
160
174
  type: :runtime
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
178
  - - ">="
165
179
  - !ruby/object:Gem::Version
166
- version: '4.0'
180
+ version: '5.0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: activesupport
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - ">="
172
186
  - !ruby/object:Gem::Version
173
- version: '4.0'
187
+ version: '5.0'
174
188
  type: :runtime
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
192
  - - ">="
179
193
  - !ruby/object:Gem::Version
180
- version: '4.0'
194
+ version: '5.0'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: tzinfo
183
197
  requirement: !ruby/object:Gem::Requirement
@@ -193,16 +207,14 @@ dependencies:
193
207
  - !ruby/object:Gem::Version
194
208
  version: '0'
195
209
  description: Making object from any hash or hash array
196
- email:
197
- - kinwizard@gmail.com
210
+ email:
198
211
  executables: []
199
212
  extensions: []
200
213
  extra_rdoc_files: []
201
214
  files:
202
215
  - ".codeclimate.yml"
203
216
  - ".github/CODEOWNERS"
204
- - ".github/workflows/ci.yml"
205
- - ".github/workflows/main.yml"
217
+ - ".github/workflows/ruby.yml"
206
218
  - ".gitignore"
207
219
  - ".rspec"
208
220
  - ".rubocop.yml"
@@ -214,7 +226,7 @@ files:
214
226
  - LICENSE
215
227
  - README.md
216
228
  - Rakefile
217
- - gemfiles/rails.4.2.gemfile
229
+ - docker-compose.yml
218
230
  - gemfiles/rails.5.0.gemfile
219
231
  - gemfiles/rails.5.1.gemfile
220
232
  - gemfiles/rails.5.2.gemfile
@@ -270,10 +282,8 @@ files:
270
282
  - lib/granite/form/model/attributes/reflections/reference_one.rb
271
283
  - lib/granite/form/model/attributes/reflections/represents.rb
272
284
  - lib/granite/form/model/attributes/represents.rb
273
- - lib/granite/form/model/callbacks.rb
274
285
  - lib/granite/form/model/conventions.rb
275
286
  - lib/granite/form/model/dirty.rb
276
- - lib/granite/form/model/lifecycle.rb
277
287
  - lib/granite/form/model/localization.rb
278
288
  - lib/granite/form/model/persistence.rb
279
289
  - lib/granite/form/model/primary.rb
@@ -283,57 +293,84 @@ files:
283
293
  - lib/granite/form/model/validations/associated.rb
284
294
  - lib/granite/form/model/validations/nested.rb
285
295
  - lib/granite/form/railtie.rb
296
+ - lib/granite/form/types.rb
297
+ - lib/granite/form/types/active_support/time_zone.rb
298
+ - lib/granite/form/types/array.rb
299
+ - lib/granite/form/types/big_decimal.rb
300
+ - lib/granite/form/types/boolean.rb
301
+ - lib/granite/form/types/date.rb
302
+ - lib/granite/form/types/date_time.rb
303
+ - lib/granite/form/types/float.rb
304
+ - lib/granite/form/types/hash_with_action_controller_parameters.rb
305
+ - lib/granite/form/types/integer.rb
306
+ - lib/granite/form/types/object.rb
307
+ - lib/granite/form/types/string.rb
308
+ - lib/granite/form/types/time.rb
309
+ - lib/granite/form/types/uuid.rb
286
310
  - lib/granite/form/undefined_class.rb
287
311
  - lib/granite/form/version.rb
288
- - spec/lib/granite/form/active_record/associations_spec.rb
289
- - spec/lib/granite/form/active_record/nested_attributes_spec.rb
290
- - spec/lib/granite/form/config_spec.rb
291
- - spec/lib/granite/form/model/associations/embeds_many_spec.rb
292
- - spec/lib/granite/form/model/associations/embeds_one_spec.rb
293
- - spec/lib/granite/form/model/associations/nested_attributes_spec.rb
294
- - spec/lib/granite/form/model/associations/persistence_adapters/active_record_spec.rb
295
- - spec/lib/granite/form/model/associations/references_many_spec.rb
296
- - spec/lib/granite/form/model/associations/references_one_spec.rb
297
- - spec/lib/granite/form/model/associations/reflections/embeds_any_spec.rb
298
- - spec/lib/granite/form/model/associations/reflections/embeds_many_spec.rb
299
- - spec/lib/granite/form/model/associations/reflections/embeds_one_spec.rb
300
- - spec/lib/granite/form/model/associations/reflections/references_many_spec.rb
301
- - spec/lib/granite/form/model/associations/reflections/references_one_spec.rb
302
- - spec/lib/granite/form/model/associations/validations_spec.rb
303
- - spec/lib/granite/form/model/associations_spec.rb
304
- - spec/lib/granite/form/model/attributes/attribute_spec.rb
305
- - spec/lib/granite/form/model/attributes/base_spec.rb
306
- - spec/lib/granite/form/model/attributes/collection_spec.rb
307
- - spec/lib/granite/form/model/attributes/dictionary_spec.rb
308
- - spec/lib/granite/form/model/attributes/localized_spec.rb
309
- - spec/lib/granite/form/model/attributes/reflections/attribute_spec.rb
310
- - spec/lib/granite/form/model/attributes/reflections/base_spec.rb
311
- - spec/lib/granite/form/model/attributes/reflections/collection_spec.rb
312
- - spec/lib/granite/form/model/attributes/reflections/dictionary_spec.rb
313
- - spec/lib/granite/form/model/attributes/reflections/localized_spec.rb
314
- - spec/lib/granite/form/model/attributes/reflections/represents_spec.rb
315
- - spec/lib/granite/form/model/attributes/represents_spec.rb
316
- - spec/lib/granite/form/model/attributes_spec.rb
317
- - spec/lib/granite/form/model/callbacks_spec.rb
318
- - spec/lib/granite/form/model/conventions_spec.rb
319
- - spec/lib/granite/form/model/dirty_spec.rb
320
- - spec/lib/granite/form/model/lifecycle_spec.rb
321
- - spec/lib/granite/form/model/persistence_spec.rb
322
- - spec/lib/granite/form/model/primary_spec.rb
323
- - spec/lib/granite/form/model/representation_spec.rb
324
- - spec/lib/granite/form/model/scopes_spec.rb
325
- - spec/lib/granite/form/model/typecasting_spec.rb
326
- - spec/lib/granite/form/model/validations/associated_spec.rb
327
- - spec/lib/granite/form/model/validations/nested_spec.rb
328
- - spec/lib/granite/form/model/validations_spec.rb
329
- - spec/lib/granite/form/model_spec.rb
330
- - spec/lib/granite/form_spec.rb
331
- - spec/shared/nested_attribute_examples.rb
312
+ - spec/granite/form/active_record/associations_spec.rb
313
+ - spec/granite/form/active_record/nested_attributes_spec.rb
314
+ - spec/granite/form/config_spec.rb
315
+ - spec/granite/form/extensions_spec.rb
316
+ - spec/granite/form/model/associations/embeds_many_spec.rb
317
+ - spec/granite/form/model/associations/embeds_one_spec.rb
318
+ - spec/granite/form/model/associations/nested_attributes_spec.rb
319
+ - spec/granite/form/model/associations/persistence_adapters/active_record_spec.rb
320
+ - spec/granite/form/model/associations/references_many_spec.rb
321
+ - spec/granite/form/model/associations/references_one_spec.rb
322
+ - spec/granite/form/model/associations/reflections/embeds_any_spec.rb
323
+ - spec/granite/form/model/associations/reflections/embeds_many_spec.rb
324
+ - spec/granite/form/model/associations/reflections/embeds_one_spec.rb
325
+ - spec/granite/form/model/associations/reflections/references_many_spec.rb
326
+ - spec/granite/form/model/associations/reflections/references_one_spec.rb
327
+ - spec/granite/form/model/associations/validations_spec.rb
328
+ - spec/granite/form/model/associations_spec.rb
329
+ - spec/granite/form/model/attributes/attribute_spec.rb
330
+ - spec/granite/form/model/attributes/base_spec.rb
331
+ - spec/granite/form/model/attributes/collection_spec.rb
332
+ - spec/granite/form/model/attributes/dictionary_spec.rb
333
+ - spec/granite/form/model/attributes/localized_spec.rb
334
+ - spec/granite/form/model/attributes/reflections/attribute_spec.rb
335
+ - spec/granite/form/model/attributes/reflections/base_spec.rb
336
+ - spec/granite/form/model/attributes/reflections/collection_spec.rb
337
+ - spec/granite/form/model/attributes/reflections/dictionary_spec.rb
338
+ - spec/granite/form/model/attributes/reflections/localized_spec.rb
339
+ - spec/granite/form/model/attributes/reflections/represents_spec.rb
340
+ - spec/granite/form/model/attributes/represents_spec.rb
341
+ - spec/granite/form/model/attributes_spec.rb
342
+ - spec/granite/form/model/conventions_spec.rb
343
+ - spec/granite/form/model/dirty_spec.rb
344
+ - spec/granite/form/model/persistence_spec.rb
345
+ - spec/granite/form/model/primary_spec.rb
346
+ - spec/granite/form/model/representation_spec.rb
347
+ - spec/granite/form/model/scopes_spec.rb
348
+ - spec/granite/form/model/validations/associated_spec.rb
349
+ - spec/granite/form/model/validations/nested_spec.rb
350
+ - spec/granite/form/model/validations_spec.rb
351
+ - spec/granite/form/model_spec.rb
352
+ - spec/granite/form/types/active_support/time_zone_spec.rb
353
+ - spec/granite/form/types/array_spec.rb
354
+ - spec/granite/form/types/big_decimal_spec.rb
355
+ - spec/granite/form/types/boolean_spec.rb
356
+ - spec/granite/form/types/date_spec.rb
357
+ - spec/granite/form/types/date_time_spec.rb
358
+ - spec/granite/form/types/float_spec.rb
359
+ - spec/granite/form/types/hash_with_action_controller_parameters_spec.rb
360
+ - spec/granite/form/types/integer_spec.rb
361
+ - spec/granite/form/types/object_spec.rb
362
+ - spec/granite/form/types/string_spec.rb
363
+ - spec/granite/form/types/time_spec.rb
364
+ - spec/granite/form/types/uuid_spec.rb
365
+ - spec/granite/form_spec.rb
332
366
  - spec/spec_helper.rb
367
+ - spec/support/active_record.rb
333
368
  - spec/support/model_helpers.rb
334
369
  - spec/support/muffle_helper.rb
370
+ - spec/support/shared/nested_attribute_examples.rb
371
+ - spec/support/shared/type_examples.rb
335
372
  - spec/support/translations.rb
336
- homepage: ''
373
+ homepage: https://github.com/toptal/granite-form
337
374
  licenses: []
338
375
  metadata: {}
339
376
  post_install_message:
@@ -344,63 +381,76 @@ required_ruby_version: !ruby/object:Gem::Requirement
344
381
  requirements:
345
382
  - - ">="
346
383
  - !ruby/object:Gem::Version
347
- version: '0'
384
+ version: 2.4.0
348
385
  required_rubygems_version: !ruby/object:Gem::Requirement
349
386
  requirements:
350
387
  - - ">="
351
388
  - !ruby/object:Gem::Version
352
389
  version: '0'
353
390
  requirements: []
354
- rubygems_version: 3.2.33
391
+ rubygems_version: 3.3.26
355
392
  signing_key:
356
393
  specification_version: 4
357
394
  summary: Working with hashes in AR style
358
395
  test_files:
359
- - spec/lib/granite/form/active_record/associations_spec.rb
360
- - spec/lib/granite/form/active_record/nested_attributes_spec.rb
361
- - spec/lib/granite/form/config_spec.rb
362
- - spec/lib/granite/form/model/associations/embeds_many_spec.rb
363
- - spec/lib/granite/form/model/associations/embeds_one_spec.rb
364
- - spec/lib/granite/form/model/associations/nested_attributes_spec.rb
365
- - spec/lib/granite/form/model/associations/persistence_adapters/active_record_spec.rb
366
- - spec/lib/granite/form/model/associations/references_many_spec.rb
367
- - spec/lib/granite/form/model/associations/references_one_spec.rb
368
- - spec/lib/granite/form/model/associations/reflections/embeds_any_spec.rb
369
- - spec/lib/granite/form/model/associations/reflections/embeds_many_spec.rb
370
- - spec/lib/granite/form/model/associations/reflections/embeds_one_spec.rb
371
- - spec/lib/granite/form/model/associations/reflections/references_many_spec.rb
372
- - spec/lib/granite/form/model/associations/reflections/references_one_spec.rb
373
- - spec/lib/granite/form/model/associations/validations_spec.rb
374
- - spec/lib/granite/form/model/associations_spec.rb
375
- - spec/lib/granite/form/model/attributes/attribute_spec.rb
376
- - spec/lib/granite/form/model/attributes/base_spec.rb
377
- - spec/lib/granite/form/model/attributes/collection_spec.rb
378
- - spec/lib/granite/form/model/attributes/dictionary_spec.rb
379
- - spec/lib/granite/form/model/attributes/localized_spec.rb
380
- - spec/lib/granite/form/model/attributes/reflections/attribute_spec.rb
381
- - spec/lib/granite/form/model/attributes/reflections/base_spec.rb
382
- - spec/lib/granite/form/model/attributes/reflections/collection_spec.rb
383
- - spec/lib/granite/form/model/attributes/reflections/dictionary_spec.rb
384
- - spec/lib/granite/form/model/attributes/reflections/localized_spec.rb
385
- - spec/lib/granite/form/model/attributes/reflections/represents_spec.rb
386
- - spec/lib/granite/form/model/attributes/represents_spec.rb
387
- - spec/lib/granite/form/model/attributes_spec.rb
388
- - spec/lib/granite/form/model/callbacks_spec.rb
389
- - spec/lib/granite/form/model/conventions_spec.rb
390
- - spec/lib/granite/form/model/dirty_spec.rb
391
- - spec/lib/granite/form/model/lifecycle_spec.rb
392
- - spec/lib/granite/form/model/persistence_spec.rb
393
- - spec/lib/granite/form/model/primary_spec.rb
394
- - spec/lib/granite/form/model/representation_spec.rb
395
- - spec/lib/granite/form/model/scopes_spec.rb
396
- - spec/lib/granite/form/model/typecasting_spec.rb
397
- - spec/lib/granite/form/model/validations/associated_spec.rb
398
- - spec/lib/granite/form/model/validations/nested_spec.rb
399
- - spec/lib/granite/form/model/validations_spec.rb
400
- - spec/lib/granite/form/model_spec.rb
401
- - spec/lib/granite/form_spec.rb
402
- - spec/shared/nested_attribute_examples.rb
396
+ - spec/granite/form/active_record/associations_spec.rb
397
+ - spec/granite/form/active_record/nested_attributes_spec.rb
398
+ - spec/granite/form/config_spec.rb
399
+ - spec/granite/form/extensions_spec.rb
400
+ - spec/granite/form/model/associations/embeds_many_spec.rb
401
+ - spec/granite/form/model/associations/embeds_one_spec.rb
402
+ - spec/granite/form/model/associations/nested_attributes_spec.rb
403
+ - spec/granite/form/model/associations/persistence_adapters/active_record_spec.rb
404
+ - spec/granite/form/model/associations/references_many_spec.rb
405
+ - spec/granite/form/model/associations/references_one_spec.rb
406
+ - spec/granite/form/model/associations/reflections/embeds_any_spec.rb
407
+ - spec/granite/form/model/associations/reflections/embeds_many_spec.rb
408
+ - spec/granite/form/model/associations/reflections/embeds_one_spec.rb
409
+ - spec/granite/form/model/associations/reflections/references_many_spec.rb
410
+ - spec/granite/form/model/associations/reflections/references_one_spec.rb
411
+ - spec/granite/form/model/associations/validations_spec.rb
412
+ - spec/granite/form/model/associations_spec.rb
413
+ - spec/granite/form/model/attributes/attribute_spec.rb
414
+ - spec/granite/form/model/attributes/base_spec.rb
415
+ - spec/granite/form/model/attributes/collection_spec.rb
416
+ - spec/granite/form/model/attributes/dictionary_spec.rb
417
+ - spec/granite/form/model/attributes/localized_spec.rb
418
+ - spec/granite/form/model/attributes/reflections/attribute_spec.rb
419
+ - spec/granite/form/model/attributes/reflections/base_spec.rb
420
+ - spec/granite/form/model/attributes/reflections/collection_spec.rb
421
+ - spec/granite/form/model/attributes/reflections/dictionary_spec.rb
422
+ - spec/granite/form/model/attributes/reflections/localized_spec.rb
423
+ - spec/granite/form/model/attributes/reflections/represents_spec.rb
424
+ - spec/granite/form/model/attributes/represents_spec.rb
425
+ - spec/granite/form/model/attributes_spec.rb
426
+ - spec/granite/form/model/conventions_spec.rb
427
+ - spec/granite/form/model/dirty_spec.rb
428
+ - spec/granite/form/model/persistence_spec.rb
429
+ - spec/granite/form/model/primary_spec.rb
430
+ - spec/granite/form/model/representation_spec.rb
431
+ - spec/granite/form/model/scopes_spec.rb
432
+ - spec/granite/form/model/validations/associated_spec.rb
433
+ - spec/granite/form/model/validations/nested_spec.rb
434
+ - spec/granite/form/model/validations_spec.rb
435
+ - spec/granite/form/model_spec.rb
436
+ - spec/granite/form/types/active_support/time_zone_spec.rb
437
+ - spec/granite/form/types/array_spec.rb
438
+ - spec/granite/form/types/big_decimal_spec.rb
439
+ - spec/granite/form/types/boolean_spec.rb
440
+ - spec/granite/form/types/date_spec.rb
441
+ - spec/granite/form/types/date_time_spec.rb
442
+ - spec/granite/form/types/float_spec.rb
443
+ - spec/granite/form/types/hash_with_action_controller_parameters_spec.rb
444
+ - spec/granite/form/types/integer_spec.rb
445
+ - spec/granite/form/types/object_spec.rb
446
+ - spec/granite/form/types/string_spec.rb
447
+ - spec/granite/form/types/time_spec.rb
448
+ - spec/granite/form/types/uuid_spec.rb
449
+ - spec/granite/form_spec.rb
403
450
  - spec/spec_helper.rb
451
+ - spec/support/active_record.rb
404
452
  - spec/support/model_helpers.rb
405
453
  - spec/support/muffle_helper.rb
454
+ - spec/support/shared/nested_attribute_examples.rb
455
+ - spec/support/shared/type_examples.rb
406
456
  - spec/support/translations.rb
@@ -1,29 +0,0 @@
1
- name: Ruby
2
-
3
- on: [push]
4
-
5
- jobs:
6
- spec:
7
- runs-on: ubuntu-latest
8
- name: Run specs in ruby v${{ matrix.ruby }} rails v${{ matrix.rails }}
9
- strategy:
10
- matrix:
11
- ruby: [ '2.6', '2.7', '3.0' ]
12
- rails: [ '6.0', '6.1' ]
13
- steps:
14
- - uses: actions/checkout@v2
15
-
16
- - name: Set up Ruby
17
- uses: ruby/setup-ruby@v1
18
- with:
19
- ruby-version: ${{ matrix.ruby }}
20
-
21
- - name: Install dependencies
22
- env:
23
- BUNDLE_GEMFILE: gemfiles/rails.${{ matrix.rails }}.gemfile
24
- run: bundle install
25
-
26
- - name: Run specs
27
- env:
28
- BUNDLE_GEMFILE: gemfiles/rails.${{ matrix.rails }}.gemfile
29
- run: bundle exec rake spec
@@ -1,15 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activesupport", "~> 4.2.0"
6
- gem "activemodel", "~> 4.2.0"
7
- gem "activerecord", "~> 4.2.0"
8
- gem "sqlite3", "~> 1.3.6"
9
-
10
- group :test do
11
- gem "guard"
12
- gem "guard-rspec"
13
- end
14
-
15
- gemspec path: "../"
@@ -1,72 +0,0 @@
1
- module Granite
2
- module Form
3
- module Model
4
- # == Callbacks for Granite::Form::Model lifecycle
5
- #
6
- # Provides ActiveModel callbacks support for lifecycle
7
- # actions.
8
- #
9
- # class Book
10
- # include Granite::Form::Model
11
- #
12
- # attribute :id, Integer
13
- # attribute :title, String
14
- #
15
- # define_save do
16
- # REDIS.set(id, attributes.to_json)
17
- # end
18
- #
19
- # define_destroy do
20
- # REDIS.del(instance.id)
21
- # end
22
- #
23
- # after_initialize :setup_id
24
- # before_save :do_something
25
- # around_update do |&block|
26
- # ...
27
- # block.call
28
- # ...
29
- # end
30
- # after_destroy { ... }
31
- # end
32
- #
33
- module Callbacks
34
- extend ActiveSupport::Concern
35
-
36
- included do
37
- extend ActiveModel::Callbacks
38
-
39
- include ActiveModel::Validations::Callbacks
40
- include Lifecycle
41
- prepend PrependMethods
42
-
43
- define_model_callbacks :initialize, only: :after
44
- define_model_callbacks :save, :create, :update, :destroy
45
- end
46
-
47
- module PrependMethods
48
- def initialize(*_)
49
- super
50
- run_callbacks :initialize
51
- end
52
-
53
- def save_object(&block)
54
- run_callbacks(:save) { super(&block) }
55
- end
56
-
57
- def create_object(&block)
58
- run_callbacks(:create) { super(&block) }
59
- end
60
-
61
- def update_object(&block)
62
- run_callbacks(:update) { super(&block) }
63
- end
64
-
65
- def destroy_object(&block)
66
- run_callbacks(:destroy) { super(&block) }
67
- end
68
- end
69
- end
70
- end
71
- end
72
- end