sorbet-rails 0.6.5 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +1 -2
  3. data/.gitignore +2 -1
  4. data/.travis.yml +1 -1
  5. data/README.md +60 -11
  6. data/Rakefile +3 -3
  7. data/lib/bundled_rbi/customizabel_rbi_formatter.rbi +29 -0
  8. data/lib/bundled_rbi/pluck_to_tstruct.rbi +2 -1
  9. data/lib/bundled_rbi/typed_enum.rbi +7 -0
  10. data/lib/sorbet-rails.rb +1 -3
  11. data/lib/sorbet-rails/active_record_rbi_formatter.rb +2 -2
  12. data/lib/sorbet-rails/config.rb +12 -0
  13. data/lib/sorbet-rails/dependent_gem_rbis/activerecord.rbi +3 -0
  14. data/lib/sorbet-rails/deprecation.rb +1 -0
  15. data/lib/sorbet-rails/gem_plugins/kaminari_plugin.rb +8 -0
  16. data/lib/sorbet-rails/helper_rbi_formatter.rb +1 -1
  17. data/lib/sorbet-rails/job_rbi_formatter.rb +75 -62
  18. data/lib/sorbet-rails/mailer_rbi_formatter.rb +40 -27
  19. data/lib/sorbet-rails/model_column_utils.rb +129 -0
  20. data/lib/sorbet-rails/model_plugins/active_record_assoc.rb +40 -1
  21. data/lib/sorbet-rails/model_plugins/active_record_attribute.rb +12 -112
  22. data/lib/sorbet-rails/model_plugins/active_record_querying.rb +2 -2
  23. data/lib/sorbet-rails/model_plugins/active_record_serialized_attribute.rb +68 -0
  24. data/lib/sorbet-rails/model_plugins/base.rb +6 -8
  25. data/lib/sorbet-rails/model_plugins/plugins.rb +3 -0
  26. data/lib/sorbet-rails/model_rbi_formatter.rb +3 -3
  27. data/lib/sorbet-rails/model_utils.rb +5 -2
  28. data/lib/sorbet-rails/rails_mixins/generated_url_helpers.rb +2 -3
  29. data/lib/sorbet-rails/rails_mixins/pluck_to_tstruct.rb +54 -7
  30. data/lib/sorbet-rails/railtie.rb +0 -2
  31. data/lib/sorbet-rails/routes_rbi_formatter.rb +6 -2
  32. data/lib/sorbet-rails/sorbet_utils.rb +152 -150
  33. data/lib/sorbet-rails/tasks/rails_rbi.rake +9 -8
  34. data/sorbet-rails.gemspec +2 -2
  35. data/spec/bin/run_spec.sh +1 -1
  36. data/spec/generators/rails-template.rb +16 -0
  37. data/spec/generators/sorbet_test_cases.rb +29 -57
  38. data/spec/job_rbi_formatter_spec.rb +1 -1
  39. data/spec/pluck_to_tstruct_spec.rb +115 -16
  40. data/spec/rails_helper.rb +2 -2
  41. data/spec/rake_rails_rbi_jobs_spec.rb +20 -0
  42. data/spec/rake_rails_rbi_mailers_spec.rb +21 -0
  43. data/spec/sorbet_spec.rb +5 -5
  44. data/spec/support/v5.0/Gemfile +1 -1
  45. data/spec/support/v5.0/Gemfile.lock +15 -14
  46. data/spec/support/v5.0/app/controllers/application_controller.rb +1 -1
  47. data/spec/support/v5.0/app/models/headmaster.rb +1 -1
  48. data/spec/support/v5.0/app/models/potion.rb +1 -1
  49. data/spec/support/v5.0/app/models/robe.rb +1 -1
  50. data/spec/support/v5.0/app/models/school.rb +1 -1
  51. data/spec/support/v5.0/app/models/spell.rb +1 -1
  52. data/spec/support/v5.0/app/models/subject.rb +1 -1
  53. data/spec/support/v5.0/app/models/wizard.rb +5 -0
  54. data/spec/support/v5.0/config/environments/development.rb +1 -1
  55. data/spec/support/v5.0/config/environments/production.rb +1 -1
  56. data/spec/support/v5.0/config/environments/test.rb +1 -1
  57. data/spec/support/v5.0/config/initializers/wrap_parameters.rb +1 -1
  58. data/spec/support/v5.0/config/routes.rb +1 -1
  59. data/spec/support/v5.0/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
  60. data/spec/support/v5.0/db/schema.rb +8 -4
  61. data/spec/support/v5.0/sorbet_test_cases.rb +29 -57
  62. data/spec/support/v5.1/Gemfile.lock +13 -12
  63. data/spec/support/v5.1/app/controllers/application_controller.rb +1 -1
  64. data/spec/support/v5.1/app/models/headmaster.rb +1 -1
  65. data/spec/support/v5.1/app/models/school.rb +1 -1
  66. data/spec/support/v5.1/app/models/wizard.rb +5 -0
  67. data/spec/support/v5.1/config/environments/production.rb +1 -1
  68. data/spec/support/v5.1/config/initializers/wrap_parameters.rb +1 -1
  69. data/spec/support/v5.1/config/routes.rb +1 -1
  70. data/spec/support/v5.1/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
  71. data/spec/support/v5.1/db/schema.rb +5 -1
  72. data/spec/support/v5.1/sorbet_test_cases.rb +29 -57
  73. data/spec/support/v5.2/Gemfile +1 -1
  74. data/spec/support/v5.2/Gemfile.lock +15 -14
  75. data/spec/support/v5.2/app/models/headmaster.rb +1 -1
  76. data/spec/support/v5.2/app/models/school.rb +1 -1
  77. data/spec/support/v5.2/app/models/wizard.rb +5 -0
  78. data/spec/support/v5.2/config/environments/development.rb +1 -1
  79. data/spec/support/v5.2/config/environments/production.rb +1 -1
  80. data/spec/support/v5.2/config/environments/test.rb +1 -1
  81. data/spec/support/v5.2/config/initializers/wrap_parameters.rb +1 -1
  82. data/spec/support/v5.2/config/routes.rb +1 -1
  83. data/spec/support/v5.2/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
  84. data/spec/support/v5.2/db/schema.rb +5 -1
  85. data/spec/support/v5.2/sorbet_test_cases.rb +29 -57
  86. data/spec/support/v6.0/.gitignore +6 -0
  87. data/spec/support/v6.0/Gemfile +3 -3
  88. data/spec/support/v6.0/Gemfile.lock +82 -80
  89. data/spec/support/v6.0/app/models/wizard.rb +5 -0
  90. data/spec/support/v6.0/bin/bundle +22 -13
  91. data/spec/support/v6.0/config/environments/development.rb +1 -1
  92. data/spec/support/v6.0/config/environments/production.rb +1 -1
  93. data/spec/support/v6.0/config/environments/test.rb +2 -2
  94. data/spec/support/v6.0/config/routes.rb +1 -1
  95. data/spec/support/v6.0/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
  96. data/spec/support/v6.0/db/schema.rb +5 -1
  97. data/spec/support/v6.0/sorbet_test_cases.rb +29 -57
  98. data/spec/support/v6.0/tmp/pids/.keep +0 -0
  99. data/spec/test_data/v5.0/expected_application_job.rbi +2 -2
  100. data/spec/test_data/v5.0/expected_award_house_point_hourglasses.rbi +2 -2
  101. data/spec/test_data/v5.0/expected_custom_application_job.rbi +21 -0
  102. data/spec/test_data/v5.0/expected_custom_application_mailer.rbi +6 -0
  103. data/spec/test_data/v5.0/expected_custom_award_house_point_hourglasses.rbi +21 -0
  104. data/spec/test_data/v5.0/expected_custom_daily_prophet_mailer.rbi +8 -0
  105. data/spec/test_data/v5.0/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
  106. data/spec/test_data/v5.0/expected_headmaster.rbi +26 -2
  107. data/spec/test_data/v5.0/expected_internal_metadata.rbi +2 -2
  108. data/spec/test_data/v5.0/expected_potion.rbi +14 -2
  109. data/spec/test_data/v5.0/expected_robe.rbi +14 -2
  110. data/spec/test_data/v5.0/expected_routes.rbi +4 -0
  111. data/spec/test_data/v5.0/expected_schema_migration.rbi +2 -2
  112. data/spec/test_data/v5.0/expected_school.rbi +14 -2
  113. data/spec/test_data/v5.0/expected_spell.rbi +2 -2
  114. data/spec/test_data/v5.0/expected_spell/habtm_spell_books.rbi +26 -2
  115. data/spec/test_data/v5.0/expected_spell_book.rbi +23 -11
  116. data/spec/test_data/v5.0/expected_spell_book/habtm_spells.rbi +26 -2
  117. data/spec/test_data/v5.0/expected_squib.rbi +65 -2
  118. data/spec/test_data/v5.0/expected_subject.rbi +2 -2
  119. data/spec/test_data/v5.0/expected_subject/habtm_wizards.rbi +26 -2
  120. data/spec/test_data/v5.0/expected_wand.rbi +24 -12
  121. data/spec/test_data/v5.0/expected_wizard.rbi +123 -60
  122. data/spec/test_data/v5.0/expected_wizard/habtm_subjects.rbi +26 -2
  123. data/spec/test_data/v5.0/expected_wizard_wo_spellbook.rbi +123 -60
  124. data/spec/test_data/v5.1/expected_application_job.rbi +2 -2
  125. data/spec/test_data/v5.1/expected_award_house_point_hourglasses.rbi +2 -2
  126. data/spec/test_data/v5.1/expected_custom_application_job.rbi +21 -0
  127. data/spec/test_data/v5.1/expected_custom_application_mailer.rbi +6 -0
  128. data/spec/test_data/v5.1/expected_custom_award_house_point_hourglasses.rbi +21 -0
  129. data/spec/test_data/v5.1/expected_custom_daily_prophet_mailer.rbi +8 -0
  130. data/spec/test_data/v5.1/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
  131. data/spec/test_data/v5.1/expected_headmaster.rbi +26 -2
  132. data/spec/test_data/v5.1/expected_internal_metadata.rbi +2 -2
  133. data/spec/test_data/v5.1/expected_potion.rbi +14 -2
  134. data/spec/test_data/v5.1/expected_robe.rbi +14 -2
  135. data/spec/test_data/v5.1/expected_routes.rbi +4 -0
  136. data/spec/test_data/v5.1/expected_schema_migration.rbi +2 -2
  137. data/spec/test_data/v5.1/expected_school.rbi +14 -2
  138. data/spec/test_data/v5.1/expected_spell.rbi +2 -2
  139. data/spec/test_data/v5.1/expected_spell/habtm_spell_books.rbi +26 -2
  140. data/spec/test_data/v5.1/expected_spell_book.rbi +23 -11
  141. data/spec/test_data/v5.1/expected_spell_book/habtm_spells.rbi +26 -2
  142. data/spec/test_data/v5.1/expected_squib.rbi +65 -2
  143. data/spec/test_data/v5.1/expected_subject.rbi +2 -2
  144. data/spec/test_data/v5.1/expected_subject/habtm_wizards.rbi +26 -2
  145. data/spec/test_data/v5.1/expected_wand.rbi +24 -12
  146. data/spec/test_data/v5.1/expected_wizard.rbi +123 -60
  147. data/spec/test_data/v5.1/expected_wizard/habtm_subjects.rbi +26 -2
  148. data/spec/test_data/v5.1/expected_wizard_wo_spellbook.rbi +123 -60
  149. data/spec/test_data/v5.2/expected_application_job.rbi +2 -2
  150. data/spec/test_data/v5.2/expected_attachment.rbi +26 -2
  151. data/spec/test_data/v5.2/expected_award_house_point_hourglasses.rbi +2 -2
  152. data/spec/test_data/v5.2/expected_blob.rbi +27 -3
  153. data/spec/test_data/v5.2/expected_custom_application_job.rbi +21 -0
  154. data/spec/test_data/v5.2/expected_custom_application_mailer.rbi +6 -0
  155. data/spec/test_data/v5.2/expected_custom_award_house_point_hourglasses.rbi +21 -0
  156. data/spec/test_data/v5.2/expected_custom_daily_prophet_mailer.rbi +8 -0
  157. data/spec/test_data/v5.2/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
  158. data/spec/test_data/v5.2/expected_headmaster.rbi +26 -2
  159. data/spec/test_data/v5.2/expected_internal_metadata.rbi +2 -2
  160. data/spec/test_data/v5.2/expected_potion.rbi +14 -2
  161. data/spec/test_data/v5.2/expected_robe.rbi +14 -2
  162. data/spec/test_data/v5.2/expected_routes.rbi +4 -0
  163. data/spec/test_data/v5.2/expected_schema_migration.rbi +2 -2
  164. data/spec/test_data/v5.2/expected_school.rbi +14 -2
  165. data/spec/test_data/v5.2/expected_spell.rbi +2 -2
  166. data/spec/test_data/v5.2/expected_spell/habtm_spell_books.rbi +26 -2
  167. data/spec/test_data/v5.2/expected_spell_book.rbi +23 -11
  168. data/spec/test_data/v5.2/expected_spell_book/habtm_spells.rbi +26 -2
  169. data/spec/test_data/v5.2/expected_squib.rbi +91 -4
  170. data/spec/test_data/v5.2/expected_subject.rbi +2 -2
  171. data/spec/test_data/v5.2/expected_subject/habtm_wizards.rbi +26 -2
  172. data/spec/test_data/v5.2/expected_wand.rbi +24 -12
  173. data/spec/test_data/v5.2/expected_wizard.rbi +149 -62
  174. data/spec/test_data/v5.2/expected_wizard/habtm_subjects.rbi +26 -2
  175. data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +149 -62
  176. data/spec/test_data/v6.0/expected_application_job.rbi +2 -2
  177. data/spec/test_data/v6.0/expected_attachment.rbi +26 -2
  178. data/spec/test_data/v6.0/expected_award_house_point_hourglasses.rbi +2 -2
  179. data/spec/test_data/v6.0/expected_blob.rbi +27 -3
  180. data/spec/test_data/v6.0/expected_custom_application_job.rbi +21 -0
  181. data/spec/test_data/v6.0/expected_custom_application_mailer.rbi +6 -0
  182. data/spec/test_data/v6.0/expected_custom_award_house_point_hourglasses.rbi +21 -0
  183. data/spec/test_data/v6.0/expected_custom_daily_prophet_mailer.rbi +8 -0
  184. data/spec/test_data/v6.0/expected_custom_hogwarts_acceptance_mailer.rbi +21 -0
  185. data/spec/test_data/v6.0/expected_headmaster.rbi +26 -2
  186. data/spec/test_data/v6.0/expected_internal_metadata.rbi +2 -2
  187. data/spec/test_data/v6.0/expected_potion.rbi +14 -2
  188. data/spec/test_data/v6.0/expected_robe.rbi +14 -2
  189. data/spec/test_data/v6.0/expected_routes.rbi +4 -0
  190. data/spec/test_data/v6.0/expected_schema_migration.rbi +2 -2
  191. data/spec/test_data/v6.0/expected_school.rbi +14 -2
  192. data/spec/test_data/v6.0/expected_spell.rbi +2 -2
  193. data/spec/test_data/v6.0/expected_spell/habtm_spell_books.rbi +26 -2
  194. data/spec/test_data/v6.0/expected_spell_book.rbi +23 -11
  195. data/spec/test_data/v6.0/expected_spell_book/habtm_spells.rbi +26 -2
  196. data/spec/test_data/v6.0/expected_squib.rbi +91 -4
  197. data/spec/test_data/v6.0/expected_subject.rbi +2 -2
  198. data/spec/test_data/v6.0/expected_subject/habtm_wizards.rbi +26 -2
  199. data/spec/test_data/v6.0/expected_wand.rbi +24 -12
  200. data/spec/test_data/v6.0/expected_wizard.rbi +149 -62
  201. data/spec/test_data/v6.0/expected_wizard/habtm_subjects.rbi +26 -2
  202. data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +149 -62
  203. data/spec/tstruct_comparable.rb +13 -0
  204. metadata +61 -15
  205. data/lib/bundled_rbi/parameters.rbi +0 -28
  206. data/lib/sorbet-rails/custom_types/boolean_string.rb +0 -42
  207. data/lib/sorbet-rails/custom_types/integer_string.rb +0 -45
  208. data/lib/sorbet-rails/rails_mixins/custom_params_methods.rb +0 -57
  209. data/spec/boolean_string_spec.rb +0 -59
  210. data/spec/custom_params_methods_spec.rb +0 -138
  211. data/spec/integer_string_spec.rb +0 -46
