1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #27712 from coreyward/resolve_decode_test_warning

Use appropriate assertion based on expectation
This commit is contained in:
Rafael França 2017-01-17 16:01:15 -05:00 committed by GitHub
commit a8a673f2e4

View file

@ -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