diff --git a/test/tc_util.rb b/test/tc_util.rb index 9e03423..345bb51 100644 --- a/test/tc_util.rb +++ b/test/tc_util.rb @@ -11,6 +11,19 @@ class TestUtil < Test::Unit::TestCase + def test_clean_json + json_ok = { :one => "one", :uri => URI.parse("/file.txt") } + json_nil = { :nil => nil } + json_empty = { :empty => "" } + json_mix = json_ok.merge(json_nil).merge(json_empty) + empty = {} + + assert_same json_ok, ROBundle::Util.clean_json(json_ok) + assert_equal empty, ROBundle::Util.clean_json(json_nil) + assert_equal empty, ROBundle::Util.clean_json(json_empty) + assert_equal json_ok, ROBundle::Util.clean_json(json_mix) + end + def test_parse_time now = Time.now iso = now.iso8601