test/unit/options/normalizers_test.rb in hammer_cli-0.17.0 vs test/unit/options/normalizers_test.rb in hammer_cli-0.17.1

- old
+ new

@@ -48,10 +48,14 @@ it "should parse a string" do formatter.format("a").must_equal ['a'] end + it "should parse a number" do + formatter.format("2").must_equal [2] + end + it "should parse a comma separated string" do formatter.format("a,b,c").must_equal ['a', 'b', 'c'] end it "should parse a comma separated string with values including comma" do @@ -69,12 +73,11 @@ it "should catch quoting errors" do proc { formatter.format('1,"3,4""s') }.must_raise ArgumentError end it "should accept and parse JSON" do - formatter.format("{\"name\":\"bla\", \"value\":1}").must_equal( - JSON.parse("{\"name\":\"bla\", \"value\":1}") - ) + value = {'name' => 'bla', 'value' => 1} + formatter.format(value.to_json).must_equal([value]) end end describe 'list_nested' do let(:params_raw) do