diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-01-04 23:14:51 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-01-04 23:14:51 +0900 |
commit | cb86b95b609c8aa52411322f5a8e0f128696e068 (patch) | |
tree | 5f0f5d3af1d1606829be90d37ff014d5c890933c /activesupport/lib | |
parent | 652258e41a882acccdb9a3ce211dbf356e738b28 (diff) | |
parent | af0361da0ac7e5b7703e772ce69c21c3315a54d0 (diff) | |
download | rails-cb86b95b609c8aa52411322f5a8e0f128696e068.tar.gz rails-cb86b95b609c8aa52411322f5a8e0f128696e068.tar.bz2 rails-cb86b95b609c8aa52411322f5a8e0f128696e068.zip |
Merge pull request #31011 from danielma/dma/assert-changes-with-to-should-still-assert-change
`assert_changes` should always assert some change
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/testing/assertions.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/testing/assertions.rb b/activesupport/lib/active_support/testing/assertions.rb index b24aa36ede..6f69c48674 100644 --- a/activesupport/lib/active_support/testing/assertions.rb +++ b/activesupport/lib/active_support/testing/assertions.rb @@ -156,11 +156,12 @@ module ActiveSupport after = exp.call - if to == UNTRACKED - error = "#{expression.inspect} didn't change" - error = "#{message}.\n#{error}" if message - assert before != after, error - else + error = "#{expression.inspect} didn't change" + error = "#{error}. It was already #{to}" if before == to + error = "#{message}.\n#{error}" if message + assert before != after, error + + unless to == UNTRACKED error = "#{expression.inspect} didn't change to #{to}" error = "#{message}.\n#{error}" if message assert to === after, error |