sorbet-rails 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/lib/sorbet-rails/active_record_rbi_formatter.rb +8 -2
  4. data/lib/sorbet-rails/model_plugins/active_record_querying.rb +28 -1
  5. data/lib/sorbet-rails/model_plugins/active_storage_methods.rb +1 -1
  6. data/lib/sorbet-rails/model_utils.rb +1 -1
  7. data/sorbet-rails.gemspec +1 -1
  8. data/spec/generators/sorbet_test_cases.rb +16 -8
  9. data/spec/support/v5.0/Gemfile.lock +2 -2
  10. data/spec/support/v5.0/sorbet_test_cases.rb +16 -8
  11. data/spec/support/v5.1/Gemfile.lock +2 -2
  12. data/spec/support/v5.1/sorbet_test_cases.rb +16 -8
  13. data/spec/support/v5.2/Gemfile.lock +2 -2
  14. data/spec/support/v5.2/sorbet_test_cases.rb +16 -8
  15. data/spec/support/v6.0/Gemfile.lock +2 -2
  16. data/spec/support/v6.0/sorbet_test_cases.rb +16 -8
  17. data/spec/test_data/v5.0/expected_active_record_base.rbi +2 -2
  18. data/spec/test_data/v5.0/expected_active_record_relation.rbi +2 -2
  19. data/spec/test_data/v5.0/expected_headmaster.rbi +24 -0
  20. data/spec/test_data/v5.0/expected_internal_metadata.rbi +24 -0
  21. data/spec/test_data/v5.0/expected_potion.rbi +24 -0
  22. data/spec/test_data/v5.0/expected_robe.rbi +24 -0
  23. data/spec/test_data/v5.0/expected_schema_migration.rbi +24 -0
  24. data/spec/test_data/v5.0/expected_school.rbi +24 -0
  25. data/spec/test_data/v5.0/expected_spell.rbi +24 -0
  26. data/spec/test_data/v5.0/expected_spell/habtm_spell_books.rbi +24 -0
  27. data/spec/test_data/v5.0/expected_spell_book.rbi +24 -0
  28. data/spec/test_data/v5.0/expected_spell_book/habtm_spells.rbi +24 -0
  29. data/spec/test_data/v5.0/expected_squib.rbi +24 -0
  30. data/spec/test_data/v5.0/expected_subject.rbi +24 -0
  31. data/spec/test_data/v5.0/expected_subject/habtm_wizards.rbi +24 -0
  32. data/spec/test_data/v5.0/expected_wand.rbi +24 -0
  33. data/spec/test_data/v5.0/expected_wizard.rbi +24 -0
  34. data/spec/test_data/v5.0/expected_wizard/habtm_subjects.rbi +24 -0
  35. data/spec/test_data/v5.0/expected_wizard_wo_spellbook.rbi +24 -0
  36. data/spec/test_data/v5.1/expected_active_record_base.rbi +2 -2
  37. data/spec/test_data/v5.1/expected_active_record_relation.rbi +2 -2
  38. data/spec/test_data/v5.1/expected_headmaster.rbi +24 -0
  39. data/spec/test_data/v5.1/expected_internal_metadata.rbi +24 -0
  40. data/spec/test_data/v5.1/expected_potion.rbi +24 -0
  41. data/spec/test_data/v5.1/expected_robe.rbi +24 -0
  42. data/spec/test_data/v5.1/expected_schema_migration.rbi +24 -0
  43. data/spec/test_data/v5.1/expected_school.rbi +24 -0
  44. data/spec/test_data/v5.1/expected_spell.rbi +24 -0
  45. data/spec/test_data/v5.1/expected_spell/habtm_spell_books.rbi +24 -0
  46. data/spec/test_data/v5.1/expected_spell_book.rbi +24 -0
  47. data/spec/test_data/v5.1/expected_spell_book/habtm_spells.rbi +24 -0
  48. data/spec/test_data/v5.1/expected_squib.rbi +24 -0
  49. data/spec/test_data/v5.1/expected_subject.rbi +24 -0
  50. data/spec/test_data/v5.1/expected_subject/habtm_wizards.rbi +24 -0
  51. data/spec/test_data/v5.1/expected_wand.rbi +24 -0
  52. data/spec/test_data/v5.1/expected_wizard.rbi +24 -0
  53. data/spec/test_data/v5.1/expected_wizard/habtm_subjects.rbi +24 -0
  54. data/spec/test_data/v5.1/expected_wizard_wo_spellbook.rbi +24 -0
  55. data/spec/test_data/v5.2/expected_active_record_base.rbi +2 -2
  56. data/spec/test_data/v5.2/expected_active_record_relation.rbi +2 -2
  57. data/spec/test_data/v5.2/expected_attachment.rbi +24 -0
  58. data/spec/test_data/v5.2/expected_blob.rbi +24 -0
  59. data/spec/test_data/v5.2/expected_headmaster.rbi +24 -0
  60. data/spec/test_data/v5.2/expected_internal_metadata.rbi +24 -0
  61. data/spec/test_data/v5.2/expected_potion.rbi +24 -0
  62. data/spec/test_data/v5.2/expected_robe.rbi +24 -0
  63. data/spec/test_data/v5.2/expected_schema_migration.rbi +24 -0
  64. data/spec/test_data/v5.2/expected_school.rbi +24 -0
  65. data/spec/test_data/v5.2/expected_spell.rbi +24 -0
  66. data/spec/test_data/v5.2/expected_spell/habtm_spell_books.rbi +24 -0
  67. data/spec/test_data/v5.2/expected_spell_book.rbi +24 -0
  68. data/spec/test_data/v5.2/expected_spell_book/habtm_spells.rbi +24 -0
  69. data/spec/test_data/v5.2/expected_squib.rbi +24 -0
  70. data/spec/test_data/v5.2/expected_subject.rbi +24 -0
  71. data/spec/test_data/v5.2/expected_subject/habtm_wizards.rbi +24 -0
  72. data/spec/test_data/v5.2/expected_wand.rbi +24 -0
  73. data/spec/test_data/v5.2/expected_wizard.rbi +24 -0
  74. data/spec/test_data/v5.2/expected_wizard/habtm_subjects.rbi +24 -0
  75. data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +24 -0
  76. data/spec/test_data/v6.0/expected_active_record_base.rbi +2 -2
  77. data/spec/test_data/v6.0/expected_active_record_relation.rbi +10 -10
  78. data/spec/test_data/v6.0/expected_attachment.rbi +24 -0
  79. data/spec/test_data/v6.0/expected_blob.rbi +74 -38
  80. data/spec/test_data/v6.0/expected_headmaster.rbi +24 -0
  81. data/spec/test_data/v6.0/expected_internal_metadata.rbi +24 -0
  82. data/spec/test_data/v6.0/expected_potion.rbi +24 -0
  83. data/spec/test_data/v6.0/expected_robe.rbi +24 -0
  84. data/spec/test_data/v6.0/expected_routes.rbi +14 -7
  85. data/spec/test_data/v6.0/expected_schema_migration.rbi +24 -0
  86. data/spec/test_data/v6.0/expected_school.rbi +24 -0
  87. data/spec/test_data/v6.0/expected_spell.rbi +24 -0
  88. data/spec/test_data/v6.0/expected_spell/habtm_spell_books.rbi +24 -0
  89. data/spec/test_data/v6.0/expected_spell_book.rbi +119 -53
  90. data/spec/test_data/v6.0/expected_spell_book/habtm_spells.rbi +24 -0
  91. data/spec/test_data/v6.0/expected_squib.rbi +346 -100
  92. data/spec/test_data/v6.0/expected_subject.rbi +24 -0
  93. data/spec/test_data/v6.0/expected_subject/habtm_wizards.rbi +24 -0
  94. data/spec/test_data/v6.0/expected_wand.rbi +128 -56
  95. data/spec/test_data/v6.0/expected_wizard.rbi +346 -100
  96. data/spec/test_data/v6.0/expected_wizard/habtm_subjects.rbi +24 -0
  97. data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +346 -100
  98. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 662c7c86f998ffbbdef82e035c7d827ef8f3f4192c4829e4e6ecfaaa0c72a131
