Skip to content

Commit

Permalink
Add tests for the Util#clean_json method.
Browse files Browse the repository at this point in the history
  • Loading branch information
hainesr committed Jul 2, 2014
1 parent 76ba4ec commit 9b1fe1d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/tc_util.rb
Expand Up @@ -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
Expand Down

0 comments on commit 9b1fe1d

Please sign in to comment.