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:
commit
a8a673f2e4
1 changed files with 7 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue