aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relation
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-04-02 00:10:09 +0900
committerGitHub <noreply@github.com>2019-04-02 00:10:09 +0900
commite0a9e0259c56700fc83b3e886cdf7c04f6a83495 (patch)
tree1a5155bb6d334e31d9f42476372f1d7334a9b80b /activerecord/test/cases/relation
parentd3a6277fd60b73ecdf1ad52db97cd9808c2ab2a8 (diff)
parent6e43a207c6d3072d10b494d605b7bb6635043e30 (diff)
downloadrails-e0a9e0259c56700fc83b3e886cdf7c04f6a83495.tar.gz
rails-e0a9e0259c56700fc83b3e886cdf7c04f6a83495.tar.bz2
rails-e0a9e0259c56700fc83b3e886cdf7c04f6a83495.zip
Merge pull request #35816 from kamipo/partly_revert_query_annotation_for_update_and_delete
Revert unused code and re-using query annotation for `update_all` and `delete_all`
Diffstat (limited to 'activerecord/test/cases/relation')
-rw-r--r--activerecord/test/cases/relation/delete_all_test.rb19
-rw-r--r--activerecord/test/cases/relation/update_all_test.rb27
2 files changed, 0 insertions, 46 deletions
diff --git a/activerecord/test/cases/relation/delete_all_test.rb b/activerecord/test/cases/relation/delete_all_test.rb
index 9b76936b7e..d1c13fa1b5 100644
--- a/activerecord/test/cases/relation/delete_all_test.rb
+++ b/activerecord/test/cases/relation/delete_all_test.rb
@@ -99,23 +99,4 @@ class DeleteAllTest < ActiveRecord::TestCase
assert_raise(ActiveRecord::RecordNotFound) { posts(:thinking) }
assert posts(:welcome)
end
-
- def test_delete_all_with_annotation_includes_a_query_comment
- davids = Author.where(name: "David").annotate("deleting all")
-
- assert_sql(%r{/\* deleting all \*/}) do
- assert_difference("Author.count", -1) { davids.delete_all }
- end
- end
-
- def test_delete_all_without_annotation_does_not_include_an_empty_comment
- davids = Author.where(name: "David")
-
- log = capture_sql do
- assert_difference("Author.count", -1) { davids.delete_all }
- end
-
- assert_not_predicate log, :empty?
- assert_predicate log.select { |query| query.match?(%r{/\*}) }, :empty?
- end
end
diff --git a/activerecord/test/cases/relation/update_all_test.rb b/activerecord/test/cases/relation/update_all_test.rb
index 526f926841..0500574f28 100644
--- a/activerecord/test/cases/relation/update_all_test.rb
+++ b/activerecord/test/cases/relation/update_all_test.rb
@@ -241,33 +241,6 @@ class UpdateAllTest < ActiveRecord::TestCase
end
end
- def test_update_all_with_annotation_includes_a_query_comment
- tag = Tag.first
-
- assert_sql(%r{/\* updating all \*/}) do
- Post.tagged_with(tag.id).annotate("updating all").update_all(title: "rofl")
- end
-
- posts = Post.tagged_with(tag.id).all.to_a
- assert_operator posts.length, :>, 0
- posts.each { |post| assert_equal "rofl", post.title }
- end
-
- def test_update_all_without_annotation_does_not_include_an_empty_comment
- tag = Tag.first
-
- log = capture_sql do
- Post.tagged_with(tag.id).update_all(title: "rofl")
- end
-
- assert_not_predicate log, :empty?
- assert_predicate log.select { |query| query.match?(%r{/\*}) }, :empty?
-
- posts = Post.tagged_with(tag.id).all.to_a
- assert_operator posts.length, :>, 0
- posts.each { |post| assert_equal "rofl", post.title }
- end
-
# Oracle UPDATE does not support ORDER BY
unless current_adapter?(:OracleAdapter)
def test_update_all_ignores_order_without_limit_from_association