@@ -0,0 +1,13 @@
1
+ module TStructComparable
2
+ def ==(other)
3
+ return false unless other.is_a?(self.class)
4
+
5
+ self.class.props.keys.all? do |prop|
6
+ self.send(prop) == other.send(prop)
7
+ end
8
+ end
9
+
10
+ def eql?(other)
11
+ self == other
12
+ end
13
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorbet-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chan Zuckerberg Initiative
@@ -14,16 +14,16 @@ dependencies:
14
14
  name: parlour
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: 4.0.1
20
20
  type: :runtime
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: '2.0'
26
+ version: 4.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sorbet-runtime
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -200,15 +200,14 @@ files:
200
200
  - Rakefile
201
201
  - SECURITY.md
202
202
  - bin/sorbet
203
- - lib/bundled_rbi/parameters.rbi
203
+ - lib/bundled_rbi/customizabel_rbi_formatter.rbi
204
204
  - lib/bundled_rbi/pluck_to_tstruct.rbi
205
205
  - lib/bundled_rbi/type_assert.rbi
206
+ - lib/bundled_rbi/typed_enum.rbi
206
207
  - lib/bundled_rbi/typed_params.rbi
207
208
  - lib/sorbet-rails.rb
208
209
  - lib/sorbet-rails/active_record_rbi_formatter.rb