4
- data.tar.gz: 3eb66d37c008b8d8c3ae5b33fe8b645652dac7d2c047195e9773af743c2859c0
3
+ metadata.gz: c81291953020b0718bba6afbbd60cf3e1d5a54ea08a85298357d0b46302437e8
4
+ data.tar.gz: 5498a890ee281ddb68b3ca26e1656c5a48b2dddd9eee925383d5b5f90da7bdd5
5
5
  SHA512:
6
- metadata.gz: fd2212ba2d83e22a540540b71fd9c82e4ec67211c5577166bc99772b957ecb9d38fa2326dbeda9d2f03f399bdde73c542f148834cfe600d4f7b193f210427b74
7
- data.tar.gz: c639bb6d3b6785f0b945354d4e034ab48515473d91267d20518a69fe829550611764ce0071d383474e0a2cb1f05db04092276d5b238c2b10a85c3e9113d8839a
6
+ metadata.gz: f589fd032bea40225212f4375d93b07cea5ae5a5b1a743c763cd33b767458c552b50f88f11ff6fd3c391dc5ffd2f77ffcb08d34c5a27946d3ee9d5bbcd8fbffa
7
+ data.tar.gz: 06a31971aa26f770322cc0ee3700607ad0da700851ae24dd2424605420cfe0552bad8b504509fd887af91ecced25defcdf597bd965c68933fe22eb3daf2bc960
@@ -24,6 +24,8 @@ matrix:
24
24
  env: RAILS_VERSION=6.0
