aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/json/decoding_test.rb
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-01-17 16:01:15 -0500
committerGitHub <noreply@github.com>2017-01-17 16:01:15 -0500
commita8a673f2e43f27b770ebfc75572ff7de0bbe1f6c (patch)
tree99bb471b949353c1d0487836a7599c2ac40cb0db /activesupport/test/json/decoding_test.rb
parent33eef3fc28fe0dd727738639a64233619e0bb9b0 (diff)
parent307065f959f2b34bdad16487bae906eb3bfeaf28 (diff)
downloadrails-a8a673f2e43f27b770ebfc75572ff7de0bbe1f6c.tar.gz
rails-a8a673f2e43f27b770ebfc75572ff7de0bbe1f6c.tar.bz2
rails-a8a673f2e43f27b770ebfc75572ff7de0bbe1f6c.zip
Merge pull request #27712 from coreyward/resolve_decode_test_warning
Use appropriate assertion based on expectation
Diffstat (limited to 'activesupport/test/json/decoding_test.rb')
-rw-r--r--activesupport/test/json/decoding_test.rb9
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