209
210
  - lib/sorbet-rails/config.rb
210
- - lib/sorbet-rails/custom_types/boolean_string.rb
211
- - lib/sorbet-rails/custom_types/integer_string.rb
212
211
  - lib/sorbet-rails/dependent_gem_rbis/README.md
213
212
  - lib/sorbet-rails/dependent_gem_rbis/actionmailer.rbi
214
213
  - lib/sorbet-rails/dependent_gem_rbis/activejob.rbi
@@ -224,11 +223,13 @@ files:
224
223
  - lib/sorbet-rails/helper_rbi_formatter.rb
225
224
  - lib/sorbet-rails/job_rbi_formatter.rb
226
225
  - lib/sorbet-rails/mailer_rbi_formatter.rb
226
+ - lib/sorbet-rails/model_column_utils.rb
227
227
  - lib/sorbet-rails/model_plugins/active_record_assoc.rb
228
228
  - lib/sorbet-rails/model_plugins/active_record_attribute.rb
229
229
  - lib/sorbet-rails/model_plugins/active_record_enum.rb
230
230
  - lib/sorbet-rails/model_plugins/active_record_named_scope.rb
231
231
  - lib/sorbet-rails/model_plugins/active_record_querying.rb
232
+ - lib/sorbet-rails/model_plugins/active_record_serialized_attribute.rb
232
233
  - lib/sorbet-rails/model_plugins/active_relation_where_not.rb