25
25
  allow_failures:
26
26
  - rvm: ruby-head
27
+ - rvm: 2.7
28
+ env: RAILS_VERSION=6.0
27
29
  before_install:
28
30
  - gem install bundler -v 2.0.1 --no-doc
29
31
  - gem install bundler -v 1.17.3 --no-doc
@@ -85,11 +85,18 @@ class SorbetRails::ActiveRecordRbiFormatter
85
85
  # parameters than the ones defined by `create_elem_specific_query_methods` so
86
86
  # we need to match the signatures in that conflicting rbi.
87
87
  build_methods = %w(new build create create!)
88
+ # This needs to match the generated method signature in activerecord.rbi and
89
+ # in Rails 5.0 and 5.1 the param is a splat.
90
+ if Rails.version =~ /^5\./
91
+ build_param = Parameter.new("*args", type: "T.untyped")
92
+ else
93
+ build_param = Parameter.new("attributes", type: "T.untyped", default: 'nil')
94
+ end
88
95
  build_methods.each do |build_method|
89
96
  class_rbi.create_method(
90
97
  build_method,
91
98
  parameters: [
92
- Parameter.new("*args", type: "T.untyped"),
99
+ build_param,
93
100
  Parameter.new(
94
101
  "&block",
95
102
  type: "T.nilable(T.proc.params(object: Elem).void)",
@@ -264,7 +271,6 @@ class SorbetRails::ActiveRecordRbiFormatter
264
271
  ],
265
272
  return_type: "T::Enumerator[#{inner_type}]",
266
273
  class_method: class_method,
267
- override: true,
268
274
  )
269
275
  end
270
276
  end
@@ -1,4 +1,4 @@
1
- # typed: strong
1
+ # typed: strict
2
2
  require ('sorbet-rails/model_plugins/base')
3
3
  class SorbetRails::ModelPlugins::ActiveRecordQuerying < SorbetRails::ModelPlugins::Base
4
4
 
@@ -49,5 +49,32 @@ class SorbetRails::ModelPlugins::ActiveRecordQuerying < SorbetRails::ModelPlugin
49
49
  ],
50
50
  builtin_query_method: true,
51
51
  )
52
+
53
+ # These are technically "query methods" but they aren't chainable so instead of
54
+ # adding conditionals to `add_relation_query_method` to handle this we'll just
55
+ # handle them here.
56
+ relation_module_rbi = root.create_module(self.model_query_methods_returning_relation_module_name)
57
+ create_in_batches_method(relation_module_rbi, inner_type: self.model_relation_class_name)
58
+
59
+ assoc_relation_module_rbi = root.create_module(self.model_query_methods_returning_assoc_relation_module_name)
60
+ create_in_batches_method(assoc_relation_module_rbi, inner_type: self.model_assoc_relation_class_name)
61
+ end
62
+
63
+ private
64
+
65
+ sig { params(root: Parlour::RbiGenerator::Namespace, inner_type: String).void }
66
+ def create_in_batches_method(root, inner_type:)
67
+ root.create_method(
68
+ "in_batches",
69
+ parameters: [
70
+ Parameter.new("of:", type: "T.nilable(Integer)", default: "1000"),
71
+ Parameter.new("start:", type: "T.nilable(Integer)", default: "nil"),
72
+ Parameter.new("finish:", type: "T.nilable(Integer)", default: "nil"),
73
+ Parameter.new("load:", type: "T.nilable(T::Boolean)", default: "false"),
74
+ Parameter.new("error_on_ignore:", type: "T.nilable(T::Boolean)", default: "nil"),
75
+ Parameter.new("&block", type: "T.nilable(T.proc.params(e: #{inner_type}).void)"),
76
+ ],
77
+ return_type: "T::Enumerable[#{inner_type}]",
78
+ )
52
79
  end
