Remove delegate_missing_to in FutureResult class and add test cases.
This commit is contained in:
parent
af773ae44a
commit
c1c07b096b
@ -60,7 +60,6 @@ def self.wrap(result)
|
||||
end
|
||||
|
||||
delegate :empty?, :to_a, to: :result
|
||||
delegate_missing_to :result
|
||||
|
||||
attr_reader :lock_wait
|
||||
|
||||
|
@ -217,6 +217,11 @@ def test_pluck
|
||||
assert_equal titles, Post.where(author_id: 1).load_async.pluck(:title)
|
||||
end
|
||||
|
||||
def test_count
|
||||
count = Post.where(author_id: 1).count
|
||||
assert_equal count, Post.where(author_id: 1).load_async.count
|
||||
end
|
||||
|
||||
def test_size
|
||||
expected_size = Post.where(author_id: 1).size
|
||||
|
||||
@ -233,12 +238,19 @@ def test_empty?
|
||||
assert_predicate deferred_posts, :loaded?
|
||||
end
|
||||
|
||||
def test_load_async_with_query_cache
|
||||
def test_load_async_pluck_with_query_cache
|
||||
titles = Post.where(author_id: 1).pluck(:title)
|
||||
Post.cache do
|
||||
assert_equal titles, Post.where(author_id: 1).load_async.pluck(:title)
|
||||
end
|
||||
end
|
||||
|
||||
def test_load_async_count_with_query_cache
|
||||
count = Post.where(author_id: 1).count
|
||||
Post.cache do
|
||||
assert_equal count, Post.where(author_id: 1).load_async.count
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class LoadAsyncNullExecutorTest < ActiveRecord::TestCase
|
||||
|
Loading…
Reference in New Issue
Block a user