233
234
  - lib/sorbet-rails/model_plugins/active_storage_methods.rb
234
235
  - lib/sorbet-rails/model_plugins/base.rb
@@ -239,7 +240,6 @@ files:
239
240
  - lib/sorbet-rails/model_utils.rb
240
241
  - lib/sorbet-rails/rails_mixins/active_record_overrides.rb
241
242
  - lib/sorbet-rails/rails_mixins/custom_finder_methods.rb
242
- - lib/sorbet-rails/rails_mixins/custom_params_methods.rb
243
243
  - lib/sorbet-rails/rails_mixins/generated_url_helpers.rb
244
244
  - lib/sorbet-rails/rails_mixins/pluck_to_tstruct.rb
245
245
  - lib/sorbet-rails/railtie.rb
@@ -257,13 +257,10 @@ files:
257
257
  - spec/bin/run_all_specs.sh
258
258
  - spec/bin/run_spec.sh
259
259
  - spec/bin/update_test_data.sh
260
- - spec/boolean_string_spec.rb
261
260
  - spec/custom_finder_methods_spec.rb
262
- - spec/custom_params_methods_spec.rb
263
261
  - spec/generators/rails-template.rb
264
262
  - spec/generators/sorbet_test_cases.rb
265
263
  - spec/helper_rbi_formatter_spec.rb
266
- - spec/integer_string_spec.rb
267
264
  - spec/job_rbi_formatter_spec.rb
268
265
  - spec/mailer_rbi_formatter_spec.rb
269
266
  - spec/model_plugins_spec.rb
@@ -356,6 +353,7 @@ files:
356
353
  - spec/support/v5.0/db/migrate/20190620000012_add_spell.rb
357
354
  - spec/support/v5.0/db/migrate/20190620000013_add_spells_spell_books.rb
