diff options
author | Corey Ward <corey.atx@gmail.com> | 2017-01-17 14:25:41 -0600 |
---|---|---|
committer | Corey Ward <corey.atx@gmail.com> | 2017-01-17 14:25:41 -0600 |
commit | 307065f959f2b34bdad16487bae906eb3bfeaf28 (patch) | |
tree | 99bb471b949353c1d0487836a7599c2ac40cb0db /activesupport/test/json | |
parent | 33eef3fc28fe0dd727738639a64233619e0bb9b0 (diff) | |
download | rails-307065f959f2b34bdad16487bae906eb3bfeaf28.tar.gz rails-307065f959f2b34bdad16487bae906eb3bfeaf28.tar.bz2 rails-307065f959f2b34bdad16487bae906eb3bfeaf28.zip |
Use appropriate assertion based on expectation
This resolves a stern Minitest “warning” about an upcoming
behavior change in MiniTest 6 that will result in the test failing.
https://github.com/seattlerb/minitest/issues/666
Diffstat (limited to 'activesupport/test/json')
-rw-r--r-- | activesupport/test/json/decoding_test.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/activesupport/test/json/decoding_test.rb b/activesupport/test/json/decoding_test.rb index 6d1d8f1b95..6f5051c312 100644 --- a/activesupport/test/json/decoding_test.rb +++ b/activesupport/test/json/decoding_test.rb @@ -75,12 +75,17 @@ class TestJSONDecoding < ActiveSupport::TestCase } TESTS.each_with_index do |(json, expected), index| + fail_message = "JSON decoding failed for #{json}" + test "json decodes #{index}" do with_tz_default "Eastern Time (US & Canada)" do with_parse_json_times(true) do silence_warnings do - assert_equal expected, ActiveSupport::JSON.decode(json), "JSON decoding \ - failed for #{json}" + if expected.nil? + assert_nil ActiveSupport::JSON.decode(json), fail_message + else + assert_equal expected, ActiveSupport::JSON.decode(json), fail_message + end end end end |