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/dig44_spec.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'spec/functions/dig44_spec.rb') diff --git a/spec/functions/dig44_spec.rb b/spec/functions/dig44_spec.rb index 4f7408d..a7b8a3d 100644 --- a/spec/functions/dig44_spec.rb +++ b/spec/functions/dig44_spec.rb @@ -25,6 +25,18 @@ describe 'dig44' do } end + let(:utf8_data) do + { + 'ẵ' => { + 'в' => [ + '©', + 'ĝ', + 'に', + ] + } + } + end + context 'single values' do it 'should exist' do is_expected.not_to be_nil @@ -100,6 +112,20 @@ describe 'dig44' do it 'should return "nil" if value is not found and no default value is provided' do is_expected.to run.with_params(data, %w(a 1)).and_return(nil) end + end + + context 'Internationalization (i18N) values' do + + it 'should be able to return a unicode character' do + is_expected.to run.with_params(utf8_data, ['ẵ', 'в', 0]).and_return('©') + end + it 'should be able to return a utf8 character' do + is_expected.to run.with_params(utf8_data, ['ẵ', 'в', 1]).and_return('ĝ') + end + + it 'should be able to return a double byte character' do + is_expected.to run.with_params(utf8_data, ['ẵ', 'в', 2]).and_return('に') + end end end -- cgit v1.2.3