358
355
  - spec/support/v5.0/db/migrate/20190620000014_create_headmasters.rb
356
+ - spec/support/v5.0/db/migrate/20190620000015_add_serialized_to_wizards.rb
359
357
  - spec/support/v5.0/db/schema.rb
360
358
  - spec/support/v5.0/db/seeds.rb
361
359
  - spec/support/v5.0/lib/assets/.keep
@@ -440,6 +438,7 @@ files:
440
438
  - spec/support/v5.1/db/migrate/20190620000012_add_spell.rb
441
439
  - spec/support/v5.1/db/migrate/20190620000013_add_spells_spell_books.rb
442
440
  - spec/support/v5.1/db/migrate/20190620000014_create_headmasters.rb
441
+ - spec/support/v5.1/db/migrate/20190620000015_add_serialized_to_wizards.rb
443
442
  - spec/support/v5.1/db/schema.rb
444
443
  - spec/support/v5.1/db/seeds.rb
445
444
  - spec/support/v5.1/lib/assets/.keep
@@ -527,6 +526,7 @@ files:
527
526
  - spec/support/v5.2/db/migrate/20190620000012_add_spell.rb
528
527
  - spec/support/v5.2/db/migrate/20190620000013_add_spells_spell_books.rb
529
528
  - spec/support/v5.2/db/migrate/20190620000014_create_headmasters.rb
529
+ - spec/support/v5.2/db/migrate/20190620000015_add_serialized_to_wizards.rb
530
530
  - spec/support/v5.2/db/schema.rb
531
531
  - spec/support/v5.2/db/seeds.rb
532
532
  - spec/support/v5.2/lib/assets/.keep
@@ -613,6 +613,7 @@ files:
613
613
  - spec/support/v6.0/db/migrate/20190620000012_add_spell.rb
614
614
  - spec/support/v6.0/db/migrate/20190620000013_add_spells_spell_books.rb
615
615
  - spec/support/v6.0/db/migrate/20190620000014_create_headmasters.rb
616
+ - spec/support/v6.0/db/migrate/20190620000015_add_serialized_to_wizards.rb
616
617
  - spec/support/v6.0/db/schema.rb
617
618
  - spec/support/v6.0/db/seeds.rb
618
619
  - spec/support/v6.0/lib/assets/.keep
@@ -623,12 +624,18 @@ files:
623
624
  - spec/support/v6.0/sorbet_test_cases.rb
624
625
  - spec/support/v6.0/storage/.keep
625
626
  - spec/support/v6.0/tmp/.keep
627
+ - spec/support/v6.0/tmp/pids/.keep
626
628
  - spec/support/v6.0/vendor/.keep
627
629
  - spec/test_data/v5.0/expected_active_record_base.rbi
628
630
  - spec/test_data/v5.0/expected_active_record_relation.rbi
629
631
  - spec/test_data/v5.0/expected_application_job.rbi
630
632
  - spec/test_data/v5.0/expected_application_mailer.rbi
631
633
  - spec/test_data/v5.0/expected_award_house_point_hourglasses.rbi
634
+ - spec/test_data/v5.0/expected_custom_application_job.rbi
635
+ - spec/test_data/v5.0/expected_custom_application_mailer.rbi
636
+ - spec/test_data/v5.0/expected_custom_award_house_point_hourglasses.rbi
637
+ - spec/test_data/v5.0/expected_custom_daily_prophet_mailer.rbi
638
+ - spec/test_data/v5.0/expected_custom_hogwarts_acceptance_mailer.rbi
632
639
  - spec/test_data/v5.0/expected_daily_prophet_mailer.rbi
633
640
  - spec/test_data/v5.0/expected_habtm_subjects.rbi
634
641
  - spec/test_data/v5.0/expected_habtm_wizards.rbi
@@ -661,6 +668,11 @@ files:
661
668
  - spec/test_data/v5.1/expected_application_job.rbi
662
669
  - spec/test_data/v5.1/expected_application_mailer.rbi
663
670
  - spec/test_data/v5.1/expected_award_house_point_hourglasses.rbi
671
+ - spec/test_data/v5.1/expected_custom_application_job.rbi
672
+ - spec/test_data/v5.1/expected_custom_application_mailer.rbi
673
+ - spec/test_data/v5.1/expected_custom_award_house_point_hourglasses.rbi
674
+ - spec/test_data/v5.1/expected_custom_daily_prophet_mailer.rbi
675
+ - spec/test_data/v5.1/expected_custom_hogwarts_acceptance_mailer.rbi
664
676
  - spec/test_data/v5.1/expected_daily_prophet_mailer.rbi
665
677
  - spec/test_data/v5.1/expected_habtm_subjects.rbi
666
678
  - spec/test_data/v5.1/expected_habtm_wizards.rbi
@@ -695,6 +707,11 @@ files:
695
707
  - spec/test_data/v5.2/expected_attachment.rbi
696
708
  - spec/test_data/v5.2/expected_award_house_point_hourglasses.rbi
697
709
  - spec/test_data/v5.2/expected_blob.rbi
710
+ - spec/test_data/v5.2/expected_custom_application_job.rbi
711
+ - spec/test_data/v5.2/expected_custom_application_mailer.rbi
712
+ - spec/test_data/v5.2/expected_custom_award_house_point_hourglasses.rbi
713
+ - spec/test_data/v5.2/expected_custom_daily_prophet_mailer.rbi
714
+ - spec/test_data/v5.2/expected_custom_hogwarts_acceptance_mailer.rbi
698
715
  - spec/test_data/v5.2/expected_daily_prophet_mailer.rbi
