Skip to content
This repository was archived by the owner on Jul 5, 2023. It is now read-only.

Commit 60a81a9

Browse files
authored
Type in_batches (#326)
* Uncomment assertions for find_each * Add sig for in_batches * Remove override from find_each, find_in_batches * Regenerate RBI
1 parent 6285cd7 commit 60a81a9

File tree

87 files changed

+1852
-58
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1852
-58
lines changed

lib/sorbet-rails/active_record_rbi_formatter.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ def create_elem_specific_query_methods(class_rbi, type:, class_method:)
271271
],
272272
return_type: "T::Enumerator[#{inner_type}]",
273273
class_method: class_method,
274-
override: true,
275274
)
276275
end
277276
end

lib/sorbet-rails/model_plugins/active_record_querying.rb

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# typed: strong
1+
# typed: strict
22
require ('sorbet-rails/model_plugins/base')
33
class SorbetRails::ModelPlugins::ActiveRecordQuerying < SorbetRails::ModelPlugins::Base
44

@@ -49,5 +49,32 @@ def generate(root)
4949
],
5050
builtin_query_method: true,
5151
)
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+
)
5279
end
5380
end

spec/generators/sorbet_test_cases.rb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
T.assert_type!(Wizard.find_each, T::Enumerator[Wizard])
6464
Wizard.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
6565
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])
6668
# T.assert_type!(Wizard.destroy_all, T::Array[Wizard]) # Ignored until we add support
6769
T.assert_type!(Wizard.any?, T::Boolean)
6870
T.assert_type!(Wizard.many?, T::Boolean)
@@ -118,6 +120,8 @@
118120
T.assert_type!(Wizard.all.find_each, T::Enumerator[Wizard])
119121
Wizard.all.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
120122
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])
121125
# T.assert_type!(Wizard.all.destroy_all, T::Array[Wizard]) # Ignored until we add support
122126
T.assert_type!(Wizard.all.any?, T::Boolean)
123127
T.assert_type!(Wizard.all.many?, T::Boolean)
@@ -176,10 +180,12 @@
176180
T.assert_type!(spell_books.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
177181
T.assert_type!(spell_books.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
178182
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])
183189
# T.assert_type!(spell_books.destroy_all, T::Array[SpellBook]) # Ignored until we add support
184190
T.assert_type!(spell_books.any?, T::Boolean)
185191
T.assert_type!(spell_books.many?, T::Boolean)
@@ -246,10 +252,12 @@
246252
T.assert_type!(spell_books_query.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
247253
T.assert_type!(spell_books_query.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
248254
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])
253261
# T.assert_type!(spell_books_query.destroy_all, T::Array[SpellBook]) # Ignored until we add support
254262
T.assert_type!(spell_books_query.any?, T::Boolean)
255263
T.assert_type!(spell_books_query.many?, T::Boolean)

spec/support/v5.0/sorbet_test_cases.rb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
T.assert_type!(Wizard.find_each, T::Enumerator[Wizard])
6464
Wizard.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
6565
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])
6668
# T.assert_type!(Wizard.destroy_all, T::Array[Wizard]) # Ignored until we add support
6769
T.assert_type!(Wizard.any?, T::Boolean)
6870
T.assert_type!(Wizard.many?, T::Boolean)
@@ -118,6 +120,8 @@
118120
T.assert_type!(Wizard.all.find_each, T::Enumerator[Wizard])
119121
Wizard.all.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
120122
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])
121125
# T.assert_type!(Wizard.all.destroy_all, T::Array[Wizard]) # Ignored until we add support
122126
T.assert_type!(Wizard.all.any?, T::Boolean)
123127
T.assert_type!(Wizard.all.many?, T::Boolean)
@@ -176,10 +180,12 @@
176180
T.assert_type!(spell_books.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
177181
T.assert_type!(spell_books.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
178182
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])
183189
# T.assert_type!(spell_books.destroy_all, T::Array[SpellBook]) # Ignored until we add support
184190
T.assert_type!(spell_books.any?, T::Boolean)
185191
T.assert_type!(spell_books.many?, T::Boolean)
@@ -246,10 +252,12 @@
246252
T.assert_type!(spell_books_query.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
247253
T.assert_type!(spell_books_query.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
248254
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])
253261
# T.assert_type!(spell_books_query.destroy_all, T::Array[SpellBook]) # Ignored until we add support
254262
T.assert_type!(spell_books_query.any?, T::Boolean)
255263
T.assert_type!(spell_books_query.many?, T::Boolean)