53
80
  end
@@ -52,7 +52,7 @@ class SorbetRails::ModelPlugins::ActiveStorageMethods < SorbetRails::ModelPlugin
52
52
  mod.create_method(
53
53
  "#{assoc_name}=",
54
54
  parameters: [
55
- Parameter.new('*attachables', type: 'T.untyped')
55
+ Parameter.new('attachables', type: 'T.untyped')
56
56
  ],
57
57
  return_type: 'T.untyped'
58
58
  )
@@ -106,7 +106,7 @@ module SorbetRails::ModelUtils
106
106
  # model. However, in Rails 5 query methods that come from scopes or enums
107
107
  # get overridden in hidden-definitions so we need to explicitly define them
108
108
  # on the model and relation classes.
109
- if builtin_query_method || Rails.version =~ /^6\./
109
+ if builtin_query_method
110
110
  relation_module_rbi = root.create_module(self.model_query_methods_returning_relation_module_name)
111
111
  relation_module_rbi.create_method(
112
112
  method_name,
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{sorbet-rails}
3
- s.version = "0.6.4"
3
+ s.version = "0.6.5"
4
4
  s.date = %q{2019-04-18}
5
5
  s.summary = %q{Set of tools to make Sorbet work with Rails seamlessly.}
6
6
  s.authors = ["Chan Zuckerberg Initiative"]
@@ -63,6 +63,8 @@ Wizard.find_each { |w| T.assert_type!(w, Wizard) }
63
63
  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
+ Wizard.in_batches { |w| T.assert_type!(w, Wizard::ActiveRecord_Relation) }
67
+ T.assert_type!(Wizard.in_batches, T::Enumerable[Wizard::ActiveRecord_Relation])
66
68
  # T.assert_type!(Wizard.destroy_all, T::Array[Wizard]) # Ignored until we add support
67
69
  T.assert_type!(Wizard.any?, T::Boolean)
68
70
  T.assert_type!(Wizard.many?, T::Boolean)
@@ -118,6 +120,8 @@ Wizard.all.find_each { |w| T.assert_type!(w, Wizard) }
118
120
  T.assert_type!(Wizard.all.find_each, T::Enumerator[Wizard])
119
121
  Wizard.all.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
120
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])
121
125
  # T.assert_type!(Wizard.all.destroy_all, T::Array[Wizard]) # Ignored until we add support
122
126
  T.assert_type!(Wizard.all.any?, T::Boolean)
123
127
  T.assert_type!(Wizard.all.many?, T::Boolean)