699
716
  - spec/test_data/v5.2/expected_habtm_subjects.rbi
700
717
  - spec/test_data/v5.2/expected_habtm_wizards.rbi
@@ -729,6 +746,11 @@ files:
729
746
  - spec/test_data/v6.0/expected_attachment.rbi
730
747
  - spec/test_data/v6.0/expected_award_house_point_hourglasses.rbi
731
748
  - spec/test_data/v6.0/expected_blob.rbi
749
+ - spec/test_data/v6.0/expected_custom_application_job.rbi
750
+ - spec/test_data/v6.0/expected_custom_application_mailer.rbi
751
+ - spec/test_data/v6.0/expected_custom_award_house_point_hourglasses.rbi
752
+ - spec/test_data/v6.0/expected_custom_daily_prophet_mailer.rbi
753
+ - spec/test_data/v6.0/expected_custom_hogwarts_acceptance_mailer.rbi
732
754
  - spec/test_data/v6.0/expected_daily_prophet_mailer.rbi
733
755
  - spec/test_data/v6.0/expected_habtm_subjects.rbi
734
756
  - spec/test_data/v6.0/expected_habtm_wizards.rbi
@@ -756,6 +778,7 @@ files:
756
778
  - spec/test_data/v6.0/expected_wizard.rbi
757
779
  - spec/test_data/v6.0/expected_wizard/habtm_subjects.rbi
758
780
  - spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi
781
+ - spec/tstruct_comparable.rb
759
782
  - spec/typed_enum_spec.rb
760
783
  - spec/typed_params_spec.rb
761
784
  - spec/utils_spec.rb
@@ -788,13 +811,10 @@ test_files:
788
811
  - spec/bin/run_all_specs.sh
789
812
  - spec/bin/run_spec.sh
790
813
  - spec/bin/update_test_data.sh
791
- - spec/boolean_string_spec.rb
792
814
  - spec/custom_finder_methods_spec.rb
793
- - spec/custom_params_methods_spec.rb
794
815
  - spec/generators/rails-template.rb
795
816
  - spec/generators/sorbet_test_cases.rb
796
817
  - spec/helper_rbi_formatter_spec.rb
797
- - spec/integer_string_spec.rb
798
818
  - spec/job_rbi_formatter_spec.rb
799
819
  - spec/mailer_rbi_formatter_spec.rb
800
820
  - spec/model_plugins_spec.rb
@@ -887,6 +907,7 @@ test_files:
887
907
  - spec/support/v5.0/db/migrate/20190620000012_add_spell.rb
888
908
  - spec/support/v5.0/db/migrate/20190620000013_add_spells_spell_books.rb
889
909
  - spec/support/v5.0/db/migrate/20190620000014_create_headmasters.rb
910
+ - spec/support/v5.0/db/migrate/20190620000015_add_serialized_to_wizards.rb
890
911
  - spec/support/v5.0/db/schema.rb
891
912
  - spec/support/v5.0/db/seeds.rb
892
913
  - spec/support/v5.0/lib/assets/.keep
@@ -971,6 +992,7 @@ test_files:
971
992
  - spec/support/v5.1/db/migrate/20190620000012_add_spell.rb
972
993
  - spec/support/v5.1/db/migrate/20190620000013_add_spells_spell_books.rb
973
994
  - spec/support/v5.1/db/migrate/20190620000014_create_headmasters.rb
995
+ - spec/support/v5.1/db/migrate/20190620000015_add_serialized_to_wizards.rb
974
996
  - spec/support/v5.1/db/schema.rb
975
997
  - spec/support/v5.1/db/seeds.rb
976
998
  - spec/support/v5.1/lib/assets/.keep
@@ -1058,6 +1080,7 @@ test_files:
1058
1080
  - spec/support/v5.2/db/migrate/20190620000012_add_spell.rb
1059
1081
  - spec/support/v5.2/db/migrate/20190620000013_add_spells_spell_books.rb
1060
1082
  - spec/support/v5.2/db/migrate/20190620000014_create_headmasters.rb
1083
+ - spec/support/v5.2/db/migrate/20190620000015_add_serialized_to_wizards.rb
1061
1084
  - spec/support/v5.2/db/schema.rb
1062
1085
  - spec/support/v5.2/db/seeds.rb
1063
1086
  - spec/support/v5.2/lib/assets/.keep
@@ -1144,6 +1167,7 @@ test_files:
1144
1167
  - spec/support/v6.0/db/migrate/20190620000012_add_spell.rb
1145
1168
  - spec/support/v6.0/db/migrate/20190620000013_add_spells_spell_books.rb
1146
1169
  - spec/support/v6.0/db/migrate/20190620000014_create_headmasters.rb
1170
+ - spec/support/v6.0/db/migrate/20190620000015_add_serialized_to_wizards.rb
1147
1171
  - spec/support/v6.0/db/schema.rb
1148
1172
  - spec/support/v6.0/db/seeds.rb
1149
1173
  - spec/support/v6.0/lib/assets/.keep
@@ -1154,12 +1178,18 @@ test_files:
1154
1178
  - spec/support/v6.0/sorbet_test_cases.rb
