Sha256: 621bb242d96bf4cdb4e2bb906941afebd64e816070981c31627fb5b797c7d67f
Contents?: true
Size: 1.07 KB
Versions: 60
Compression:
Stored size: 1.07 KB
Contents
require 'spec_helper' require 'flydata-core/string_utils' describe FlydataCore::StringUtils do let(:str) { '' } let(:expected_str) { str } subject { described_class.replace_invalid_utf8_char(str) } shared_examples 'return_expected_str' do it { is_expected.to eq(expected_str) } end context 'with non-invalid char' do context 'with ascii code str' do let(:str) { 'abcdefg' } it_behaves_like 'return_expected_str' end context 'with empty str' do let(:str) { '' } it_behaves_like 'return_expected_str' end context 'with UTF-8 char' do let(:str) { 'あいうえお' } it_behaves_like 'return_expected_str' end end context 'with invalid char' do context 'with ascii and invalid str' do let(:str) { "abc\255def" } let(:expected_str) { 'abc?def' } it_behaves_like 'return_expected_str' end context 'with UTF-8 and invalid str' do let(:str) { "あいう\255えお" } let(:expected_str) { "あいう?えお" } it_behaves_like 'return_expected_str' end end end
Version data entries
60 entries across 60 versions & 1 rubygems