@@ -176,10 +180,12 @@ T.assert_type!(spell_books.create!(name: 'Fantastic Beasts') { |s| T.assert_type
176
180
  T.assert_type!(spell_books.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
177
181
  T.assert_type!(spell_books.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
178
182
  T.assert_type!(spell_books.first_or_initialize { |s| T.assert_type!(s, SpellBook) }, SpellBook)
179
- # spell_books.find_each { |s| T.assert_type!(s, SpellBook) } # TODO: Handle for Rails 6
180
- # T.assert_type!(spell_books.find_each, T::Enumerator[SpellBook]) # TODO: Handle for Rails 6
181
- # spell_books.find_in_batches { |s| T.assert_type!(s, T::Array[SpellBook]) } # TODO: Handle for Rails 6
182
- # T.assert_type!(spell_books.find_in_batches, T::Enumerator[T::Array[SpellBook]]) # TODO: Handle for Rails 6
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])
183
189
  # T.assert_type!(spell_books.destroy_all, T::Array[SpellBook]) # Ignored until we add support
184
190
  T.assert_type!(spell_books.any?, T::Boolean)
185
191
  T.assert_type!(spell_books.many?, T::Boolean)
@@ -246,10 +252,12 @@ T.assert_type!(spell_books_query.create!(name: 'Fantastic Beasts') { |s| T.asser
246
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
247
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
248
254
  T.assert_type!(spell_books_query.first_or_initialize { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
249
- # spell_books_query.find_each { |s| T.assert_type!(s, SpellBook) } # TODO: Handle for Rails 6
250
- # T.assert_type!(spell_books_query.find_each, T::Enumerator[SpellBook]) # TODO: Handle for Rails 6
251
- # spell_books_query.find_in_batches { |s| T.assert_type!(s, T::Array[SpellBook]) } # TODO: Handle for Rails 6
252
- # T.assert_type!(spell_books_query.find_in_batches, T::Enumerator[T::Array[SpellBook]]) # TODO: Handle for Rails 6
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])
253
261
  # T.assert_type!(spell_books_query.destroy_all, T::Array[SpellBook]) # Ignored until we add support
254
262
  T.assert_type!(spell_books_query.any?, T::Boolean)
255
263
  T.assert_type!(spell_books_query.many?, T::Boolean)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../..
3
3
  specs:
4
- sorbet-rails (0.6.4)
4
+ sorbet-rails (0.6.5)
5
5
  method_source (>= 0.9.2)
6
6
  parlour (~> 2.0)
7
7
  parser (>= 2.7)
@@ -116,7 +116,7 @@ GEM
116
116
  safe_type (1.1.1)
117
117
  sorbet (0.5.5480)
118
118
  sorbet-static (= 0.5.5480)
119
- sorbet-coerce (0.2.6)
119
+ sorbet-coerce (0.2.7)
120
120
  polyfill (~> 1.8)
121
121
  safe_type (~> 1.1, >= 1.1.1)
122
122
  sorbet (>= 0.4.4704)
@@ -63,6 +63,8 @@ Wizard.find_each { |w| T.assert_type!(w, Wizard) }
63
63
  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
+ Wizard.in_batches { |w| T.assert_type!(w, Wizard::ActiveRecord_Relation) }
67
+ T.assert_type!(Wizard.in_batches, T::Enumerable[Wizard::ActiveRecord_Relation])
66
68
  # T.assert_type!(Wizard.destroy_all, T::Array[Wizard]) # Ignored until we add support
67
69
  T.assert_type!(Wizard.any?, T::Boolean)
68
70
  T.assert_type!(Wizard.many?, T::Boolean)
@@ -118,6 +120,8 @@ Wizard.all.find_each { |w| T.assert_type!(w, Wizard) }
118
120
  T.assert_type!(Wizard.all.find_each, T::Enumerator[Wizard])
119
121
  Wizard.all.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
120
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])
121
125
  # T.assert_type!(Wizard.all.destroy_all, T::Array[Wizard]) # Ignored until we add support
122
126
  T.assert_type!(Wizard.all.any?, T::Boolean)
123
127
  T.assert_type!(Wizard.all.many?, T::Boolean)
@@ -176,10 +180,12 @@ T.assert_type!(spell_books.create!(name: 'Fantastic Beasts') { |s| T.assert_type
176
180
  T.assert_type!(spell_books.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
177
181
  T.assert_type!(spell_books.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
178
182
  T.assert_type!(spell_books.first_or_initialize { |s| T.assert_type!(s, SpellBook) }, SpellBook)
179
- # spell_books.find_each { |s| T.assert_type!(s, SpellBook) } # TODO: Handle for Rails 6
180
- # T.assert_type!(spell_books.find_each, T::Enumerator[SpellBook]) # TODO: Handle for Rails 6
181
- # spell_books.find_in_batches { |s| T.assert_type!(s, T::Array[SpellBook]) } # TODO: Handle for Rails 6
182
- # T.assert_type!(spell_books.find_in_batches, T::Enumerator[T::Array[SpellBook]]) # TODO: Handle for Rails 6
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])
183
189
  # T.assert_type!(spell_books.destroy_all, T::Array[SpellBook]) # Ignored until we add support
184
190
  T.assert_type!(spell_books.any?, T::Boolean)
185
191
  T.assert_type!(spell_books.many?, T::Boolean)
@@ -246,10 +252,12 @@ T.assert_type!(spell_books_query.create!(name: 'Fantastic Beasts') { |s| T.asser
246
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
247
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
248
254
  T.assert_type!(spell_books_query.first_or_initialize { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
249
- # spell_books_query.find_each { |s| T.assert_type!(s, SpellBook) } # TODO: Handle for Rails 6
250
- # T.assert_type!(spell_books_query.find_each, T::Enumerator[SpellBook]) # TODO: Handle for Rails 6
251
- # spell_books_query.find_in_batches { |s| T.assert_type!(s, T::Array[SpellBook]) } # TODO: Handle for Rails 6
252
- # T.assert_type!(spell_books_query.find_in_batches, T::Enumerator[T::Array[SpellBook]]) # TODO: Handle for Rails 6
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])
253
261
  # T.assert_type!(spell_books_query.destroy_all, T::Array[SpellBook]) # Ignored until we add support
254
262
  T.assert_type!(spell_books_query.any?, T::Boolean)
255
263
  T.assert_type!(spell_books_query.many?, T::Boolean)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../..
3
3
  specs:
4
- sorbet-rails (0.6.4)
4
+ sorbet-rails (0.6.5)
5
5
  method_source (>= 0.9.2)
6
6
  parlour (~> 2.0)
7
7
  parser (>= 2.7)
@@ -117,7 +117,7 @@ GEM
117
117
  safe_type (1.1.1)
118
118
  sorbet (0.5.5480)
119
119
  sorbet-static (= 0.5.5480)
120
- sorbet-coerce (0.2.6)
120
+ sorbet-coerce (0.2.7)
121
121
  polyfill (~> 1.8)
122
122
  safe_type (~> 1.1, >= 1.1.1)
123
123
  sorbet (>= 0.4.4704)
@@ -63,6 +63,8 @@ Wizard.find_each { |w| T.assert_type!(w, Wizard) }
63
63
  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
+ Wizard.in_batches { |w| T.assert_type!(w, Wizard::ActiveRecord_Relation) }
67
+ T.assert_type!(Wizard.in_batches, T::Enumerable[Wizard::ActiveRecord_Relation])
66
68
  # T.assert_type!(Wizard.destroy_all, T::Array[Wizard]) # Ignored until we add support
67
69
  T.assert_type!(Wizard.any?, T::Boolean)
68
70
  T.assert_type!(Wizard.many?, T::Boolean)
@@ -118,6 +120,8 @@ Wizard.all.find_each { |w| T.assert_type!(w, Wizard) }
118
120
  T.assert_type!(Wizard.all.find_each, T::Enumerator[Wizard])
119
121
  Wizard.all.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
120
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])
121
125
  # T.assert_type!(Wizard.all.destroy_all, T::Array[Wizard]) # Ignored until we add support
122
126
  T.assert_type!(Wizard.all.any?, T::Boolean)
123
127
  T.assert_type!(Wizard.all.many?, T::Boolean)
@@ -176,10 +180,12 @@ T.assert_type!(spell_books.create!(name: 'Fantastic Beasts') { |s| T.assert_type
176
180
  T.assert_type!(spell_books.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
177
181
  T.assert_type!(spell_books.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
178
182
  T.assert_type!(spell_books.first_or_initialize { |s| T.assert_type!(s, SpellBook) }, SpellBook)
179
- # spell_books.find_each { |s| T.assert_type!(s, SpellBook) } # TODO: Handle for Rails 6
180
- # T.assert_type!(spell_books.find_each, T::Enumerator[SpellBook]) # TODO: Handle for Rails 6
181
- # spell_books.find_in_batches { |s| T.assert_type!(s, T::Array[SpellBook]) } # TODO: Handle for Rails 6
182
- # T.assert_type!(spell_books.find_in_batches, T::Enumerator[T::Array[SpellBook]]) # TODO: Handle for Rails 6
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])
183
189
  # T.assert_type!(spell_books.destroy_all, T::Array[SpellBook]) # Ignored until we add support
184
190
  T.assert_type!(spell_books.any?, T::Boolean)
185
191
  T.assert_type!(spell_books.many?, T::Boolean)
@@ -246,10 +252,12 @@ T.assert_type!(spell_books_query.create!(name: 'Fantastic Beasts') { |s| T.asser
246
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
247
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
248
254
  T.assert_type!(spell_books_query.first_or_initialize { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
249
- # spell_books_query.find_each { |s| T.assert_type!(s, SpellBook) } # TODO: Handle for Rails 6
250
- # T.assert_type!(spell_books_query.find_each, T::Enumerator[SpellBook]) # TODO: Handle for Rails 6
251
- # spell_books_query.find_in_batches { |s| T.assert_type!(s, T::Array[SpellBook]) } # TODO: Handle for Rails 6
252
- # T.assert_type!(spell_books_query.find_in_batches, T::Enumerator[T::Array[SpellBook]]) # TODO: Handle for Rails 6
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])
253
261
  # T.assert_type!(spell_books_query.destroy_all, T::Array[SpellBook]) # Ignored until we add support
254
262
  T.assert_type!(spell_books_query.any?, T::Boolean)
255
263
  T.assert_type!(spell_books_query.many?, T::Boolean)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../..
3
3
  specs:
4
- sorbet-rails (0.6.4)
4
+ sorbet-rails (0.6.5)
5
5
  method_source (>= 0.9.2)
6
6
  parlour (~> 2.0)
7
7
  parser (>= 2.7)
@@ -125,7 +125,7 @@ GEM
125
125
  safe_type (1.1.1)
126
126
  sorbet (0.5.5480)
127
127
  sorbet-static (= 0.5.5480)
128
- sorbet-coerce (0.2.6)
128
+ sorbet-coerce (0.2.7)
129
129
  polyfill (~> 1.8)
130
130
  safe_type (~> 1.1, >= 1.1.1)
131
131
  sorbet (>= 0.4.4704)
@@ -63,6 +63,8 @@ Wizard.find_each { |w| T.assert_type!(w, Wizard) }
63
63
  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
+ Wizard.in_batches { |w| T.assert_type!(w, Wizard::ActiveRecord_Relation) }
67
+ T.assert_type!(Wizard.in_batches, T::Enumerable[Wizard::ActiveRecord_Relation])
66
68
  # T.assert_type!(Wizard.destroy_all, T::Array[Wizard]) # Ignored until we add support
67
69
  T.assert_type!(Wizard.any?, T::Boolean)
68
70
  T.assert_type!(Wizard.many?, T::Boolean)
@@ -118,6 +120,8 @@ Wizard.all.find_each { |w| T.assert_type!(w, Wizard) }
118
120
  T.assert_type!(Wizard.all.find_each, T::Enumerator[Wizard])
119
121
  Wizard.all.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
120
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])
121
125
  # T.assert_type!(Wizard.all.destroy_all, T::Array[Wizard]) # Ignored until we add support
122
126
  T.assert_type!(Wizard.all.any?, T::Boolean)
123
127
  T.assert_type!(Wizard.all.many?, T::Boolean)
@@ -176,10 +180,12 @@ T.assert_type!(spell_books.create!(name: 'Fantastic Beasts') { |s| T.assert_type
176
180
  T.assert_type!(spell_books.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
177
181
  T.assert_type!(spell_books.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
178
182
  T.assert_type!(spell_books.first_or_initialize { |s| T.assert_type!(s, SpellBook) }, SpellBook)
179
- # spell_books.find_each { |s| T.assert_type!(s, SpellBook) } # TODO: Handle for Rails 6
180
- # T.assert_type!(spell_books.find_each, T::Enumerator[SpellBook]) # TODO: Handle for Rails 6
181
- # spell_books.find_in_batches { |s| T.assert_type!(s, T::Array[SpellBook]) } # TODO: Handle for Rails 6
182
- # T.assert_type!(spell_books.find_in_batches, T::Enumerator[T::Array[SpellBook]]) # TODO: Handle for Rails 6
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])
183
189
  # T.assert_type!(spell_books.destroy_all, T::Array[SpellBook]) # Ignored until we add support
184
190
  T.assert_type!(spell_books.any?, T::Boolean)
185
191
  T.assert_type!(spell_books.many?, T::Boolean)
@@ -246,10 +252,12 @@ T.assert_type!(spell_books_query.create!(name: 'Fantastic Beasts') { |s| T.asser
246
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
247
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
248
254
  T.assert_type!(spell_books_query.first_or_initialize { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
249
- # spell_books_query.find_each { |s| T.assert_type!(s, SpellBook) } # TODO: Handle for Rails 6
250
- # T.assert_type!(spell_books_query.find_each, T::Enumerator[SpellBook]) # TODO: Handle for Rails 6
251
- # spell_books_query.find_in_batches { |s| T.assert_type!(s, T::Array[SpellBook]) } # TODO: Handle for Rails 6
252
- # T.assert_type!(spell_books_query.find_in_batches, T::Enumerator[T::Array[SpellBook]]) # TODO: Handle for Rails 6
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])
253
261
  # T.assert_type!(spell_books_query.destroy_all, T::Array[SpellBook]) # Ignored until we add support
254
262
  T.assert_type!(spell_books_query.any?, T::Boolean)
255
263
  T.assert_type!(spell_books_query.many?, T::Boolean)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../..
3
3
  specs:
4
- sorbet-rails (0.6.4)
4
+ sorbet-rails (0.6.5)
5
5
  method_source (>= 0.9.2)
6
6
  parlour (~> 2.0)
7
7
  parser (>= 2.7)
@@ -140,7 +140,7 @@ GEM
140
140
  safe_type (1.1.1)
141
141
  sorbet (0.5.5480)
142
142
  sorbet-static (= 0.5.5480)
143
- sorbet-coerce (0.2.6)
143
+ sorbet-coerce (0.2.7)
144
144
  polyfill (~> 1.8)
145
145
  safe_type (~> 1.1, >= 1.1.1)
146
146
  sorbet (>= 0.4.4704)
@@ -63,6 +63,8 @@ Wizard.find_each { |w| T.assert_type!(w, Wizard) }
63
63
  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
+ Wizard.in_batches { |w| T.assert_type!(w, Wizard::ActiveRecord_Relation) }
67
+ T.assert_type!(Wizard.in_batches, T::Enumerable[Wizard::ActiveRecord_Relation])
66
68
  # T.assert_type!(Wizard.destroy_all, T::Array[Wizard]) # Ignored until we add support
67
69
  T.assert_type!(Wizard.any?, T::Boolean)
68
70
  T.assert_type!(Wizard.many?, T::Boolean)
@@ -118,6 +120,8 @@ Wizard.all.find_each { |w| T.assert_type!(w, Wizard) }
118
120
  T.assert_type!(Wizard.all.find_each, T::Enumerator[Wizard])
119
121
  Wizard.all.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
120
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])
121
125
  # T.assert_type!(Wizard.all.destroy_all, T::Array[Wizard]) # Ignored until we add support
122
126
  T.assert_type!(Wizard.all.any?, T::Boolean)
123
127
  T.assert_type!(Wizard.all.many?, T::Boolean)
@@ -176,10 +180,12 @@ T.assert_type!(spell_books.create!(name: 'Fantastic Beasts') { |s| T.assert_type
176
180
  T.assert_type!(spell_books.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
177
181
  T.assert_type!(spell_books.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
178
182
  T.assert_type!(spell_books.first_or_initialize { |s| T.assert_type!(s, SpellBook) }, SpellBook)
179
- # spell_books.find_each { |s| T.assert_type!(s, SpellBook) } # TODO: Handle for Rails 6
180
- # T.assert_type!(spell_books.find_each, T::Enumerator[SpellBook]) # TODO: Handle for Rails 6
181
- # spell_books.find_in_batches { |s| T.assert_type!(s, T::Array[SpellBook]) } # TODO: Handle for Rails 6
182
- # T.assert_type!(spell_books.find_in_batches, T::Enumerator[T::Array[SpellBook]]) # TODO: Handle for Rails 6
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])
183
189
  # T.assert_type!(spell_books.destroy_all, T::Array[SpellBook]) # Ignored until we add support
184
190
  T.assert_type!(spell_books.any?, T::Boolean)
185
191
  T.assert_type!(spell_books.many?, T::Boolean)
@@ -246,10 +252,12 @@ T.assert_type!(spell_books_query.create!(name: 'Fantastic Beasts') { |s| T.asser
246
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
247
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
248
254
  T.assert_type!(spell_books_query.first_or_initialize { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
249
- # spell_books_query.find_each { |s| T.assert_type!(s, SpellBook) } # TODO: Handle for Rails 6
250
- # T.assert_type!(spell_books_query.find_each, T::Enumerator[SpellBook]) # TODO: Handle for Rails 6
251
- # spell_books_query.find_in_batches { |s| T.assert_type!(s, T::Array[SpellBook]) } # TODO: Handle for Rails 6
252
- # T.assert_type!(spell_books_query.find_in_batches, T::Enumerator[T::Array[SpellBook]]) # TODO: Handle for Rails 6
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])
253
261
  # T.assert_type!(spell_books_query.destroy_all, T::Array[SpellBook]) # Ignored until we add support
254
262
  T.assert_type!(spell_books_query.any?, T::Boolean)
255
263
  T.assert_type!(spell_books_query.many?, T::Boolean)
@@ -75,7 +75,7 @@ class ActiveRecord::Base
75
75
  def self.first_or_initialize(attributes = nil, &block); end
76
76
 
77
77
  sig do
78
- override.params(
78
+ params(
79
79
  start: T.nilable(Integer),
80
80
  finish: T.nilable(Integer),
81
81
  batch_size: T.nilable(Integer),
@@ -86,7 +86,7 @@ class ActiveRecord::Base
86
86
  def self.find_each(start: nil, finish: nil, batch_size: 1000, error_on_ignore: nil, &block); end
87
87
 
88
88
  sig do
89
- override.params(
89
+ params(
90
90
  start: T.nilable(Integer),
91
91
  finish: T.nilable(Integer),
92
92
  batch_size: T.nilable(Integer),