diff options
author | Willian Gustavo Veiga <beberveiga@gmail.com> | 2018-10-11 07:44:27 -0300 |
---|---|---|
committer | Willian Gustavo Veiga <beberveiga@gmail.com> | 2018-10-11 07:44:27 -0300 |
commit | 99bd626885b72acd44861727918ee107a649e2b4 (patch) | |
tree | 6d59fcdb226a65d9eb63f8bad2b2df7b09b92a60 /activerecord/test/cases/persistence_test.rb | |
parent | 4b60e34f58c0dabe18a793038fc7775d044016f6 (diff) | |
parent | 6a278c6e9a05b0d901e482458cfc2e3df587d522 (diff) | |
download | rails-99bd626885b72acd44861727918ee107a649e2b4.tar.gz rails-99bd626885b72acd44861727918ee107a649e2b4.tar.bz2 rails-99bd626885b72acd44861727918ee107a649e2b4.zip |
Merge branch 'master' into feature/reselect-method
Diffstat (limited to 'activerecord/test/cases/persistence_test.rb')
-rw-r--r-- | activerecord/test/cases/persistence_test.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb index 8073cabae6..4830ff2b5f 100644 --- a/activerecord/test/cases/persistence_test.rb +++ b/activerecord/test/cases/persistence_test.rb @@ -446,19 +446,17 @@ class PersistenceTest < ActiveRecord::TestCase end def test_update_attribute_does_not_run_sql_if_attribute_is_not_changed - klass = Class.new(Topic) do - def self.name; "Topic"; end - end - topic = klass.create(title: "Another New Topic") - assert_queries(0) do + topic = Topic.create(title: "Another New Topic") + assert_no_queries do assert topic.update_attribute(:title, "Another New Topic") end end def test_update_does_not_run_sql_if_record_has_not_changed topic = Topic.create(title: "Another New Topic") - assert_queries(0) { assert topic.update(title: "Another New Topic") } - assert_queries(0) { assert topic.update(title: "Another New Topic") } + assert_no_queries do + assert topic.update(title: "Another New Topic") + end end def test_delete |