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
@@ -10,6 +10,7 @@
10
10
  # Ignore the default SQLite database.
11
11
  /db/*.sqlite3
12
12
  /db/*.sqlite3-journal
13
+ /db/*.sqlite3-*
13
14
 
14
15
  # Ignore all logfiles and tempfiles.
15
16
  /log/*
@@ -17,6 +18,11 @@
17
18
  !/log/.keep
18
19
  !/tmp/.keep
19
20
 
21
+ # Ignore pidfiles, but keep the directory.
22
+ /tmp/pids/*
23
+ !/tmp/pids/
24
+ !/tmp/pids/.keep
25
+
20
26
  # Ignore uploaded files in development.
21
27
  /storage/*
22
28
  !/storage/.keep
@@ -4,11 +4,11 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
4
4
  ruby '2.5.5'
5
5
 
6
6
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
7
- gem 'rails', '~> 6.0.0'
7
+ gem 'rails', '~> 6.0.3'
8
8
  # Use sqlite3 as the database for Active Record
9
9
  gem 'sqlite3', '~> 1.4'
10
10
  # Use Puma as the app server
11
- gem 'puma', '~> 3.11'
11
+ gem 'puma', '~> 4.1'
12
12
  # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
13
13
  gem 'jbuilder', '~> 2.7'
14
14
  # Use Active Model has_secure_password
@@ -32,4 +32,4 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
32
32
 
33
33
  gem 'sorbet-rails', path: '../../../.'
34
34
  gem 'sorbet'
35
- gem 'sorbet-runtime'
35
+ gem 'sorbet-runtime'
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: ../../..
3
3
  specs:
4
- sorbet-rails (0.6.5)
4
+ sorbet-rails (0.7.3)
5
5
  method_source (>= 0.9.2)
6
- parlour (~> 2.0)
6
+ parlour (>= 4.0.1)
7
7
  parser (>= 2.7)
8
8
  sorbet-coerce (>= 0.2.6)
9
9
  sorbet-runtime (>= 0.5)
@@ -11,65 +11,65 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actioncable (6.0.2.2)
15
- actionpack (= 6.0.2.2)
14
+ actioncable (6.0.3.2)
15
+ actionpack (= 6.0.3.2)
16
16
  nio4r (~> 2.0)
17
17
  websocket-driver (>= 0.6.1)
18
- actionmailbox (6.0.2.2)
19
- actionpack (= 6.0.2.2)
20
- activejob (= 6.0.2.2)
21
- activerecord (= 6.0.2.2)
22
- activestorage (= 6.0.2.2)
23
- activesupport (= 6.0.2.2)
18
+ actionmailbox (6.0.3.2)
19
+ actionpack (= 6.0.3.2)
20
+ activejob (= 6.0.3.2)
21
+ activerecord (= 6.0.3.2)
22
+ activestorage (= 6.0.3.2)
23
+ activesupport (= 6.0.3.2)
24
24
  mail (>= 2.7.1)
25
- actionmailer (6.0.2.2)
26
- actionpack (= 6.0.2.2)
27
- actionview (= 6.0.2.2)
28
- activejob (= 6.0.2.2)
25
+ actionmailer (6.0.3.2)
26
+ actionpack (= 6.0.3.2)
27
+ actionview (= 6.0.3.2)
28
+ activejob (= 6.0.3.2)
29
29
  mail (~> 2.5, >= 2.5.4)
30
30
  rails-dom-testing (~> 2.0)
31
- actionpack (6.0.2.2)
32
- actionview (= 6.0.2.2)
33
- activesupport (= 6.0.2.2)
31
+ actionpack (6.0.3.2)
32
+ actionview (= 6.0.3.2)
33
+ activesupport (= 6.0.3.2)
34
34
  rack (~> 2.0, >= 2.0.8)
35
35
  rack-test (>= 0.6.3)
36
36
  rails-dom-testing (~> 2.0)
37
37
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
38
- actiontext (6.0.2.2)
39
- actionpack (= 6.0.2.2)
40
- activerecord (= 6.0.2.2)
41
- activestorage (= 6.0.2.2)
42
- activesupport (= 6.0.2.2)
38
+ actiontext (6.0.3.2)
39
+ actionpack (= 6.0.3.2)
40
+ activerecord (= 6.0.3.2)
41
+ activestorage (= 6.0.3.2)
42
+ activesupport (= 6.0.3.2)
43
43
  nokogiri (>= 1.8.5)
44
- actionview (6.0.2.2)
45
- activesupport (= 6.0.2.2)
44
+ actionview (6.0.3.2)
45
+ activesupport (= 6.0.3.2)
46
46
  builder (~> 3.1)
47
47
  erubi (~> 1.4)
48
48
  rails-dom-testing (~> 2.0)
49
49
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
50
- activejob (6.0.2.2)
51
- activesupport (= 6.0.2.2)
50
+ activejob (6.0.3.2)
51
+ activesupport (= 6.0.3.2)
52
52
  globalid (>= 0.3.6)
53
- activemodel (6.0.2.2)
54
- activesupport (= 6.0.2.2)
55
- activerecord (6.0.2.2)
56
- activemodel (= 6.0.2.2)
57
- activesupport (= 6.0.2.2)
58
- activestorage (6.0.2.2)
59
- actionpack (= 6.0.2.2)
60
- activejob (= 6.0.2.2)
61
- activerecord (= 6.0.2.2)
53
+ activemodel (6.0.3.2)
54
+ activesupport (= 6.0.3.2)
55
+ activerecord (6.0.3.2)
56
+ activemodel (= 6.0.3.2)
57
+ activesupport (= 6.0.3.2)
58
+ activestorage (6.0.3.2)
59
+ actionpack (= 6.0.3.2)
60
+ activejob (= 6.0.3.2)
61
+ activerecord (= 6.0.3.2)
62
62
  marcel (~> 0.3.1)
63
- activesupport (6.0.2.2)
63
+ activesupport (6.0.3.2)
64
64
  concurrent-ruby (~> 1.0, >= 1.0.2)
65
65
  i18n (>= 0.7, < 2)
66
66
  minitest (~> 5.1)
67
67
  tzinfo (~> 1.1)
68
- zeitwerk (~> 2.2)
69
- ast (2.4.0)
68
+ zeitwerk (~> 2.2, >= 2.2.2)
69
+ ast (2.4.1)
70
70
  bindex (0.8.1)
71
71
  builder (3.2.4)
72
- byebug (11.1.1)
72
+ byebug (11.1.3)
73
73
  commander (4.5.2)
74
74
  highline (~> 2.0.0)
75
75
  concurrent-ruby (1.1.6)
@@ -78,11 +78,11 @@ GEM
78
78
  globalid (0.4.2)
79
79
  activesupport (>= 4.2.0)
80
80
  highline (2.0.3)
81
- i18n (1.8.2)
81
+ i18n (1.8.3)
82
82
  concurrent-ruby (~> 1.0)
83
83
  jbuilder (2.10.0)
84
84
  activesupport (>= 5.0.0)
85
- loofah (2.4.0)
85
+ loofah (2.6.0)
86
86
  crass (~> 1.0.2)
87
87
  nokogiri (>= 1.5.9)
88
88
  mail (2.7.1)
@@ -90,64 +90,65 @@ GEM
90
90
  marcel (0.3.3)
91
91
  mimemagic (~> 0.3.2)
92
92
  method_source (1.0.0)
93
- mimemagic (0.3.4)
93
+ mimemagic (0.3.5)
94
94
  mini_mime (1.0.2)
95
95
  mini_portile2 (2.4.0)
96
- minitest (5.14.0)
96
+ minitest (5.14.1)
97
97
  nio4r (2.5.2)
98
- nokogiri (1.10.9)
98
+ nokogiri (1.10.10)
99
99
  mini_portile2 (~> 2.4.0)
100
- parlour (2.1.0)
100
+ parlour (5.0.0)
101
101
  commander (~> 4.5)
102
102
  parser
103
103
  rainbow (~> 3.0)
104
104
  sorbet-runtime (>= 0.5)
105
- parser (2.7.1.2)
106
- ast (~> 2.4.0)
107
- polyfill (1.8.0)
108
- puma (3.12.4)
109
- rack (2.2.2)
105
+ parser (3.0.0.0)
106
+ ast (~> 2.4.1)
107
+ polyfill (1.9.0)
108
+ puma (4.3.5)
109
+ nio4r (~> 2.0)
110
+ rack (2.2.3)
110
111
  rack-test (1.1.0)
111
112
  rack (>= 1.0, < 3)
112
- rails (6.0.2.2)
113
- actioncable (= 6.0.2.2)
114
- actionmailbox (= 6.0.2.2)
115
- actionmailer (= 6.0.2.2)
116
- actionpack (= 6.0.2.2)
117
- actiontext (= 6.0.2.2)
118
- actionview (= 6.0.2.2)
119
- activejob (= 6.0.2.2)
120
- activemodel (= 6.0.2.2)
121
- activerecord (= 6.0.2.2)
122
- activestorage (= 6.0.2.2)
123
- activesupport (= 6.0.2.2)
113
+ rails (6.0.3.2)
114
+ actioncable (= 6.0.3.2)
115
+ actionmailbox (= 6.0.3.2)
116
+ actionmailer (= 6.0.3.2)
117
+ actionpack (= 6.0.3.2)
118
+ actiontext (= 6.0.3.2)
119
+ actionview (= 6.0.3.2)
120
+ activejob (= 6.0.3.2)
121
+ activemodel (= 6.0.3.2)
122
+ activerecord (= 6.0.3.2)
123
+ activestorage (= 6.0.3.2)
124
+ activesupport (= 6.0.3.2)
124
125
  bundler (>= 1.3.0)
125
- railties (= 6.0.2.2)
126
+ railties (= 6.0.3.2)
126
127
  sprockets-rails (>= 2.0.0)
127
128
  rails-dom-testing (2.0.3)
128
129
  activesupport (>= 4.2.0)
129
130
  nokogiri (>= 1.6)
130
131
  rails-html-sanitizer (1.3.0)
131
132
  loofah (~> 2.3)
132
- railties (6.0.2.2)
133
- actionpack (= 6.0.2.2)
134
- activesupport (= 6.0.2.2)
133
+ railties (6.0.3.2)
134
+ actionpack (= 6.0.3.2)
135
+ activesupport (= 6.0.3.2)
135
136
  method_source
136
137
  rake (>= 0.8.7)
137
138
  thor (>= 0.20.3, < 2.0)
138
139
  rainbow (3.0.0)
139
140
  rake (13.0.1)
140
141
  safe_type (1.1.1)
141
- sorbet (0.5.5480)
142
- sorbet-static (= 0.5.5480)
143
- sorbet-coerce (0.2.7)
142
+ sorbet (0.5.5815)
143
+ sorbet-static (= 0.5.5815)
144
+ sorbet-coerce (0.3.0)
144
145
  polyfill (~> 1.8)
145
146
  safe_type (~> 1.1, >= 1.1.1)
146
147
  sorbet (>= 0.4.4704)
147
148
  sorbet-runtime (>= 0.4.4704)
148
- sorbet-runtime (0.5.5480)
149
- sorbet-static (0.5.5480-universal-darwin-14)
150
- sprockets (4.0.0)
149
+ sorbet-runtime (0.5.5815)
150
+ sorbet-static (0.5.5815-universal-darwin-19)
151
+ sprockets (4.0.2)
151
152
  concurrent-ruby (~> 1.0)
152
153
  rack (> 1, < 3)
153
154
  sprockets-rails (3.2.1)
@@ -157,26 +158,27 @@ GEM
157
158
  sqlite3 (1.4.2)
158
159
  thor (1.0.1)
159
160
  thread_safe (0.3.6)
160
- tzinfo (1.2.6)
161
+ tzinfo (1.2.7)
161
162
  thread_safe (~> 0.1)
162
- web-console (4.0.1)
163
+ web-console (4.0.4)
163
164
  actionview (>= 6.0.0)
164
165
  activemodel (>= 6.0.0)
165
166
  bindex (>= 0.4.0)
166
167
  railties (>= 6.0.0)
167
- websocket-driver (0.7.1)
168
+ websocket-driver (0.7.3)
168
169
  websocket-extensions (>= 0.1.0)
169
- websocket-extensions (0.1.4)
170
- zeitwerk (2.3.0)
170
+ websocket-extensions (0.1.5)
171
+ zeitwerk (2.3.1)
171
172
 
172
173
  PLATFORMS
173
174
  ruby
175
+ x86_64-darwin-19
174
176
 
175
177
  DEPENDENCIES
176
178
  byebug
177
179
  jbuilder (~> 2.7)
178
- puma (~> 3.11)
179
- rails (~> 6.0.0)
180
+ puma (~> 4.1)
181
+ rails (~> 6.0.3)
180
182
  sorbet
181
183
  sorbet-rails!
182
184
  sorbet-runtime
@@ -188,4 +190,4 @@ RUBY VERSION
188
190
  ruby 2.5.5p157
189
191
 
190
192
  BUNDLED WITH
191
- 2.0.2
193
+ 2.2.0
@@ -47,6 +47,11 @@ class Wizard < ApplicationRecord
47
47
  blue: 2,
48
48
  }, _prefix: :color, _suffix: :eyes
49
49
 
50
+ serialize :owl_results, Hash
51
+ serialize :newt_subjects # no specific data type, uses the default YAML Object coder
52
+ serialize :pets, Array
53
+ serialize :patronus_characteristics, JSON
54
+
50
55
  has_one :wand
51
56
  has_many :spell_books
52
57
  # habtm which is optional at the db level
@@ -31,7 +31,7 @@ m = Module.new do
31
31
  bundler_version = a
32
32
  end
33
33
  next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
- bundler_version = $1 || ">= 0.a"
34
+ bundler_version = $1
35
35
  update_index = i
36
36
  end
37
37
  bundler_version
@@ -61,32 +61,41 @@ m = Module.new do
61
61
  end
62
62
 
63
63
  def bundler_version
64
- @bundler_version ||= begin
64
+ @bundler_version ||=
65
65
  env_var_version || cli_arg_version ||
66
- lockfile_version || "#{Gem::Requirement.default}.a"
67
- end
66
+ lockfile_version
67
+ end
68
+
69
+ def bundler_requirement
70
+ return "#{Gem::Requirement.default}.a" unless bundler_version
71
+
72
+ bundler_gem_version = Gem::Version.new(bundler_version)
73
+
74
+ requirement = bundler_gem_version.approximate_recommendation
75
+
76
+ return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
77
+
78
+ requirement += ".a" if bundler_gem_version.prerelease?
79
+
80
+ requirement
68
81
  end
69
82
 
70
83
  def load_bundler!
71
84
  ENV["BUNDLE_GEMFILE"] ||= gemfile
72
85
 
73
- # must dup string for RG < 1.8 compatibility
74
- activate_bundler(bundler_version.dup)
86
+ activate_bundler
75
87
  end
76
88
 
77
- def activate_bundler(bundler_version)
78
- if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
79
- bundler_version = "< 2"
80
- end
89
+ def activate_bundler
81
90
  gem_error = activation_error_handling do
82
- gem "bundler", bundler_version
91
+ gem "bundler", bundler_requirement
83
92
  end
84
93
  return if gem_error.nil?
85
94
  require_error = activation_error_handling do
86
95
  require "bundler/version"
87
96
  end
88
- return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
89
- warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
97
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
90
99
  exit 42
91
100
  end
92
101
 
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  Rails.application.configure do
3
3
  # Settings specified here will take precedence over those in config/application.rb.
4
4
 
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  Rails.application.configure do
3
3
  # Settings specified here will take precedence over those in config/application.rb.
4
4
 
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  # The test environment is used exclusively to run your application's
3
3
  # test suite. You never need to work with it otherwise. Remember that
4
4
  # your test database is "scratch space" for the test suite and is wiped
@@ -6,7 +6,7 @@
6
6
 
7
7
  Rails.application.configure do
8
8
  # Settings specified here will take precedence over those in config/application.rb.
9
-
9
+
10
10
  config.cache_classes = true
11
11
 
12
12
  # Do not eager load code on boot. This avoids loading your whole application
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  Rails.application.routes.draw do
3
3
  get 'test/index' => 'test#index'
4
4
  # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
@@ -0,0 +1,9 @@
1
+ # typed: true
2
+ class AddSerializedToWizards < ActiveRecord::Migration[6.0]
3
+ def change
4
+ add_column :wizards, :owl_results, :text # Hash
5
+ add_column :wizards, :newt_subjects, :text # generic
6
+ add_column :wizards, :pets, :text # Array
7
+ add_column :wizards, :patronus_characteristics, :text # serialized as JSON, but not a JSON column type
8
+ end
9
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 2019_06_20_000014) do
14
+ ActiveRecord::Schema.define(version: 2019_06_20_000015) do
15
15
 
16
16
  create_table "headmasters", force: :cascade do |t|
17
17
  t.integer "school_id"
@@ -89,6 +89,10 @@ ActiveRecord::Schema.define(version: 2019_06_20_000014) do
89
89
  t.integer "hair_length"
90
90
  t.string "type", default: "Wizard", null: false
91
91
  t.integer "school_id"
92
+ t.text "owl_results"
93
+ t.text "newt_subjects"
94
+ t.text "pets"
95
+ t.text "patronus_characteristics"
92
96
  end
93
97
 
94
98
  add_foreign_key "wizards", "schools"
@@ -64,7 +64,7 @@ T.assert_type!(Wizard.find_each, T::Enumerator[Wizard])
64
64
  Wizard.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
65
65
  T.assert_type!(Wizard.find_in_batches, T::Enumerator[T::Array[Wizard]])
66
66
  Wizard.in_batches { |w| T.assert_type!(w, Wizard::ActiveRecord_Relation) }
67
- T.assert_type!(Wizard.in_batches, T::Enumerable[Wizard::ActiveRecord_Relation])
67
+ T.assert_type!(Wizard.in_batches, ActiveRecord::Batches::BatchEnumerator)
68
68
  # T.assert_type!(Wizard.destroy_all, T::Array[Wizard]) # Ignored until we add support
69
69
  T.assert_type!(Wizard.any?, T::Boolean)
70
70
  T.assert_type!(Wizard.many?, T::Boolean)
@@ -305,6 +305,21 @@ T.assert_type!(Wizard::House::Hufflepuff, Wizard::House)
305
305
  T.assert_type!(Wizard::House::Ravenclaw, Wizard::House)
306
306
  T.assert_type!(Wizard::House::Slytherin, Wizard::House)
307
307
 
308
+ # Serialization
309
+ T.assert_type!(
310
+ wizard.owl_results,
311
+ T.nilable(T::Hash[T.untyped, T.untyped])
312
+ )
313
+ T.assert_type!(
314
+ wizard.newt_subjects,
315
+ T.nilable(T.any(T::Array[T.untyped], T::Boolean, Float, T::Hash[T.untyped, T.untyped], Integer, String))
316
+ )
317
+ T.assert_type!(
318
+ wizard.patronus_characteristics,
319
+ T.nilable(T.any(T::Array[T.untyped], T::Boolean, Float, T::Hash[String, T.untyped], Integer, String))
320
+ )
321
+ T.assert_type!(wizard.pets, T.nilable(T::Array[T.untyped]))
322
+
308
323
  # Mythical plugin
309
324
  T.assert_type!(Wand.mythicals, T::Array[Wand])
310
325
 
@@ -312,7 +327,10 @@ T.assert_type!(Wand.mythicals, T::Array[Wand])
312
327
  T.assert_type!(HogwartsAcceptanceMailer.notify(wizard), ActionMailer::MessageDelivery)
313
328
 
314
329
  # Jobs
315
- AwardHousePointHourglasses.perform_later(student: wizard, point: 10)
330
+ T.assert_type!(
331
+ AwardHousePointHourglasses.perform_later(student: wizard, point: 10),
332
+ AwardHousePointHourglasses
333
+ )
316
334
  AwardHousePointHourglasses.perform_now(student: wizard, point: 10)
317
335
  AwardHousePointHourglasses.
318
336
  set(queue: :daily, wait: 5.minutes).
@@ -321,7 +339,6 @@ AwardHousePointHourglasses.
321
339
  set(priority: 10, wait_until: Time.now.tomorrow).
322
340
  perform_later(student: wizard, point: 10)
323
341
 
324
-
325
342
  T.assert_type!(wizard.broom_nimbus?, T::Boolean)
326
343
  T.assert_type!(wizard.color_brown_eyes?, T::Boolean)
327
344
  T.assert_type!(wizard.quidditch_keeper?, T::Boolean)
@@ -361,44 +378,6 @@ params = ActionController::Parameters.new({
361
378
  typed_params = TypedParams[MyActionParams].new.extract!(params)
362
379
  T.assert_type!(typed_params, MyActionParams)
363
380
 
364
- # -- require_typed
365
- T.assert_type!(
366
- params.require_typed(:age, TA[Integer].new),
367
- Integer,
368
- )
369
- T.assert_type!(
370
- params.require_typed(:name, TA[String].new),
371
- String,
372
- )
373
- info = params.require_typed(:info, TA[ActionController::Parameters].new)
374
- T.assert_type!(info, ActionController::Parameters)
375
- T.assert_type!(
376
- info.require_typed(:friends, TA[T::Array[String]].new),
377
- T::Array[String],
378
- )
379
- # -- fetch_typed
380
- T.assert_type!(
381
- params.fetch_typed(:age, TA[Integer].new),
382
- Integer,
383
- )
384
- T.assert_type!(
385
- params.fetch_typed(:name, TA[String].new),
386
- String,
387
- )
388
- T.assert_type!(
389
- params.fetch_typed(:nonexistence, TA[String].new, ''),
390
- String,
391
- )
392
- T.assert_type!(
393
- params.fetch_typed(:nonexistence, TA[T.nilable(String)].new, nil),
394
- T.nilable(String),
395
- )
396
- T.assert_type!(
397
- params.fetch_typed(:nonexistence, TA[T::Array[Integer]].new, []),
398
- T::Array[Integer],
399
- )
400
-
401
-
402
381
  # -- pluck to tstruct
403
382
  class WizardStruct < T::Struct
404
383
  const :name, String
@@ -415,23 +394,16 @@ Wizard.all.pluck_to_tstruct(TA[WizardStruct].new).each do |row|
415
394
  T.assert_type!(row, WizardStruct)
416
395
  end
417
396
 
418
-
419
397
  # -- GeneratedUrlHelpers
420
398
  class TestHelper
421
399
  include GeneratedUrlHelpers
422
-
423
- # need to implement this for the url
424
- def default_url_options
425
- {
426
- protocol: 'http',
427
- host: 'localhost',
428
- port: 3000,
429
- }
430
- end
431
-
432
- def test_url_helper
433
- T.assert_type!(test_index_path, String)
434
- T.assert_type!(test_index_url, String)
435
- end
436
400
  end
437
- TestHelper.new.test_url_helper
401
+
402
+ T.assert_type!(TestHelper.new.test_index_path, String)
403
+ # need to set this config for _url methods
404
+ Rails.application.routes.default_url_options = {
405
+ protocol: 'http',
406
+ host: 'localhost',
407
+ port: 3000,
408
+ }
409
+ T.assert_type!(TestHelper.new.test_index_url, String)