spec/mernis/request_spec.rb in mernis-1.0.2 vs spec/mernis/request_spec.rb in mernis-1.0.3

- old
+ new

@@ -1,8 +1,9 @@ require 'spec_helper' require 'savon' require 'mernis' +require 'unicode_utils' describe 'Request' do before(:each) do @client = Savon.client( wsdl: 'https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?WSDL', @@ -15,47 +16,47 @@ it 'returns true with correct identity' do response = @client.call(:tc_kimlik_no_dogrula, message: { 'TCKimlikNo' => '11311152982', - 'Ad' => 'Kuzey Tüner'.tr('ı', 'I').tr('i', 'İ').upcase, - 'Soyad' => 'Şenkul'.tr('ı', 'I').tr('i', 'İ').upcase, + 'Ad' => UnicodeUtils.upcase('Kuzey Tüner', :tr), + 'Soyad' => UnicodeUtils.upcase('Şenkul', :tr), 'DogumYili' => '2014' }) bool_value = response.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result] expect(bool_value).to equal(true) end it 'returns true with downcase characters' do response = @client.call(:tc_kimlik_no_dogrula, message: { 'TCKimlikNo' => '11311152982', - 'Ad' => 'kuzey tüner'.tr('ı', 'I').tr('i', 'İ').upcase, - 'Soyad' => 'şenkul'.tr('ı', 'I').tr('i', 'İ').upcase, + 'Ad' => UnicodeUtils.upcase('kuzey tüner', :tr), + 'Soyad' => UnicodeUtils.upcase('şenkul', :tr), 'DogumYili' => '2014' }) bool_value = response.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result] expect(bool_value).to equal(true) end it 'returns true with upcase characters' do response = @client.call(:tc_kimlik_no_dogrula, message: { 'TCKimlikNo' => '11311152982', - 'Ad' => 'KUZEY TÜNER'.tr('ı', 'I').tr('i', 'İ').upcase, - 'Soyad' => 'ŞENKUL'.tr('ı', 'I').tr('i', 'İ').upcase, + 'Ad' => UnicodeUtils.upcase('KUZEY TÜNER', :tr), + 'Soyad' => UnicodeUtils.upcase('ŞENKUL', :tr), 'DogumYili' => '2014' }) bool_value = response.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result] expect(bool_value).to equal(true) end it 'returns false with incorrect identity' do response = @client.call(:tc_kimlik_no_dogrula, message: { 'TCKimlikNo' => '11311152982', - 'Ad' => 'Kuzey'.tr('ı', 'I').tr('i', 'İ').upcase, - 'Soyad' => 'Şenkul'.tr('ı', 'I').tr('i', 'İ').upcase, + 'Ad' => UnicodeUtils.upcase('Kuzey', :tr), + 'Soyad' => UnicodeUtils.upcase('Şenkul', :tr), 'DogumYili' => '2014' }) bool_value = response.body[:tc_kimlik_no_dogrula_response][:tc_kimlik_no_dogrula_result] expect(bool_value).to equal(false) end