1155
1179
  - spec/support/v6.0/storage/.keep
1156
1180
  - spec/support/v6.0/tmp/.keep
1181
+ - spec/support/v6.0/tmp/pids/.keep
1157
1182
  - spec/support/v6.0/vendor/.keep
1158
1183
  - spec/test_data/v5.0/expected_active_record_base.rbi
1159
1184
  - spec/test_data/v5.0/expected_active_record_relation.rbi
1160
1185
  - spec/test_data/v5.0/expected_application_job.rbi
1161
1186
  - spec/test_data/v5.0/expected_application_mailer.rbi
1162
1187
  - spec/test_data/v5.0/expected_award_house_point_hourglasses.rbi
1188
+ - spec/test_data/v5.0/expected_custom_application_job.rbi
1189
+ - spec/test_data/v5.0/expected_custom_application_mailer.rbi
1190
+ - spec/test_data/v5.0/expected_custom_award_house_point_hourglasses.rbi
1191
+ - spec/test_data/v5.0/expected_custom_daily_prophet_mailer.rbi
1192
+ - spec/test_data/v5.0/expected_custom_hogwarts_acceptance_mailer.rbi
1163
1193
  - spec/test_data/v5.0/expected_daily_prophet_mailer.rbi
1164
1194
  - spec/test_data/v5.0/expected_habtm_subjects.rbi
1165
1195
  - spec/test_data/v5.0/expected_habtm_wizards.rbi
@@ -1192,6 +1222,11 @@ test_files:
1192
1222
  - spec/test_data/v5.1/expected_application_job.rbi
1193
1223
  - spec/test_data/v5.1/expected_application_mailer.rbi
1194
1224
  - spec/test_data/v5.1/expected_award_house_point_hourglasses.rbi
1225
+ - spec/test_data/v5.1/expected_custom_application_job.rbi
1226
+ - spec/test_data/v5.1/expected_custom_application_mailer.rbi
1227
+ - spec/test_data/v5.1/expected_custom_award_house_point_hourglasses.rbi
1228
+ - spec/test_data/v5.1/expected_custom_daily_prophet_mailer.rbi
1229
+ - spec/test_data/v5.1/expected_custom_hogwarts_acceptance_mailer.rbi
1195
1230
  - spec/test_data/v5.1/expected_daily_prophet_mailer.rbi
1196
1231
  - spec/test_data/v5.1/expected_habtm_subjects.rbi
1197
1232
  - spec/test_data/v5.1/expected_habtm_wizards.rbi
@@ -1226,6 +1261,11 @@ test_files:
1226
1261
  - spec/test_data/v5.2/expected_attachment.rbi
1227
1262
  - spec/test_data/v5.2/expected_award_house_point_hourglasses.rbi
1228
1263
  - spec/test_data/v5.2/expected_blob.rbi
1264
+ - spec/test_data/v5.2/expected_custom_application_job.rbi
1265
+ - spec/test_data/v5.2/expected_custom_application_mailer.rbi
1266
+ - spec/test_data/v5.2/expected_custom_award_house_point_hourglasses.rbi
1267
+ - spec/test_data/v5.2/expected_custom_daily_prophet_mailer.rbi
1268
+ - spec/test_data/v5.2/expected_custom_hogwarts_acceptance_mailer.rbi
1229
1269
  - spec/test_data/v5.2/expected_daily_prophet_mailer.rbi
1230
1270
  - spec/test_data/v5.2/expected_habtm_subjects.rbi
1231
1271
  - spec/test_data/v5.2/expected_habtm_wizards.rbi
@@ -1260,6 +1300,11 @@ test_files:
1260
1300
  - spec/test_data/v6.0/expected_attachment.rbi
1261
1301
  - spec/test_data/v6.0/expected_award_house_point_hourglasses.rbi
1262
1302
  - spec/test_data/v6.0/expected_blob.rbi
1303
+ - spec/test_data/v6.0/expected_custom_application_job.rbi
1304
+ - spec/test_data/v6.0/expected_custom_application_mailer.rbi
1305
+ - spec/test_data/v6.0/expected_custom_award_house_point_hourglasses.rbi
1306
+ - spec/test_data/v6.0/expected_custom_daily_prophet_mailer.rbi
1307
+ - spec/test_data/v6.0/expected_custom_hogwarts_acceptance_mailer.rbi
1263
1308
  - spec/test_data/v6.0/expected_daily_prophet_mailer.rbi
1264
1309
  - spec/test_data/v6.0/expected_habtm_subjects.rbi
1265
1310
  - spec/test_data/v6.0/expected_habtm_wizards.rbi
@@ -1287,6 +1332,7 @@ test_files:
1287
1332
  - spec/test_data/v6.0/expected_wizard.rbi
1288
1333
  - spec/test_data/v6.0/expected_wizard/habtm_subjects.rbi
1289
1334
  - spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi
1335
+ - spec/tstruct_comparable.rb
1290
1336
  - spec/typed_enum_spec.rb
1291
1337
  - spec/typed_params_spec.rb
1292
1338
  - spec/utils_spec.rb
