sorbet-rails 0.7.4 → 0.7.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (360) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +7 -0
  3. data/.github/workflows/ci-master.yml +28 -0
  4. data/.github/workflows/ci.yml +26 -0
  5. data/.github/workflows/publish-gem.yml +27 -0
  6. data/CONTRIBUTING.md +1 -2
  7. data/Gemfile +5 -9
  8. data/README.md +18 -4
  9. data/Rakefile +13 -24
  10. data/lib/sorbet-rails/active_record_rbi_formatter.rb +12 -9
  11. data/lib/sorbet-rails/dependent_gem_rbis/activerecord.rbi +4 -0
  12. data/lib/sorbet-rails/dependent_gem_rbis/parlour.rbi +1 -1
  13. data/lib/sorbet-rails/gem_plugins/aasm_plugin.rb +50 -0
  14. data/lib/sorbet-rails/gem_plugins/money_rails_plugin.rb +76 -0
  15. data/lib/sorbet-rails/job_rbi_formatter.rb +1 -1
  16. data/lib/sorbet-rails/model_plugins/active_record_querying.rb +25 -1
  17. data/lib/sorbet-rails/model_plugins/active_record_serialized_attribute.rb +3 -2
  18. data/lib/sorbet-rails/model_plugins/base.rb +8 -1
  19. data/lib/sorbet-rails/model_plugins/custom_finder_methods.rb +1 -1
  20. data/lib/sorbet-rails/model_plugins/plugins.rb +6 -0
  21. data/lib/sorbet-rails/model_utils.rb +14 -7
  22. data/lib/sorbet-rails/rails_mixins/custom_finder_methods.rb +4 -0
  23. data/lib/sorbet-rails/railtie.rb +1 -1
  24. data/lib/sorbet-rails/routes_rbi_formatter.rb +8 -0
  25. data/lib/sorbet-rails/tasks/rails_rbi.rake +12 -8
  26. data/sorbet-rails.gemspec +2 -2
  27. data/spec/bin/run_all_specs.sh +3 -4
  28. data/spec/bin/run_spec.sh +4 -1
  29. data/spec/generators/rails-template.rb +3 -20
  30. data/spec/generators/sorbet_test_cases.rb +26 -4
  31. data/spec/rails_helper.rb +5 -5
  32. data/spec/rake_rails_rbi_models_spec.rb +11 -4
  33. data/spec/sorbet_spec.rb +2 -1
  34. data/spec/support/v5.2/Gemfile +1 -3
  35. data/spec/support/v5.2/Gemfile.lock +66 -71
  36. data/spec/support/v5.2/app/controllers/application_controller.rb +1 -1
  37. data/spec/support/v5.2/app/mailers/application_mailer.rb +1 -1
  38. data/spec/support/v5.2/app/mailers/daily_prophet_mailer.rb +1 -1
  39. data/spec/support/v5.2/app/mailers/hogwarts_acceptance_mailer.rb +1 -1
  40. data/spec/support/v5.2/app/models/spell_book.rb +1 -1
  41. data/spec/support/v5.2/app/models/wand.rb +1 -1
  42. data/spec/support/v5.2/app/models/wizard.rb +1 -1
  43. data/spec/support/v5.2/config/environments/development.rb +1 -1
  44. data/spec/support/v5.2/config/environments/production.rb +1 -1
  45. data/spec/support/v5.2/config/environments/test.rb +1 -1
  46. data/spec/support/v5.2/config/routes.rb +1 -1
  47. data/spec/support/v5.2/sorbet_test_cases.rb +26 -4
  48. data/spec/support/v6.0/Gemfile +1 -1
  49. data/spec/support/v6.0/Gemfile.lock +81 -85
  50. data/spec/support/v6.0/app/mailers/application_mailer.rb +1 -1
  51. data/spec/support/v6.0/config/environments/development.rb +1 -1
  52. data/spec/support/v6.0/config/environments/test.rb +1 -1
  53. data/spec/support/v6.0/config/initializers/cookies_serializer.rb +1 -1
  54. data/spec/support/v6.0/config/initializers/sorbet_rails.rb +1 -1
  55. data/spec/support/v6.0/config/routes.rb +1 -1
  56. data/spec/support/v6.0/sorbet_test_cases.rb +26 -4
  57. data/spec/support/{v5.1 → v6.1}/.gitignore +13 -2
  58. data/spec/support/{v5.1 → v6.1}/Gemfile +12 -15
  59. data/spec/support/{v5.1 → v6.1}/Gemfile.lock +87 -59
  60. data/spec/support/{v5.0 → v6.1}/README.md +0 -0
  61. data/spec/support/{v5.0 → v6.1}/Rakefile +0 -0
  62. data/spec/support/{v5.0 → v6.1}/app/assets/config/manifest.js +0 -0
  63. data/spec/support/{v5.0 → v6.1}/app/assets/images/.keep +0 -0
  64. data/spec/support/{v5.1 → v6.1}/app/assets/stylesheets/application.css +0 -0
  65. data/spec/support/{v5.0 → v6.1}/app/controllers/application_controller.rb +1 -2
  66. data/spec/support/{v5.0 → v6.1}/app/controllers/concerns/.keep +0 -0
  67. data/spec/support/{v5.0 → v6.1}/app/helpers/application_helper.rb +0 -0
  68. data/spec/support/{v5.0 → v6.1}/app/helpers/bar_helper.rb +0 -0
  69. data/spec/support/{v5.0 → v6.1}/app/helpers/baz_helper.rb +0 -0
  70. data/spec/support/{v5.0 → v6.1}/app/helpers/foo_helper.rb +0 -0
  71. data/spec/support/v6.1/app/jobs/application_job.rb +8 -0
  72. data/spec/support/{v5.0 → v6.1}/app/jobs/award_house_point_hourglasses.rb +0 -0
  73. data/spec/support/{v5.1 → v6.1}/app/mailers/application_mailer.rb +1 -1
  74. data/spec/support/{v5.0 → v6.1}/app/mailers/daily_prophet_mailer.rb +0 -0
  75. data/spec/support/{v5.0 → v6.1}/app/mailers/hogwarts_acceptance_mailer.rb +0 -0
  76. data/spec/support/{v5.0 → v6.1}/app/models/application_record.rb +0 -0
  77. data/spec/support/{v5.0 → v6.1}/app/models/concerns/.keep +0 -0
  78. data/spec/support/{v5.0 → v6.1}/app/models/concerns/mythical.rb +0 -0
  79. data/spec/support/{v5.1 → v6.1}/app/models/headmaster.rb +1 -1
  80. data/spec/support/{v5.1 → v6.1}/app/models/potion.rb +0 -0
  81. data/spec/support/{v5.1 → v6.1}/app/models/robe.rb +0 -0
  82. data/spec/support/{v5.0 → v6.1}/app/models/school.rb +1 -1
  83. data/spec/support/{v5.1 → v6.1}/app/models/spell.rb +0 -0
  84. data/spec/support/{v5.0 → v6.1}/app/models/spell_book.rb +0 -0
  85. data/spec/support/{v5.0 → v6.1}/app/models/squib.rb +0 -0
  86. data/spec/support/{v5.1 → v6.1}/app/models/subject.rb +0 -0
  87. data/spec/support/{v5.0 → v6.1}/app/models/wand.rb +0 -0
  88. data/spec/support/{v5.0 → v6.1}/app/models/wizard.rb +2 -1
  89. data/spec/support/{v5.1 → v6.1}/app/views/layouts/application.html.erb +2 -1
  90. data/spec/support/{v5.0 → v6.1}/app/views/layouts/mailer.html.erb +0 -0
  91. data/spec/support/{v5.0 → v6.1}/app/views/layouts/mailer.text.erb +0 -0
  92. data/spec/support/v6.1/bin/bundle +114 -0
  93. data/spec/support/{v5.0 → v6.1}/bin/rails +0 -0
  94. data/spec/support/{v5.0 → v6.1}/bin/rake +0 -0
  95. data/spec/support/{v5.1 → v6.1}/bin/setup +6 -11
  96. data/spec/support/{v5.1 → v6.1}/config/application.rb +8 -4
  97. data/spec/support/{v5.0 → v6.1}/config/boot.rb +0 -0
  98. data/spec/support/{v5.1 → v6.1}/config/database.yml +1 -1
  99. data/spec/support/{v5.0 → v6.1}/config/environment.rb +0 -0
  100. data/spec/support/{v5.1 → v6.1}/config/environments/development.rb +12 -4
  101. data/spec/support/{v5.1 → v6.1}/config/environments/production.rb +29 -7
  102. data/spec/support/{v5.1 → v6.1}/config/environments/test.rb +13 -7
  103. data/spec/support/{v5.0 → v6.1}/config/initializers/application_controller_renderer.rb +0 -0
  104. data/spec/support/{v5.0 → v6.1}/config/initializers/backtrace_silencers.rb +0 -0
  105. data/spec/support/v6.1/config/initializers/content_security_policy.rb +29 -0
  106. data/spec/support/{v5.1 → v6.1}/config/initializers/cookies_serializer.rb +1 -1
  107. data/spec/support/{v5.0 → v6.1}/config/initializers/filter_parameter_logging.rb +0 -0
  108. data/spec/support/{v5.0 → v6.1}/config/initializers/inflections.rb +0 -0
  109. data/spec/support/{v5.0 → v6.1}/config/initializers/mime_types.rb +0 -0
  110. data/spec/support/{v5.0 → v6.1}/config/initializers/sorbet_rails.rb +1 -1
  111. data/spec/support/{v5.0 → v6.1}/config/initializers/wrap_parameters.rb +0 -0
  112. data/spec/support/{v5.1 → v6.1}/config/locales/en.yml +1 -1
  113. data/spec/support/{v5.1 → v6.1}/config/puma.rb +8 -26
  114. data/spec/support/v6.1/config/routes.rb +5 -0
  115. data/spec/support/v6.1/config/storage.yml +34 -0
  116. data/spec/support/{v5.0 → v6.1}/config.ru +0 -0
  117. data/spec/support/{v5.1 → v6.1}/db/migrate/20190620000001_create_wizards.rb +2 -2
  118. data/spec/support/{v5.1 → v6.1}/db/migrate/20190620000002_create_wands.rb +2 -2
  119. data/spec/support/{v5.1 → v6.1}/db/migrate/20190620000003_create_spell_books.rb +2 -2
  120. data/spec/support/{v5.1 → v6.1}/db/migrate/20190620000004_add_more_column_types_to_wands.rb +2 -2
  121. data/spec/support/v6.1/db/migrate/20190620000005_add_broom_to_wizard.rb +6 -0
  122. data/spec/support/{v5.1 → v6.1}/db/migrate/20190620000006_add_more_enums_to_wizard.rb +2 -2
  123. data/spec/support/{v5.1 → v6.1}/db/migrate/20190620000007_add_type_to_wizard.rb +2 -2
  124. data/spec/support/{v5.1 → v6.1}/db/migrate/20190620000008_add_robe_to_wizard.rb +2 -2
  125. data/spec/support/{v5.1 → v6.1}/db/migrate/20190620000009_add_school.rb +2 -2
  126. data/spec/support/{v5.1 → v6.1}/db/migrate/20190620000010_add_subject.rb +2 -2
  127. data/spec/support/{v5.1 → v6.1}/db/migrate/20190620000011_add_subjects_wizards.rb +2 -2
  128. data/spec/support/{v5.1 → v6.1}/db/migrate/20190620000012_add_spell.rb +2 -2
  129. data/spec/support/{v5.1 → v6.1}/db/migrate/20190620000013_add_spells_spell_books.rb +2 -2
  130. data/spec/support/{v5.0 → v6.1}/db/migrate/20190620000014_create_headmasters.rb +2 -2
  131. data/spec/support/{v5.0 → v6.1}/db/migrate/20190620000015_add_serialized_to_wizards.rb +2 -2
  132. data/spec/support/{v5.1 → v6.1}/db/schema.rb +14 -11
  133. data/spec/support/{v5.0 → v6.1}/db/seeds.rb +0 -0
  134. data/spec/support/{v5.0 → v6.1}/lib/assets/.keep +0 -0
  135. data/spec/support/{v5.0 → v6.1}/lib/mythical_rbi_plugin.rb +0 -0
  136. data/spec/support/{v5.0 → v6.1}/lib/tasks/.keep +0 -0
  137. data/spec/support/{v5.0 → v6.1}/log/.keep +0 -0
  138. data/spec/support/{v5.0 → v6.1}/sorbet_test_cases.rb +26 -4
  139. data/spec/support/{v5.0/tmp → v6.1/storage}/.keep +0 -0
  140. data/spec/support/{v5.0/vendor/assets/stylesheets → v6.1/tmp}/.keep +0 -0
  141. data/spec/support/{v5.1/app/assets/images → v6.1/tmp/pids}/.keep +0 -0
  142. data/spec/support/{v5.1/app/controllers/concerns → v6.1/vendor}/.keep +0 -0
  143. data/spec/test_data/v5.2/expected_active_record_base.rbi +10 -10
  144. data/spec/test_data/v5.2/expected_active_record_relation.rbi +10 -10
  145. data/spec/test_data/v5.2/expected_attachment.rbi +13 -7
  146. data/spec/test_data/v5.2/expected_blob.rbi +13 -7
  147. data/spec/test_data/v5.2/expected_headmaster.rbi +13 -7
  148. data/spec/test_data/v5.2/expected_internal_metadata.rbi +13 -7
  149. data/spec/test_data/v5.2/expected_potion.rbi +13 -7
  150. data/spec/test_data/v5.2/expected_robe.rbi +13 -7
  151. data/spec/test_data/v5.2/expected_routes.rbi +8 -0
  152. data/spec/test_data/v5.2/expected_schema_migration.rbi +13 -7
  153. data/spec/test_data/v5.2/expected_school.rbi +13 -7
  154. data/spec/test_data/v5.2/expected_spell/habtm_spell_books.rbi +13 -7
  155. data/spec/test_data/v5.2/expected_spell.rbi +13 -7
  156. data/spec/test_data/v5.2/expected_spell_book/habtm_spells.rbi +13 -7
  157. data/spec/test_data/v5.2/expected_spell_book.rbi +13 -7
  158. data/spec/test_data/v5.2/expected_squib.rbi +15 -9
  159. data/spec/test_data/v5.2/expected_subject/habtm_wizards.rbi +13 -7
  160. data/spec/test_data/v5.2/expected_subject.rbi +13 -7
  161. data/spec/test_data/v5.2/expected_wand.rbi +13 -7
  162. data/spec/test_data/v5.2/expected_wizard/habtm_subjects.rbi +13 -7
  163. data/spec/test_data/v5.2/expected_wizard.rbi +15 -9
  164. data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +15 -9
  165. data/spec/test_data/v6.0/expected_active_record_base.rbi +10 -10
  166. data/spec/test_data/v6.0/expected_active_record_relation.rbi +10 -10
  167. data/spec/test_data/v6.0/expected_attachment.rbi +13 -7
  168. data/spec/test_data/v6.0/expected_blob.rbi +13 -7
  169. data/spec/test_data/v6.0/expected_headmaster.rbi +13 -7
  170. data/spec/test_data/v6.0/expected_internal_metadata.rbi +13 -7
  171. data/spec/test_data/v6.0/expected_potion.rbi +13 -7
  172. data/spec/test_data/v6.0/expected_robe.rbi +13 -7
  173. data/spec/test_data/v6.0/expected_routes.rbi +8 -0
  174. data/spec/test_data/v6.0/expected_schema_migration.rbi +13 -7
  175. data/spec/test_data/v6.0/expected_school.rbi +13 -7
  176. data/spec/test_data/v6.0/expected_spell/habtm_spell_books.rbi +13 -7
  177. data/spec/test_data/v6.0/expected_spell.rbi +13 -7
  178. data/spec/test_data/v6.0/expected_spell_book/habtm_spells.rbi +13 -7
  179. data/spec/test_data/v6.0/expected_spell_book.rbi +13 -7
  180. data/spec/test_data/v6.0/expected_squib.rbi +15 -9
  181. data/spec/test_data/v6.0/expected_subject/habtm_wizards.rbi +13 -7
  182. data/spec/test_data/v6.0/expected_subject.rbi +13 -7
  183. data/spec/test_data/v6.0/expected_wand.rbi +13 -7
  184. data/spec/test_data/v6.0/expected_wizard/habtm_subjects.rbi +13 -7
  185. data/spec/test_data/v6.0/expected_wizard.rbi +15 -9
  186. data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +15 -9
  187. data/spec/test_data/{v5.1 → v6.1}/expected_active_record_base.rbi +16 -16
  188. data/spec/test_data/{v5.1 → v6.1}/expected_active_record_relation.rbi +26 -29
  189. data/spec/test_data/{v5.0 → v6.1}/expected_application_job.rbi +0 -0
  190. data/spec/test_data/{v5.0 → v6.1}/expected_application_mailer.rbi +0 -0
  191. data/spec/test_data/v6.1/expected_attachment.rbi +334 -0
  192. data/spec/test_data/{v5.0 → v6.1}/expected_award_house_point_hourglasses.rbi +0 -0
  193. data/spec/test_data/v6.1/expected_blob.rbi +382 -0
  194. data/spec/test_data/{v5.0 → v6.1}/expected_custom_application_job.rbi +0 -0
  195. data/spec/test_data/{v5.0 → v6.1}/expected_custom_application_mailer.rbi +0 -0
  196. data/spec/test_data/{v5.0 → v6.1}/expected_custom_award_house_point_hourglasses.rbi +0 -0
  197. data/spec/test_data/{v5.0 → v6.1}/expected_custom_daily_prophet_mailer.rbi +0 -0
  198. data/spec/test_data/{v5.0 → v6.1}/expected_custom_hogwarts_acceptance_mailer.rbi +0 -0
  199. data/spec/test_data/{v5.0 → v6.1}/expected_daily_prophet_mailer.rbi +0 -0
  200. data/spec/test_data/{v5.1 → v6.1}/expected_habtm_subjects.rbi +48 -0
  201. data/spec/test_data/{v5.1 → v6.1}/expected_habtm_wizards.rbi +48 -0
  202. data/spec/test_data/{v5.1 → v6.1}/expected_headmaster.rbi +33 -3
  203. data/spec/test_data/{v5.0 → v6.1}/expected_helpers.rbi +0 -0
  204. data/spec/test_data/{v5.0 → v6.1}/expected_helpers_with_application_and_devise_helpers.rbi +0 -0
  205. data/spec/test_data/{v5.0 → v6.1}/expected_hogwarts_acceptance_mailer.rbi +0 -0
  206. data/spec/test_data/{v5.1 → v6.1}/expected_internal_metadata.rbi +33 -3
  207. data/spec/test_data/{v5.0 → v6.1}/expected_no_routes.rbi +0 -0
  208. data/spec/test_data/{v5.1 → v6.1}/expected_potion.rbi +33 -3
  209. data/spec/test_data/v6.1/expected_record.rbi +295 -0
  210. data/spec/test_data/{v5.1 → v6.1}/expected_robe.rbi +33 -3
  211. data/spec/test_data/v6.1/expected_routes.rbi +175 -0
  212. data/spec/test_data/{v5.1 → v6.1}/expected_schema_migration.rbi +33 -3
  213. data/spec/test_data/{v5.1 → v6.1}/expected_school.rbi +33 -3
  214. data/spec/test_data/{v5.1 → v6.1}/expected_spell/habtm_spell_books.rbi +33 -3
  215. data/spec/test_data/{v5.1 → v6.1}/expected_spell.rbi +33 -3
  216. data/spec/test_data/{v5.1 → v6.1}/expected_spell_book/habtm_spell_books.rbi +48 -0
  217. data/spec/test_data/{v5.1 → v6.1}/expected_spell_book/habtm_spells.rbi +33 -3
  218. data/spec/test_data/{v5.1 → v6.1}/expected_spell_book.rbi +69 -3
  219. data/spec/test_data/{v5.1 → v6.1}/expected_squib.rbi +505 -61
  220. data/spec/test_data/{v5.0 → v6.1}/expected_srb_tc_output.txt +0 -0
  221. data/spec/test_data/{v5.1 → v6.1}/expected_subject/habtm_wizards.rbi +33 -3
  222. data/spec/test_data/{v5.1 → v6.1}/expected_subject.rbi +33 -3
  223. data/spec/test_data/v6.1/expected_variant_record.rbi +370 -0
  224. data/spec/test_data/{v5.1 → v6.1}/expected_wand.rbi +99 -3
  225. data/spec/test_data/{v5.1 → v6.1}/expected_wizard/habtm_subjects.rbi +33 -3
  226. data/spec/test_data/{v5.1 → v6.1}/expected_wizard.rbi +505 -61
  227. data/spec/test_data/{v5.1 → v6.1}/expected_wizard_wo_spellbook.rbi +499 -55
  228. metadata +266 -501
  229. data/.travis.yml +0 -42
  230. data/lib/sorbet-rails/type_assert/actionpack.rbi +0 -4
  231. data/spec/support/v5.0/.gitignore +0 -21
  232. data/spec/support/v5.0/Gemfile +0 -37
  233. data/spec/support/v5.0/Gemfile.lock +0 -161
  234. data/spec/support/v5.0/app/assets/stylesheets/application.css +0 -15
  235. data/spec/support/v5.0/app/jobs/application_job.rb +0 -3
  236. data/spec/support/v5.0/app/mailers/application_mailer.rb +0 -5
  237. data/spec/support/v5.0/app/models/headmaster.rb +0 -8
  238. data/spec/support/v5.0/app/models/potion.rb +0 -6
  239. data/spec/support/v5.0/app/models/robe.rb +0 -4
  240. data/spec/support/v5.0/app/models/spell.rb +0 -5
  241. data/spec/support/v5.0/app/models/subject.rb +0 -5
  242. data/spec/support/v5.0/app/views/layouts/application.html.erb +0 -13
  243. data/spec/support/v5.0/bin/bundle +0 -3
  244. data/spec/support/v5.0/bin/setup +0 -34
  245. data/spec/support/v5.0/bin/update +0 -29
  246. data/spec/support/v5.0/config/application.rb +0 -27
  247. data/spec/support/v5.0/config/database.yml +0 -25
  248. data/spec/support/v5.0/config/environments/development.rb +0 -48
  249. data/spec/support/v5.0/config/environments/production.rb +0 -75
  250. data/spec/support/v5.0/config/environments/test.rb +0 -43
  251. data/spec/support/v5.0/config/initializers/cookies_serializer.rb +0 -6
  252. data/spec/support/v5.0/config/initializers/new_framework_defaults.rb +0 -27
  253. data/spec/support/v5.0/config/initializers/session_store.rb +0 -4
  254. data/spec/support/v5.0/config/locales/en.yml +0 -23
  255. data/spec/support/v5.0/config/puma.rb +0 -48
  256. data/spec/support/v5.0/config/routes.rb +0 -5
  257. data/spec/support/v5.0/db/migrate/20190620000001_create_wizards.rb +0 -14
  258. data/spec/support/v5.0/db/migrate/20190620000002_create_wands.rb +0 -12
  259. data/spec/support/v5.0/db/migrate/20190620000003_create_spell_books.rb +0 -10
  260. data/spec/support/v5.0/db/migrate/20190620000004_add_more_column_types_to_wands.rb +0 -17
  261. data/spec/support/v5.0/db/migrate/20190620000005_add_broom_to_wizard.rb +0 -6
  262. data/spec/support/v5.0/db/migrate/20190620000006_add_more_enums_to_wizard.rb +0 -9
  263. data/spec/support/v5.0/db/migrate/20190620000007_add_type_to_wizard.rb +0 -6
  264. data/spec/support/v5.0/db/migrate/20190620000008_add_robe_to_wizard.rb +0 -8
  265. data/spec/support/v5.0/db/migrate/20190620000009_add_school.rb +0 -10
  266. data/spec/support/v5.0/db/migrate/20190620000010_add_subject.rb +0 -8
  267. data/spec/support/v5.0/db/migrate/20190620000011_add_subjects_wizards.rb +0 -8
  268. data/spec/support/v5.0/db/migrate/20190620000012_add_spell.rb +0 -8
  269. data/spec/support/v5.0/db/migrate/20190620000013_add_spells_spell_books.rb +0 -8
  270. data/spec/support/v5.0/db/schema.rb +0 -96
  271. data/spec/support/v5.0/public/robots.txt +0 -5
  272. data/spec/support/v5.1/README.md +0 -24
  273. data/spec/support/v5.1/Rakefile +0 -6
  274. data/spec/support/v5.1/app/assets/config/manifest.js +0 -2
  275. data/spec/support/v5.1/app/controllers/application_controller.rb +0 -4
  276. data/spec/support/v5.1/app/helpers/application_helper.rb +0 -3
  277. data/spec/support/v5.1/app/helpers/bar_helper.rb +0 -3
  278. data/spec/support/v5.1/app/helpers/baz_helper.rb +0 -3
  279. data/spec/support/v5.1/app/helpers/foo_helper.rb +0 -3
  280. data/spec/support/v5.1/app/jobs/application_job.rb +0 -3
  281. data/spec/support/v5.1/app/jobs/award_house_point_hourglasses.rb +0 -12
  282. data/spec/support/v5.1/app/mailers/daily_prophet_mailer.rb +0 -9
  283. data/spec/support/v5.1/app/mailers/hogwarts_acceptance_mailer.rb +0 -29
  284. data/spec/support/v5.1/app/models/application_record.rb +0 -4
  285. data/spec/support/v5.1/app/models/concerns/.keep +0 -0
  286. data/spec/support/v5.1/app/models/concerns/mythical.rb +0 -11
  287. data/spec/support/v5.1/app/models/school.rb +0 -5
  288. data/spec/support/v5.1/app/models/spell_book.rb +0 -18
  289. data/spec/support/v5.1/app/models/squib.rb +0 -6
  290. data/spec/support/v5.1/app/models/wand.rb +0 -19
  291. data/spec/support/v5.1/app/models/wizard.rb +0 -65
  292. data/spec/support/v5.1/app/views/layouts/mailer.html.erb +0 -13
  293. data/spec/support/v5.1/app/views/layouts/mailer.text.erb +0 -1
  294. data/spec/support/v5.1/bin/bundle +0 -3
  295. data/spec/support/v5.1/bin/rails +0 -4
  296. data/spec/support/v5.1/bin/rake +0 -4
  297. data/spec/support/v5.1/bin/update +0 -29
  298. data/spec/support/v5.1/bin/yarn +0 -11
  299. data/spec/support/v5.1/config/boot.rb +0 -4
  300. data/spec/support/v5.1/config/environment.rb +0 -6
  301. data/spec/support/v5.1/config/initializers/application_controller_renderer.rb +0 -9
  302. data/spec/support/v5.1/config/initializers/backtrace_silencers.rb +0 -8
  303. data/spec/support/v5.1/config/initializers/filter_parameter_logging.rb +0 -5
  304. data/spec/support/v5.1/config/initializers/inflections.rb +0 -17
  305. data/spec/support/v5.1/config/initializers/mime_types.rb +0 -5
  306. data/spec/support/v5.1/config/initializers/sorbet_rails.rb +0 -3
  307. data/spec/support/v5.1/config/initializers/wrap_parameters.rb +0 -15
  308. data/spec/support/v5.1/config/routes.rb +0 -5
  309. data/spec/support/v5.1/config.ru +0 -5
  310. data/spec/support/v5.1/db/migrate/20190620000005_add_broom_to_wizard.rb +0 -6
  311. data/spec/support/v5.1/db/migrate/20190620000014_create_headmasters.rb +0 -9
  312. data/spec/support/v5.1/db/migrate/20190620000015_add_serialized_to_wizards.rb +0 -9
  313. data/spec/support/v5.1/db/seeds.rb +0 -8
  314. data/spec/support/v5.1/lib/assets/.keep +0 -0
  315. data/spec/support/v5.1/lib/mythical_rbi_plugin.rb +0 -16
  316. data/spec/support/v5.1/lib/tasks/.keep +0 -0
  317. data/spec/support/v5.1/log/.keep +0 -0
  318. data/spec/support/v5.1/package.json +0 -5
  319. data/spec/support/v5.1/public/robots.txt +0 -1
  320. data/spec/support/v5.1/sorbet_test_cases.rb +0 -409
  321. data/spec/support/v5.1/tmp/.keep +0 -0
  322. data/spec/support/v5.1/vendor/.keep +0 -0
  323. data/spec/test_data/v5.0/expected_active_record_base.rbi +0 -113
  324. data/spec/test_data/v5.0/expected_active_record_relation.rbi +0 -198
  325. data/spec/test_data/v5.0/expected_habtm_subjects.rbi +0 -660
  326. data/spec/test_data/v5.0/expected_habtm_wizards.rbi +0 -660
  327. data/spec/test_data/v5.0/expected_headmaster.rbi +0 -328
  328. data/spec/test_data/v5.0/expected_internal_metadata.rbi +0 -298
  329. data/spec/test_data/v5.0/expected_potion.rbi +0 -280
  330. data/spec/test_data/v5.0/expected_robe.rbi +0 -301
  331. data/spec/test_data/v5.0/expected_routes.rbi +0 -27
  332. data/spec/test_data/v5.0/expected_schema_migration.rbi +0 -271
  333. data/spec/test_data/v5.0/expected_school.rbi +0 -301
  334. data/spec/test_data/v5.0/expected_spell/habtm_spell_books.rbi +0 -319
  335. data/spec/test_data/v5.0/expected_spell.rbi +0 -292
  336. data/spec/test_data/v5.0/expected_spell_book/habtm_spell_books.rbi +0 -637
  337. data/spec/test_data/v5.0/expected_spell_book/habtm_spells.rbi +0 -319
  338. data/spec/test_data/v5.0/expected_spell_book.rbi +0 -415
  339. data/spec/test_data/v5.0/expected_squib.rbi +0 -832
  340. data/spec/test_data/v5.0/expected_subject/habtm_wizards.rbi +0 -319
  341. data/spec/test_data/v5.0/expected_subject.rbi +0 -292
  342. data/spec/test_data/v5.0/expected_wand.rbi +0 -497
  343. data/spec/test_data/v5.0/expected_wizard/habtm_subjects.rbi +0 -319
  344. data/spec/test_data/v5.0/expected_wizard.rbi +0 -908
  345. data/spec/test_data/v5.0/expected_wizard_wo_spellbook.rbi +0 -902
  346. data/spec/test_data/v5.1/expected_application_job.rbi +0 -20
  347. data/spec/test_data/v5.1/expected_application_mailer.rbi +0 -5
  348. data/spec/test_data/v5.1/expected_award_house_point_hourglasses.rbi +0 -20
  349. data/spec/test_data/v5.1/expected_custom_application_job.rbi +0 -21
  350. data/spec/test_data/v5.1/expected_custom_application_mailer.rbi +0 -6
  351. data/spec/test_data/v5.1/expected_custom_award_house_point_hourglasses.rbi +0 -21
  352. data/spec/test_data/v5.1/expected_custom_daily_prophet_mailer.rbi +0 -8
  353. data/spec/test_data/v5.1/expected_custom_hogwarts_acceptance_mailer.rbi +0 -21
  354. data/spec/test_data/v5.1/expected_daily_prophet_mailer.rbi +0 -7
  355. data/spec/test_data/v5.1/expected_helpers.rbi +0 -27
  356. data/spec/test_data/v5.1/expected_helpers_with_application_and_devise_helpers.rbi +0 -34
  357. data/spec/test_data/v5.1/expected_hogwarts_acceptance_mailer.rbi +0 -20
  358. data/spec/test_data/v5.1/expected_no_routes.rbi +0 -4
  359. data/spec/test_data/v5.1/expected_routes.rbi +0 -27
  360. data/spec/test_data/v5.1/expected_srb_tc_output.txt +0 -1
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'pathname'
3
- require 'fileutils'
4
- include FileUtils
5
-
6
- # path to your application root.
7
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
-
9
- def system!(*args)
10
- system(*args) || abort("\n== Command #{args} failed ==")
11
- end
12
-
13
- chdir APP_ROOT do
14
- # This script is a way to update your development environment automatically.
15
- # Add necessary update steps to this file.
16
-
17
- puts '== Installing dependencies =='
18
- system! 'gem install bundler --conservative'
19
- system('bundle check') || system!('bundle install')
20
-
21
- puts "\n== Updating database =="
22
- system! 'bin/rails db:migrate'
23
-
24
- puts "\n== Removing old logs and tempfiles =="
25
- system! 'bin/rails log:clear tmp:clear'
26
-
27
- puts "\n== Restarting application server =="
28
- system! 'bin/rails restart'
29
- end
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
- VENDOR_PATH = File.expand_path('..', __dir__)
3
- Dir.chdir(VENDOR_PATH) do
4
- begin
5
- exec "yarnpkg #{ARGV.join(" ")}"
6
- rescue Errno::ENOENT
7
- $stderr.puts "Yarn executable was not detected in the system."
8
- $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9
- exit 1
10
- end
11
- end
@@ -1,4 +0,0 @@
1
- # typed: strict
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
-
4
- require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -1,6 +0,0 @@
1
- # typed: strict
2
- # Load the Rails application.
3
- require_relative 'application'
4
-
5
- # Initialize the Rails application.
6
- Rails.application.initialize!
@@ -1,9 +0,0 @@
1
- # typed: strong
2
- # Be sure to restart your server when you modify this file.
3
-
4
- # ActiveSupport::Reloader.to_prepare do
5
- # ApplicationController.renderer.defaults.merge!(
6
- # http_host: 'example.org',
7
- # https: false
8
- # )
9
- # end
@@ -1,8 +0,0 @@
1
- # typed: strong
2
- # Be sure to restart your server when you modify this file.
3
-
4
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
5
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
6
-
7
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
8
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,5 +0,0 @@
1
- # typed: strict
2
- # Be sure to restart your server when you modify this file.
3
-
4
- # Configure sensitive parameters which will be filtered from the log file.
5
- Rails.application.config.filter_parameters += [:password]
@@ -1,17 +0,0 @@
1
- # typed: strong
2
- # Be sure to restart your server when you modify this file.
3
-
4
- # Add new inflection rules using the following format. Inflections
5
- # are locale specific, and you may define rules for as many different
6
- # locales as you wish. All of these examples are active by default:
7
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
8
- # inflect.plural /^(ox)$/i, '\1en'
9
- # inflect.singular /^(ox)en/i, '\1'
10
- # inflect.irregular 'person', 'people'
11
- # inflect.uncountable %w( fish sheep )
12
- # end
13
-
14
- # These inflection rules are supported but not enabled by default:
15
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
16
- # inflect.acronym 'RESTful'
17
- # end
@@ -1,5 +0,0 @@
1
- # typed: strong
2
- # Be sure to restart your server when you modify this file.
3
-
4
- # Add new mime types for use in respond_to blocks:
5
- # Mime::Type.register "text/richtext", :rtf
@@ -1,3 +0,0 @@
1
- # typed: strict
2
- require(Rails.root.join('lib/mythical_rbi_plugin'))
3
- SorbetRails::ModelRbiFormatter.register_plugin(MythicalRbiPlugin)
@@ -1,15 +0,0 @@
1
- # typed: strict
2
- # Be sure to restart your server when you modify this file.
3
-
4
- # This file contains settings for ActionController::ParamsWrapper which
5
- # is enabled by default.
6
-
7
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
8
- ActiveSupport.on_load(:action_controller) do
9
- wrap_parameters format: [:json]
10
- end
11
-
12
- # To enable root element in JSON for ActiveRecord objects.
13
- # ActiveSupport.on_load(:active_record) do
14
- # self.include_root_in_json = true
15
- # end
@@ -1,5 +0,0 @@
1
- # typed: false
2
- Rails.application.routes.draw do
3
- get 'test/index' => 'test#index'
4
- # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
5
- end
@@ -1,5 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require_relative 'config/environment'
4
-
5
- run Rails.application
@@ -1,6 +0,0 @@
1
- # typed: false
2
- class AddBroomToWizard < ActiveRecord::Migration[5.1]
3
- def change
4
- add_column :wizards, :broom, :string
5
- end
6
- end
@@ -1,9 +0,0 @@
1
- # typed: false
2
- class CreateHeadmasters < ActiveRecord::Migration[5.1]
3
- def change
4
- create_table :headmasters do |t|
5
- t.references :school
6
- t.references :wizard
7
- end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- # typed: false
2
- class AddSerializedToWizards < ActiveRecord::Migration[5.1]
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
@@ -1,8 +0,0 @@
1
- # typed: strong
2
- # This file should contain all the record creation needed to seed the database with its default values.
3
- # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
4
- #
5
- # Examples:
6
- #
7
- # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
8
- # Character.create(name: 'Luke', movie: movies.first)
File without changes
@@ -1,16 +0,0 @@
1
- # typed: true
2
- class MythicalRbiPlugin < SorbetRails::ModelPlugins::Base
3
- def generate(root)
4
- return unless @model_class.include?(Mythical)
5
-
6
- model_class_rbi = root.create_class(self.model_class_name)
7
-
8
- # ActiveSupport::Concern class method will be inserted to the class
9
- # directly. We need to also put the sig in the model class rbi directly
10
- model_class_rbi.create_method(
11
- 'mythicals',
12
- class_method: true,
13
- return_type: "T::Array[#{model_class_name}]",
14
- )
15
- end
16
- end
File without changes
File without changes
@@ -1,5 +0,0 @@
1
- {
2
- "name": "v5_1",
3
- "private": true,
4
- "dependencies": {}
5
- }
@@ -1 +0,0 @@
1
- # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
@@ -1,409 +0,0 @@
1
- # typed: true
2
- require 'sorbet-runtime'
3
-
4
- wand = Wand.first!
5
- wizard = Wizard.first!
6
- T.assert_type!(wizard, Wizard)
7
-
8
- # -- model columns
9
- T.assert_type!(wizard.name, T.nilable(String))
10
-
11
- # -- time/date columns
12
- T.assert_type!(wizard.created_at, ActiveSupport::TimeWithZone)
13
- T.assert_type!(wand.broken_at, T.nilable(Time))
14
- T.assert_type!(wand.chosen_at_date, T.nilable(Date))
15
-
16
- # assert that TZ aware attributes are casted to TimeWithZone after assigning
17
- wizard.created_at = DateTime.now
18
- T.assert_type!(wizard.created_at, ActiveSupport::TimeWithZone)
19
-
20
- T.assert_type!(wand.chosen_at_time, T.nilable(ActiveSupport::TimeWithZone))
21
-
22
- # -- model associations
23
- T.assert_type!(wizard.wand, T.nilable(Wand))
24
- T.assert_type!(T.must(wizard.wand).wizard, Wizard)
25
-
26
- # need the exact type to works! they aren't subclass of each other
27
- # T.assert_type!(wizard.spell_books, SpellBook::ActiveRecord_Relation)
28
- # T.assert_type!(wizard.spell_books, SpellBook::ActiveRecord_AssociationRelation)
29
- T.assert_type!(wizard.spell_books, SpellBook::ActiveRecord_Associations_CollectionProxy)
30
- T.assert_type!(wizard.spell_book_ids, T::Array[Integer])
31
-
32
- # Finder methods -- Model
33
- T.assert_type!(Wizard.exists?(name: 'Test'), T::Boolean)
34
- T.assert_type!(Wizard.find(wizard.id), Wizard)
35
- T.assert_type!(Wizard.first!, Wizard)
36
- T.assert_type!(Wizard.first, T.nilable(Wizard))
37
- T.assert_type!(Wizard.second!, Wizard)
38
- T.assert_type!(Wizard.second, T.nilable(Wizard))
39
- T.assert_type!(Wizard.third!, Wizard)
40
- T.assert_type!(Wizard.third, T.nilable(Wizard))
41
- T.assert_type!(Wizard.third_to_last!, Wizard)
42
- T.assert_type!(Wizard.third_to_last, T.nilable(Wizard))
43
- T.assert_type!(Wizard.second_to_last!, Wizard)
44
- T.assert_type!(Wizard.second_to_last, T.nilable(Wizard))
45
- T.assert_type!(Wizard.last!, Wizard)
46
- T.assert_type!(Wizard.last, T.nilable(Wizard))
47
- T.assert_type!(Wizard.first_n(5), T::Array[Wizard])
48
- T.assert_type!(Wizard.last_n(5), T::Array[Wizard])
49
- T.assert_type!(Wizard.find_by(name: 'Harry Potter'), T.nilable(Wizard))
50
- T.assert_type!(Wizard.find_by!(name: 'Harry Potter'), Wizard)
51
- T.assert_type!(Wizard.find_by_id(wizard.id), T.nilable(Wizard))
52
- T.assert_type!(Wizard.find_by_id!(wizard.id), Wizard)
53
- T.assert_type!(Wizard.find_or_initialize_by(name: 'Harry Potter') { |w| T.assert_type!(w, Wizard) }, Wizard)
54
- T.assert_type!(Wizard.find_or_create_by(name: 'Harry Potter') { |w| T.assert_type!(w, Wizard) }, Wizard)
55
- T.assert_type!(Wizard.find_or_create_by!(name: 'Harry Potter') { |w| T.assert_type!(w, Wizard) }, Wizard)
56
- T.assert_type!(Wizard.new { |w| T.assert_type!(w, Wizard) }, Wizard)
57
- T.assert_type!(Wizard.create(name: 'Harry Potter') { |w| T.assert_type!(w, Wizard) }, Wizard)
58
- T.assert_type!(Wizard.create!(name: 'Harry Potter') { |w| T.assert_type!(w, Wizard) }, Wizard)
59
- T.assert_type!(Wizard.first_or_create(name: 'Harry Potter') { |w| T.assert_type!(w, Wizard) }, Wizard)
60
- T.assert_type!(Wizard.first_or_create!(name: 'Harry Potter') { |w| T.assert_type!(w, Wizard) }, Wizard)
61
- T.assert_type!(Wizard.first_or_initialize { |w| T.assert_type!(w, Wizard) }, Wizard)
62
- Wizard.find_each { |w| T.assert_type!(w, Wizard) }
63
- T.assert_type!(Wizard.find_each, T::Enumerator[Wizard])
64
- Wizard.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
65
- T.assert_type!(Wizard.find_in_batches, T::Enumerator[T::Array[Wizard]])
66
- Wizard.in_batches { |w| T.assert_type!(w, Wizard::ActiveRecord_Relation) }
67
- T.assert_type!(Wizard.in_batches, ActiveRecord::Batches::BatchEnumerator)
68
- # T.assert_type!(Wizard.destroy_all, T::Array[Wizard]) # Ignored until we add support
69
- T.assert_type!(Wizard.any?, T::Boolean)
70
- T.assert_type!(Wizard.many?, T::Boolean)
71
- T.assert_type!(Wizard.none?, T::Boolean)
72
- T.assert_type!(Wizard.one?, T::Boolean)
73
- # T.assert_type!(Wizard.update_all(name: 'Harry Potter'), Integer) # Ignored until we add support
74
- # T.assert_type!(Wizard.delete_all, Integer) # Ignored until we add support
75
- # Query methods
76
- T.assert_type!(Wizard.all, Wizard::ActiveRecord_Relation)
77
- T.assert_type!(Wizard.recent, Wizard::ActiveRecord_Relation) # Named scope
78
- T.assert_type!(Wizard.Gryffindor, Wizard::ActiveRecord_Relation) # Enum scope
79
- T.assert_type!(Wizard.Gryffindor.recent, Wizard::ActiveRecord_Relation)
80
- T.assert_type!(Wizard.Gryffindor.recent.unscoped, Wizard::ActiveRecord_Relation)
81
- T.assert_type!(Wizard.where(id: 1), Wizard::ActiveRecord_Relation)
82
- T.assert_type!(Wizard.where(id: 1).recent, Wizard::ActiveRecord_Relation)
83
- T.assert_type!(Wizard.where.not(id: 1), Wizard::ActiveRecord_Relation)
84
- T.assert_type!(Wizard.preload(:spell_books), Wizard::ActiveRecord_Relation)
85
- T.assert_type!(Wizard.eager_load(:spell_books), Wizard::ActiveRecord_Relation)
86
- T.assert_type!(Wizard.order(:id), Wizard::ActiveRecord_Relation)
87
-
88
- # Finder methods -- ActiveRecord::Relation
89
- T.assert_type!(Wizard.all.exists?(name: 'Harry Potter'), T::Boolean)
90
- T.assert_type!(Wizard.all.find(wizard.id), Wizard)
91
- T.assert_type!(Wizard.all.first!, Wizard)
92
- T.assert_type!(Wizard.all.first, T.nilable(Wizard))
93
- T.assert_type!(Wizard.all.second!, Wizard)
94
- T.assert_type!(Wizard.all.second, T.nilable(Wizard))
95
- T.assert_type!(Wizard.all.third!, Wizard)
96
- T.assert_type!(Wizard.all.third, T.nilable(Wizard))
97
- T.assert_type!(Wizard.all.third_to_last!, Wizard)
98
- T.assert_type!(Wizard.all.third_to_last, T.nilable(Wizard))
99
- T.assert_type!(Wizard.all.second_to_last!, Wizard)
100
- T.assert_type!(Wizard.all.second_to_last, T.nilable(Wizard))
101
- T.assert_type!(Wizard.all.last!, Wizard)
102
- T.assert_type!(Wizard.all.last, T.nilable(Wizard))
103
- T.assert_type!(Wizard.all.first_n(5), T::Array[Wizard])
104
- T.assert_type!(Wizard.all.last_n(5), T::Array[Wizard])
105
- T.assert_type!(Wizard.all.find_by(name: 'Harry Potter'), T.nilable(Wizard))
106
- T.assert_type!(Wizard.all.find_by!(name: 'Harry Potter'), Wizard)
107
- T.assert_type!(Wizard.all.find_by_id(wizard.id), T.nilable(Wizard))
108
- T.assert_type!(Wizard.all.find_by_id!(wizard.id), Wizard)
109
- T.assert_type!(Wizard.all.find_or_initialize_by(name: 'Harry Potter') { |w| T.assert_type!(w, Wizard) }, Wizard)
110
- T.assert_type!(Wizard.all.find_or_create_by(name: 'Harry Potter') { |w| T.assert_type!(w, Wizard) }, Wizard)
111
- T.assert_type!(Wizard.all.find_or_create_by!(name: 'Harry Potter') { |w| T.assert_type!(w, Wizard) }, Wizard)
112
- T.assert_type!(Wizard.all.new { |w| T.assert_type!(w, Wizard) }, Wizard)
113
- T.assert_type!(Wizard.all.build { |w| T.assert_type!(w, Wizard) }, Wizard)
114
- T.assert_type!(Wizard.all.create(name: 'Harry Potter') { |w| T.assert_type!(w, Wizard) }, Wizard)
115
- T.assert_type!(Wizard.all.create!(name: 'Harry Potter') { |w| T.assert_type!(w, Wizard) }, Wizard)
116
- T.assert_type!(Wizard.all.first_or_create(name: 'Harry Potter') { |w| T.assert_type!(w, Wizard) }, Wizard)
117
- T.assert_type!(Wizard.all.first_or_create!(name: 'Harry Potter') { |w| T.assert_type!(w, Wizard) }, Wizard)
118
- T.assert_type!(Wizard.all.first_or_initialize { |w| T.assert_type!(w, Wizard) }, Wizard)
119
- Wizard.all.find_each { |w| T.assert_type!(w, Wizard) }
120
- T.assert_type!(Wizard.all.find_each, T::Enumerator[Wizard])
121
- Wizard.all.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
122
- T.assert_type!(Wizard.all.find_in_batches, T::Enumerator[T::Array[Wizard]])
123
- Wizard.all.in_batches { |w| T.assert_type!(w, Wizard::ActiveRecord_Relation) }
124
- T.assert_type!(Wizard.all.in_batches, T::Enumerable[Wizard::ActiveRecord_Relation])
125
- # T.assert_type!(Wizard.all.destroy_all, T::Array[Wizard]) # Ignored until we add support
126
- T.assert_type!(Wizard.all.any?, T::Boolean)
127
- T.assert_type!(Wizard.all.many?, T::Boolean)
128
- T.assert_type!(Wizard.all.none?, T::Boolean)
129
- T.assert_type!(Wizard.all.one?, T::Boolean)
130
- # T.assert_type!(Wizard.all.update_all(name: 'Harry Potter'), Integer) # Ignored until we add support
131
- # T.assert_type!(Wizard.all.delete_all, Integer) # Ignored until we add support
132
- # Query methods
133
- T.assert_type!(Wizard.all.all, Wizard::ActiveRecord_Relation)
134
- T.assert_type!(Wizard.all.recent, Wizard::ActiveRecord_Relation) # Named scope
135
- T.assert_type!(Wizard.all.Gryffindor, Wizard::ActiveRecord_Relation) # Enum scope
136
- T.assert_type!(Wizard.all.Gryffindor.recent, Wizard::ActiveRecord_Relation)
137
- T.assert_type!(Wizard.all.Gryffindor.recent.unscoped, Wizard::ActiveRecord_Relation)
138
- T.assert_type!(Wizard.all.where(id: 1), Wizard::ActiveRecord_Relation)
139
- T.assert_type!(Wizard.all.where(id: 1).recent, Wizard::ActiveRecord_Relation)
140
- T.assert_type!(Wizard.all.where.not(id: 1), Wizard::ActiveRecord_Relation)
141
- T.assert_type!(Wizard.all.preload(:spell_books), Wizard::ActiveRecord_Relation)
142
- T.assert_type!(Wizard.all.eager_load(:spell_books), Wizard::ActiveRecord_Relation)
143
- T.assert_type!(Wizard.all.order(:id), Wizard::ActiveRecord_Relation)
144
- # Enumerable methods
145
- Wizard.all.each { |w| T.assert_type!(w, Wizard) }
146
- Wizard.all.map { |w| T.assert_type!(w, Wizard) }
147
- T.assert_type!(Wizard.all.to_a, T::Array[Wizard])
148
- T.assert_type!(Wizard.all.empty?, T::Boolean)
149
-
150
- # Finder methods -- CollectionProxy
151
- spell_book = wizard.spell_books.first!
152
- spell_books = wizard.spell_books
153
- T.assert_type!(spell_books.exists?(name: 'Fantastic Beasts'), T::Boolean)
154
- T.assert_type!(spell_books.find(spell_book.id), SpellBook)
155
- T.assert_type!(spell_books.first!, SpellBook)
156
- T.assert_type!(spell_books.first, T.nilable(SpellBook))
157
- T.assert_type!(spell_books.second!, SpellBook)
158
- T.assert_type!(spell_books.second, T.nilable(SpellBook))
159
- T.assert_type!(spell_books.third!, SpellBook)
160
- T.assert_type!(spell_books.third, T.nilable(SpellBook))
161
- T.assert_type!(spell_books.third_to_last!, SpellBook)
162
- T.assert_type!(spell_books.third_to_last, T.nilable(SpellBook))
163
- T.assert_type!(spell_books.second_to_last!, SpellBook)
164
- T.assert_type!(spell_books.second_to_last, T.nilable(SpellBook))
165
- T.assert_type!(spell_books.last!, SpellBook)
166
- T.assert_type!(spell_books.last, T.nilable(SpellBook))
167
- T.assert_type!(spell_books.first_n(5), T::Array[SpellBook])
168
- T.assert_type!(spell_books.last_n(5), T::Array[SpellBook])
169
- T.assert_type!(spell_books.find_by(name: 'Fantastic Beasts'), T.nilable(SpellBook))
170
- T.assert_type!(spell_books.find_by!(name: 'Fantastic Beasts'), SpellBook)
171
- T.assert_type!(spell_books.find_by_id(spell_book.id), T.nilable(SpellBook))
172
- T.assert_type!(spell_books.find_by_id!(spell_book.id), SpellBook)
173
- T.assert_type!(spell_books.find_or_initialize_by(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
174
- T.assert_type!(spell_books.find_or_create_by(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
175
- T.assert_type!(spell_books.find_or_create_by!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
176
- T.assert_type!(spell_books.new { |s| T.assert_type!(s, SpellBook) }, SpellBook)
177
- T.assert_type!(spell_books.build { |s| T.assert_type!(s, SpellBook) }, SpellBook)
178
- T.assert_type!(spell_books.create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
179
- T.assert_type!(spell_books.create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
180
- T.assert_type!(spell_books.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
181
- T.assert_type!(spell_books.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
182
- T.assert_type!(spell_books.first_or_initialize { |s| T.assert_type!(s, SpellBook) }, SpellBook)
183
- spell_books.find_each { |s| T.assert_type!(s, SpellBook) }
184
- T.assert_type!(spell_books.find_each, T::Enumerator[SpellBook])
185
- spell_books.find_in_batches { |s| T.assert_type!(s, T::Array[SpellBook]) }
186
- T.assert_type!(spell_books.find_in_batches, T::Enumerator[T::Array[SpellBook]])
187
- spell_books.in_batches { |s| T.assert_type!(s, SpellBook::ActiveRecord_AssociationRelation) }
188
- T.assert_type!(spell_books.in_batches, T::Enumerable[SpellBook::ActiveRecord_AssociationRelation])
189
- # T.assert_type!(spell_books.destroy_all, T::Array[SpellBook]) # Ignored until we add support
190
- T.assert_type!(spell_books.any?, T::Boolean)
191
- T.assert_type!(spell_books.many?, T::Boolean)
192
- T.assert_type!(spell_books.none?, T::Boolean)
193
- T.assert_type!(spell_books.one?, T::Boolean)
194
- # T.assert_type!(spell_books.update_all(name: 'Fantastic Beasts'), Integer) # Ignored until we add support
195
- # T.assert_type!(spell_books.delete_all, Integer) # Ignored until we add support
196
- # Query methods
197
- T.assert_type!(spell_books.all, SpellBook::ActiveRecord_AssociationRelation)
198
- T.assert_type!(spell_books.recent, SpellBook::ActiveRecord_AssociationRelation) # Named scope
199
- T.assert_type!(spell_books.unclassified, SpellBook::ActiveRecord_AssociationRelation) # Enum scope
200
- T.assert_type!(spell_books.unclassified.recent, SpellBook::ActiveRecord_AssociationRelation)
201
- T.assert_type!(spell_books.unclassified.recent.unscoped, SpellBook::ActiveRecord_Relation) # Turns back into relation
202
- T.assert_type!(spell_books.where(id: 1), SpellBook::ActiveRecord_AssociationRelation)
203
- T.assert_type!(spell_books.where(id: 1).recent, SpellBook::ActiveRecord_AssociationRelation)
204
- T.assert_type!(spell_books.where.not(id: 1), SpellBook::ActiveRecord_AssociationRelation)
205
- T.assert_type!(spell_books.preload(:wizard), SpellBook::ActiveRecord_AssociationRelation)
206
- T.assert_type!(spell_books.eager_load(:wizard), SpellBook::ActiveRecord_AssociationRelation)
207
- T.assert_type!(spell_books.order(:id), SpellBook::ActiveRecord_AssociationRelation)
208
- # Enumerable methods
209
- spell_books.each { |s| T.assert_type!(s, SpellBook) }
210
- spell_books.map { |s| T.assert_type!(s, SpellBook) }
211
- T.assert_type!(spell_books.to_a, T::Array[SpellBook])
212
- T.assert_type!(spell_books.empty?, T::Boolean)
213
- # Push methods
214
- T.assert_type!(spell_books << spell_book, SpellBook::ActiveRecord_Associations_CollectionProxy)
215
- T.assert_type!(spell_books << [spell_book], SpellBook::ActiveRecord_Associations_CollectionProxy)
216
- T.assert_type!(spell_books.append(spell_book), SpellBook::ActiveRecord_Associations_CollectionProxy)
217
- T.assert_type!(spell_books.append([spell_book]), SpellBook::ActiveRecord_Associations_CollectionProxy)
218
- T.assert_type!(spell_books.push(spell_book), SpellBook::ActiveRecord_Associations_CollectionProxy)
219
- T.assert_type!(spell_books.push([spell_book]), SpellBook::ActiveRecord_Associations_CollectionProxy)
220
- # T.assert_type!(spell_books.concat(spell_book), SpellBook::ActiveRecord_Associations_CollectionProxy) # TODO: In Rails 5.0 and 5.1 this actually returns T::Array
221
- # T.assert_type!(spell_books.concat([spell_book]), SpellBook::ActiveRecord_Associations_CollectionProxy) # TODO: In Rails 5.0 and 5.1 this actually returns T::Array
222
-
223
- # finder methods -- AssociationRelation
224
- spell_books_query = spell_books.where(wizard_id: wizard.id)
225
- T.assert_type!(spell_books_query.exists?(name: 'Fantastic Beasts'), T::Boolean)
226
- T.assert_type!(spell_books_query.find(spell_book.id), SpellBook)
227
- T.assert_type!(spell_books_query.first!, SpellBook)
228
- T.assert_type!(spell_books_query.first, T.nilable(SpellBook))
229
- T.assert_type!(spell_books_query.second!, SpellBook)
230
- T.assert_type!(spell_books_query.second, T.nilable(SpellBook))
231
- T.assert_type!(spell_books_query.third!, SpellBook)
232
- T.assert_type!(spell_books_query.third, T.nilable(SpellBook))
233
- T.assert_type!(spell_books_query.third_to_last!, SpellBook)
234
- T.assert_type!(spell_books_query.third_to_last, T.nilable(SpellBook))
235
- T.assert_type!(spell_books_query.second_to_last!, SpellBook)
236
- T.assert_type!(spell_books_query.second_to_last, T.nilable(SpellBook))
237
- T.assert_type!(spell_books_query.last!, SpellBook)
238
- T.assert_type!(spell_books_query.last, T.nilable(SpellBook))
239
- T.assert_type!(spell_books_query.first_n(5), T::Array[SpellBook])
240
- T.assert_type!(spell_books_query.last_n(5), T::Array[SpellBook])
241
- T.assert_type!(spell_books_query.find_by(name: 'Fantastic Beasts'), T.nilable(SpellBook))
242
- T.assert_type!(spell_books_query.find_by!(name: 'Fantastic Beasts'), SpellBook)
243
- T.assert_type!(spell_books_query.find_by_id(spell_book.id), T.nilable(SpellBook))
244
- T.assert_type!(spell_books_query.find_by_id!(spell_book.id), SpellBook)
245
- T.assert_type!(spell_books_query.find_or_initialize_by(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
246
- T.assert_type!(spell_books_query.find_or_create_by(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
247
- T.assert_type!(spell_books_query.find_or_create_by!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
248
- T.assert_type!(spell_books_query.new { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
249
- T.assert_type!(spell_books_query.build { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support # Ignored until we add support
250
- T.assert_type!(spell_books_query.create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
251
- T.assert_type!(spell_books_query.create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
252
- T.assert_type!(spell_books_query.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
253
- T.assert_type!(spell_books_query.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
254
- T.assert_type!(spell_books_query.first_or_initialize { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
255
- spell_books_query.find_each { |s| T.assert_type!(s, SpellBook) }
256
- T.assert_type!(spell_books_query.find_each, T::Enumerator[SpellBook])
257
- spell_books_query.find_in_batches { |s| T.assert_type!(s, T::Array[SpellBook]) }
258
- T.assert_type!(spell_books_query.find_in_batches, T::Enumerator[T::Array[SpellBook]])
259
- spell_books_query.in_batches { |s| T.assert_type!(s, SpellBook::ActiveRecord_AssociationRelation) }
260
- T.assert_type!(spell_books_query.in_batches, T::Enumerable[SpellBook::ActiveRecord_AssociationRelation])
261
- # T.assert_type!(spell_books_query.destroy_all, T::Array[SpellBook]) # Ignored until we add support
262
- T.assert_type!(spell_books_query.any?, T::Boolean)
263
- T.assert_type!(spell_books_query.many?, T::Boolean)
264
- T.assert_type!(spell_books_query.none?, T::Boolean)
265
- T.assert_type!(spell_books_query.one?, T::Boolean)
266
- # T.assert_type!(spell_books_query.update_all(name: 'Fantastic Beasts'), Integer) # Ignored until we add support
267
- # T.assert_type!(spell_books_query.delete_all, Integer) # Ignored until we add support
268
- # Query methods
269
- T.assert_type!(spell_books_query.all, SpellBook::ActiveRecord_AssociationRelation)
270
- T.assert_type!(spell_books_query.recent, SpellBook::ActiveRecord_AssociationRelation) # Named scope
271
- T.assert_type!(spell_books_query.unclassified, SpellBook::ActiveRecord_AssociationRelation) # Enum scope
272
- T.assert_type!(spell_books_query.unclassified.recent, SpellBook::ActiveRecord_AssociationRelation)
273
- T.assert_type!(spell_books_query.unclassified.recent.unscoped, SpellBook::ActiveRecord_Relation) # Turns back into relation
274
- T.assert_type!(spell_books_query.where(id: 1), SpellBook::ActiveRecord_AssociationRelation)
275
- T.assert_type!(spell_books_query.where(id: 1).recent, SpellBook::ActiveRecord_AssociationRelation)
276
- T.assert_type!(spell_books_query.where.not(id: 1), SpellBook::ActiveRecord_AssociationRelation)
277
- T.assert_type!(spell_books_query.preload(:wizard), SpellBook::ActiveRecord_AssociationRelation)
278
- T.assert_type!(spell_books_query.eager_load(:wizard), SpellBook::ActiveRecord_AssociationRelation)
279
- T.assert_type!(spell_books_query.order(:id), SpellBook::ActiveRecord_AssociationRelation)
280
- # Enumerable methods
281
- spell_books_query.each { |s| T.assert_type!(s, SpellBook) }
282
- spell_books_query.map { |s| T.assert_type!(s, SpellBook) }
283
- T.assert_type!(spell_books_query.to_a, T::Array[SpellBook])
284
- T.assert_type!(spell_books_query.empty?, T::Boolean)
285
-
286
- # Model columns
287
- T.assert_type!(wizard.id, Integer)
288
- T.assert_type!(wizard.id?, T::Boolean)
289
- T.assert_type!(wizard.notes, T.nilable(String))
290
-
291
- # Model enum
292
- T.assert_type!(wizard.Gryffindor?, T::Boolean)
293
- T.assert_type!(Wizard.houses, T::Hash[T.any(String, Symbol), Integer])
294
- T.assert_type!(Wizard.brooms, T::Hash[T.any(String, Symbol), String])
295
- T.assert_type!(spell_book.biology?, T::Boolean)
296
- T.assert_type!(spell_book.book_type, String)
297
- T.assert_type!(SpellBook.book_types, T::Hash[T.any(String, Symbol), Integer])
298
- # Model T::Enum
299
- T.assert_type!(wizard.typed_house, T.nilable(Wizard::House))
300
- T.assert_type!(wizard.typed_broom, T.nilable(Wizard::Broom))
301
- T.assert_type!(wizard.typed_quidditch_position, T.nilable(Wizard::QuidditchPosition))
302
- T.assert_type!(Wizard::House, T.class_of(T::Enum))
303
- T.assert_type!(Wizard::House::Gryffindor, Wizard::House)
304
- T.assert_type!(Wizard::House::Hufflepuff, Wizard::House)
305
- T.assert_type!(Wizard::House::Ravenclaw, Wizard::House)
306
- T.assert_type!(Wizard::House::Slytherin, Wizard::House)
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
-
323
- # Mythical plugin
324
- T.assert_type!(Wand.mythicals, T::Array[Wand])
325
-
326
- # Mailers
327
- T.assert_type!(HogwartsAcceptanceMailer.notify(wizard), ActionMailer::MessageDelivery)
328
-
329
- # Jobs
330
- T.assert_type!(
331
- AwardHousePointHourglasses.perform_later(student: wizard, point: 10),
332
- AwardHousePointHourglasses
333
- )
334
- AwardHousePointHourglasses.perform_now(student: wizard, point: 10)
335
- AwardHousePointHourglasses.
336
- set(queue: :daily, wait: 5.minutes).
337
- perform_later(student: wizard, point: 10)
338
- AwardHousePointHourglasses.
339
- set(priority: 10, wait_until: Time.now.tomorrow).
340
- perform_later(student: wizard, point: 10)
341
-
342
- T.assert_type!(wizard.broom_nimbus?, T::Boolean)
343
- T.assert_type!(wizard.color_brown_eyes?, T::Boolean)
344
- T.assert_type!(wizard.quidditch_keeper?, T::Boolean)
345
- T.assert_type!(wizard.brown_hair?, T::Boolean)
346
-
347
- # Relations
348
- T.assert_type!(wizard.spell_books.any?, T::Boolean)
349
- T.assert_type!(wizard.spell_books.none?, T::Boolean)
350
- T.assert_type!(wizard.spell_books.one?, T::Boolean)
351
-
352
- # -- Custom ActionController::Parameters Methods
353
- class MyActionParams < T::Struct
354
- class Info < T::Struct
355
- const :birthday, Date
356
- const :friends, T::Array[String]
357
- const :grandson, T.nilable(String)
358
- end
359
-
360
- const :age, Integer
361
- const :name, String
362
- const :info, Info
363
- end
364
-
365
- params = ActionController::Parameters.new({
366
- age: 11,
367
- name: 'Harry Potter',
368
- info: {
369
- birthday: Date.parse('1980-07-31'),
370
- friends: [
371
- 'Hermione',
372
- 'Ron',
373
- ],
374
- grandson: nil,
375
- },
376
- })
377
-
378
- typed_params = TypedParams[MyActionParams].new.extract!(params)
379
- T.assert_type!(typed_params, MyActionParams)
380
-
381
- # -- pluck to tstruct
382
- class WizardStruct < T::Struct
383
- const :name, String
384
- const :house, T.nilable(String)
385
- end
386
-
387
- T.assert_type!(Wizard.pluck_to_tstruct(TA[WizardStruct].new), T::Array[WizardStruct])
388
- T.assert_type!(Wizard.all.pluck_to_tstruct(TA[WizardStruct].new), T::Array[WizardStruct])
389
-
390
- Wizard.pluck_to_tstruct(TA[WizardStruct].new).each do |row|
391
- T.assert_type!(row, WizardStruct)
392
- end
393
- Wizard.all.pluck_to_tstruct(TA[WizardStruct].new).each do |row|
394
- T.assert_type!(row, WizardStruct)
395
- end
396
-
397
- # -- GeneratedUrlHelpers
398
- class TestHelper
399
- include GeneratedUrlHelpers
400
- end
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)
File without changes
File without changes