From 2f463600c2c0b6ac95ec71d3e5b17d1b2abdcd22 Mon Sep 17 00:00:00 2001 From: Paula McMaw Date: Fri, 3 Mar 2017 15:25:53 +0000 Subject: (FM-6063) - Unit tests for high effort functions --- spec/functions/parsejson_spec.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'spec/functions/parsejson_spec.rb') diff --git a/spec/functions/parsejson_spec.rb b/spec/functions/parsejson_spec.rb index a01f1f6..7b07e49 100755 --- a/spec/functions/parsejson_spec.rb +++ b/spec/functions/parsejson_spec.rb @@ -12,12 +12,12 @@ describe 'parsejson' do context 'with correct JSON data' do - it 'should be able to parse a JSON data with a Hash' do + it 'should be able to parse JSON data with a Hash' do is_expected.to run.with_params('{"a":"1","b":"2"}'). and_return({'a'=>'1', 'b'=>'2'}) end - it 'should be able to parse a JSON data with an Array' do + it 'should be able to parse JSON data with an Array' do is_expected.to run.with_params('["a","b","c"]'). and_return(['a', 'b', 'c']) end @@ -29,11 +29,16 @@ describe 'parsejson' do and_return({}) end - it 'should be able to parse a JSON data with a mixed structure' do + it 'should be able to parse JSON data with a mixed structure' do is_expected.to run.with_params('{"a":"1","b":2,"c":{"d":[true,false]}}'). and_return({'a' =>'1', 'b' => 2, 'c' => { 'd' => [true, false] } }) end + it 'should be able to parse JSON data with a UTF8 and double byte characters' do + is_expected.to run.with_params('{"×":"これ","ý":"記号","です":{"©":["Á","ß"]}}'). + and_return({'×' =>'これ', 'ý' => '記号', 'です' => { '©' => ['Á', 'ß'] } }) + end + it 'should not return the default value if the data was parsed correctly' do is_expected.to run.with_params('{"a":"1"}', 'default_value'). and_return({'a' => '1'}) -- cgit v1.2.3