@@ -1,28 +0,0 @@
1
- # typed: strong
2
-
3
- module SorbetRails::CustomParamsMethods
4
- extend T::Sig
5
-
6
- sig {
7
- type_parameters(:U).
8
- params(key: Symbol, ta: ITypeAssert[T.type_parameter(:U)]).
9
- returns(T.type_parameter(:U))
10
- }
11
- def require_typed(key, ta); end
12
-
13
- # Note: when default value is a hash, it'll be converted into an ActionController::Parameters
14
- sig {
15
- type_parameters(:U).
16
- params(
17
- key: Symbol,
18
- ta: ITypeAssert[T.type_parameter(:U)],
19
- args: T.untyped,
20
- ).
21
- returns(T.type_parameter(:U))
22
- }
23
- def fetch_typed(key, ta, *args); end
24
- end
25
-
26
- class ActionController::Parameters
27
- include SorbetRails::CustomParamsMethods
28
- end
@@ -1,42 +0,0 @@
1
- # typed: false
2
- require('sorbet-rails/deprecation.rb')
3
-
4
- module BooleanStringImpl
5
- def is_a?(type)
6
- return super unless type == BooleanString
7
- _is_a_boolean_string?
8
- end
9
-
10
- def kind_of?(type)
11
- return super unless type == BooleanString
12
- _is_a_boolean_string?
13
- end
14
-
15
- def instance_of?(type)
16
- return super unless type == BooleanString
17
- _is_a_boolean_string?
18
- end
19
-
20
- def _is_a_boolean_string?
21
- return @cached_is_a unless @cached_is_a.nil?
22
- SorbetRails::TypeAssertDeprecation.deprecation_warning(
23
- :BooleanString,
24
- 'Use TypedParam with T::Boolean type instead.'
25
- )
26
- @cached_is_a = (self =~ /^(true|false)$/i) == 0
27
- end
28
- end
29
-
30
- class String
31
- include BooleanStringImpl
32
- end
33
-
34
- class BooleanString < String
35
- def self.===(other)
36
- SorbetRails::TypeAssertDeprecation.deprecation_warning(
37
- :BooleanString,
38
- 'Use TypedParam with T::Boolean type instead.'
39
- )
40
- other.is_a?(BooleanString)
41
- end
42
- end
@@ -1,45 +0,0 @@
1
- # typed: false
2
- require('sorbet-rails/deprecation.rb')
3
-
4
- module IntegerStringImpl
5
- def is_a?(type)
6
- return super unless type == IntegerString
7
- _is_a_integer_string?
8
- end
9
-
10
- def kind_of?(type)
11
- return super unless type == IntegerString
12
- _is_a_integer_string?
13
- end
14
-
15
- def instance_of?(type)
16
- return super unless type == IntegerString
17
- _is_a_integer_string?
18
- end
19
-
20
- def _is_a_integer_string?
21
- return @cached_is_a unless @cached_is_a.nil?
22
- SorbetRails::TypeAssertDeprecation.deprecation_warning(
23
- :IntegerString,
24
- 'Use TypedParams with Integer type instead.'
25
- )
26
- Integer(self, 10)
27
- @cached_is_a = true
28
- rescue ArgumentError => err
29
- @cached_is_a = false
30
- end
31
- end
32
-
33
- class String
34
- include IntegerStringImpl
35
- end
36
-
37
- class IntegerString < String
38
- def self.===(other)
39
- SorbetRails::TypeAssertDeprecation.deprecation_warning(
40
- :IntegerString,
41
- 'Use TypedParams with Integer type instead.'
42
- )
43
- other.is_a?(IntegerString)
44
- end
45
- end
@@ -1,57 +0,0 @@
1
- # typed: false
2
- require 'sorbet-runtime'
3
- require('sorbet-rails/deprecation.rb')
4
-
5
- module SorbetRails::CustomParamsMethods
6
- include Kernel
7
- extend T::Sig
8
- extend T::Helpers
9
-
10
- # methods exists on ActionController::Parameter
11
- # def require(key); super; end
12
- # def fetch(key, *args); super; end
13
-
14
- sig {
15
- type_parameters(:U).
16
- params(key: Symbol, ta: ITypeAssert[T.type_parameter(:U)]).
17
- returns(T.type_parameter(:U))
18
- }
19
- def require_typed(key, ta)
20
- SorbetRails::TypeAssertDeprecation.deprecation_warning(
21
- :require_typed,
22
- 'Use TypedParams with a T::Struct represents the type of each parameters.'
23
- )
24
-
25
- val = require(key)
26
- ta.assert(val)
27
- rescue TypeError
28
- raise ActionController::BadRequest.new(
29
- "Expected parameter #{key} to be an instance of type #{ta.get_type}, got `#{val}`"
30
- )
31
- end
32
-
33
- # Note: when default value is a hash, it'll be converted into an ActionController::Parameters
34
- sig {
35
- type_parameters(:U).
36
- params(
37
- key: Symbol,
38
- ta: ITypeAssert[T.type_parameter(:U)],
39
- args: T.untyped,
40
- ).
41
- returns(T.type_parameter(:U))
42
- }
43
- def fetch_typed(key, ta, *args)
44
- SorbetRails::TypeAssertDeprecation.deprecation_warning(
45
- :fetch_typed,
46
- 'Use TypedParams with a T::Struct represents the type of each parameters.'
47
- )
48
-
49
- val = fetch(key, *args)
50
- ta.assert(val)
51
- rescue TypeError
52
- raise ActionController::BadRequest.new(
53
- "Expected parameter #{key} to be an instance of type T.nilable(#{ta.get_type}),
54
- got `#{val}`".squish!
55
- )
56
- end
57
- end