diff options
author | Akira Matsuda <ronnie@dio.jp> | 2017-01-18 16:09:58 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2017-01-18 17:30:46 +0900 |
commit | 5349d4ee080ff6da892081eae871a195847353c1 (patch) | |
tree | 60c6ebacfc509551b8eadb5ed74a5f66791cd200 /activerecord/test/cases/transactions_test.rb | |
parent | 044f8bdf625dae78e4e230b9c61d9881864e2def (diff) | |
download | rails-5349d4ee080ff6da892081eae871a195847353c1.tar.gz rails-5349d4ee080ff6da892081eae871a195847353c1.tar.bz2 rails-5349d4ee080ff6da892081eae871a195847353c1.zip |
:warning: "Use assert_nil if expecting nil. This will fail in MT6."
These are followups for 307065f959f2b34bdad16487bae906eb3bfeaf28,
but TBH I'm personally not very much confortable with this style.
Maybe we could override assert_equal in our test_helper not to warn?
Diffstat (limited to 'activerecord/test/cases/transactions_test.rb')
-rw-r--r-- | activerecord/test/cases/transactions_test.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index 9b1cca8583..8f9980f168 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -279,7 +279,11 @@ class TransactionTest < ActiveRecord::TestCase e = assert_raises(RuntimeError) { new_topic.save } assert_equal "Make the transaction rollback", e.message assert_equal new_record_snapshot, !new_topic.persisted?, "The topic should have its old persisted value" - assert_equal id_snapshot, new_topic.id, "The topic should have its old id" + if id_snapshot.nil? + assert_nil new_topic.id, "The topic should have its old id" + else + assert_equal id_snapshot, new_topic.id, "The topic should have its old id" + end assert_equal id_present, new_topic.has_attribute?(Topic.primary_key) end end |