diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-06-19 17:49:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-19 17:49:34 -0400 |
commit | 91450faa99ec9fd8c05c0f5a1d9b7b280bf296c5 (patch) | |
tree | db5534e5427327b422ffd25c6e8f8869abd4b44a /activerecord/test/cases | |
parent | a21687bfd6bf509acafbdbfe7d2f0d9ff57e323a (diff) | |
parent | 951aa8da2f484cb4324b3501481ce178948bcd43 (diff) | |
download | rails-91450faa99ec9fd8c05c0f5a1d9b7b280bf296c5.tar.gz rails-91450faa99ec9fd8c05c0f5a1d9b7b280bf296c5.tar.bz2 rails-91450faa99ec9fd8c05c0f5a1d9b7b280bf296c5.zip |
Merge pull request #29454 from kamipo/fix_exists_queries_with_cache
Fix `Relation#exists?` queries with query cache
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/query_cache_test.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb index 494663eb04..9b741545d7 100644 --- a/activerecord/test/cases/query_cache_test.rb +++ b/activerecord/test/cases/query_cache_test.rb @@ -204,6 +204,52 @@ class QueryCacheTest < ActiveRecord::TestCase end end + def test_exists_queries_with_cache + Post.cache do + assert_queries(1) { Post.exists?; Post.exists? } + end + end + + def test_select_all_with_cache + Post.cache do + assert_queries(1) do + 2.times { Post.connection.select_all(Post.all) } + end + end + end + + def test_select_one_with_cache + Post.cache do + assert_queries(1) do + 2.times { Post.connection.select_one(Post.all) } + end + end + end + + def test_select_value_with_cache + Post.cache do + assert_queries(1) do + 2.times { Post.connection.select_value(Post.all) } + end + end + end + + def test_select_values_with_cache + Post.cache do + assert_queries(1) do + 2.times { Post.connection.select_values(Post.all) } + end + end + end + + def test_select_rows_with_cache + Post.cache do + assert_queries(1) do + 2.times { Post.connection.select_rows(Post.all) } + end + end + end + def test_query_cache_dups_results_correctly Task.cache do now = Time.now.utc |