File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,6 @@ def self.wrap(result)
60
60
end
61
61
62
62
delegate :empty? , :to_a , to : :result
63
- delegate_missing_to :result
64
63
65
64
attr_reader :lock_wait
66
65
Original file line number Diff line number Diff line change @@ -217,6 +217,11 @@ def test_pluck
217
217
assert_equal titles , Post . where ( author_id : 1 ) . load_async . pluck ( :title )
218
218
end
219
219
220
+ def test_count
221
+ count = Post . where ( author_id : 1 ) . count
222
+ assert_equal count , Post . where ( author_id : 1 ) . load_async . count
223
+ end
224
+
220
225
def test_size
221
226
expected_size = Post . where ( author_id : 1 ) . size
222
227
@@ -233,12 +238,19 @@ def test_empty?
233
238
assert_predicate deferred_posts , :loaded?
234
239
end
235
240
236
- def test_load_async_with_query_cache
241
+ def test_load_async_pluck_with_query_cache
237
242
titles = Post . where ( author_id : 1 ) . pluck ( :title )
238
243
Post . cache do
239
244
assert_equal titles , Post . where ( author_id : 1 ) . load_async . pluck ( :title )
240
245
end
241
246
end
247
+
248
+ def test_load_async_count_with_query_cache
249
+ count = Post . where ( author_id : 1 ) . count
250
+ Post . cache do
251
+ assert_equal count , Post . where ( author_id : 1 ) . load_async . count
252
+ end
253
+ end
242
254
end
243
255
244
256
class LoadAsyncNullExecutorTest < ActiveRecord ::TestCase
You can’t perform that action at this time.
0 commit comments