spec/support/v5.1/sorbet_test_cases.rb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
T.assert_type!(Wizard.find_each, T::Enumerator[Wizard])
6464
Wizard.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
6565
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])
6668
# T.assert_type!(Wizard.destroy_all, T::Array[Wizard]) # Ignored until we add support
6769
T.assert_type!(Wizard.any?, T::Boolean)
6870
T.assert_type!(Wizard.many?, T::Boolean)
@@ -118,6 +120,8 @@
118120
T.assert_type!(Wizard.all.find_each, T::Enumerator[Wizard])
119121
Wizard.all.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
120122
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])
121125
# T.assert_type!(Wizard.all.destroy_all, T::Array[Wizard]) # Ignored until we add support
122126
T.assert_type!(Wizard.all.any?, T::Boolean)
123127
T.assert_type!(Wizard.all.many?, T::Boolean)
@@ -176,10 +180,12 @@
176180
T.assert_type!(spell_books.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
177181
T.assert_type!(spell_books.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
178182
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])
183189
# T.assert_type!(spell_books.destroy_all, T::Array[SpellBook]) # Ignored until we add support
184190
T.assert_type!(spell_books.any?, T::Boolean)
185191
T.assert_type!(spell_books.many?, T::Boolean)
@@ -246,10 +252,12 @@
246252
T.assert_type!(spell_books_query.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
247253
T.assert_type!(spell_books_query.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
248254
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])
253261
# T.assert_type!(spell_books_query.destroy_all, T::Array[SpellBook]) # Ignored until we add support
254262
T.assert_type!(spell_books_query.any?, T::Boolean)
255263
T.assert_type!(spell_books_query.many?, T::Boolean)

spec/support/v5.2/sorbet_test_cases.rb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
T.assert_type!(Wizard.find_each, T::Enumerator[Wizard])
6464
Wizard.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
6565
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])
6668
# T.assert_type!(Wizard.destroy_all, T::Array[Wizard]) # Ignored until we add support
6769
T.assert_type!(Wizard.any?, T::Boolean)
6870
T.assert_type!(Wizard.many?, T::Boolean)
@@ -118,6 +120,8 @@
118120
T.assert_type!(Wizard.all.find_each, T::Enumerator[Wizard])
119121
Wizard.all.find_in_batches { |w| T.assert_type!(w, T::Array[Wizard]) }
120122
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])
121125
# T.assert_type!(Wizard.all.destroy_all, T::Array[Wizard]) # Ignored until we add support
122126
T.assert_type!(Wizard.all.any?, T::Boolean)
123127
T.assert_type!(Wizard.all.many?, T::Boolean)
@@ -176,10 +180,12 @@
176180
T.assert_type!(spell_books.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
177181
T.assert_type!(spell_books.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook)
178182
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])
183189
# T.assert_type!(spell_books.destroy_all, T::Array[SpellBook]) # Ignored until we add support
184190
T.assert_type!(spell_books.any?, T::Boolean)
185191
T.assert_type!(spell_books.many?, T::Boolean)
@@ -246,10 +252,12 @@
246252
T.assert_type!(spell_books_query.first_or_create(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
247253
T.assert_type!(spell_books_query.first_or_create!(name: 'Fantastic Beasts') { |s| T.assert_type!(s, SpellBook) }, SpellBook) # Ignored until we add support
248254
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])
253261
# T.assert_type!(spell_books_query.destroy_all, T::Array[SpellBook]) # Ignored until we add support
254262
T.assert_type!(spell_books_query.any?, T::Boolean)
255263
T.assert_type!(spell_books_query.many?, T::Boolean)

0 commit comments

Comments
 (0)