summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaula McMaw <paula@puppet.com>2017-02-21 15:51:59 +0000
committerPaula McMaw <paula@puppet.com>2017-02-21 15:51:59 +0000
commit83d68fef749869dc917539f7f05592dc2f2ce642 (patch)
tree73461d7b8314bc910a45121b3f7e1c5888331e20
parent68fa8d32511e770498118b9c1ccc1dfd1e89c860 (diff)
Adding unit test for i18n delete function
-rwxr-xr-xspec/functions/delete_spec.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/functions/delete_spec.rb b/spec/functions/delete_spec.rb
index b44accf..4e37865 100755
--- a/spec/functions/delete_spec.rb
+++ b/spec/functions/delete_spec.rb
@@ -19,6 +19,7 @@ describe 'delete' do
it { is_expected.to run.with_params(['one', 'two', 'three'], 'two').and_return(['one', 'three']) }
it { is_expected.to run.with_params(['two', 'one', 'two', 'three', 'two'], 'two').and_return(['one', 'three']) }
it { is_expected.to run.with_params(['one', 'two', 'three', 'two'], ['one', 'two']).and_return(['three']) }
+ it { is_expected.to run.with_params(['ồאּẻ', 'ŧẅơ', 'ŧңŗё℮', 'ŧẅơ'], ['ồאּẻ', 'ŧẅơ']).and_return(['ŧңŗё℮']) }
end
describe 'deleting from a string' do
@@ -30,7 +31,8 @@ describe 'delete' do
it { is_expected.to run.with_params('barfoobar', 'bar').and_return('foo') }
it { is_expected.to run.with_params('foobarbabarz', 'bar').and_return('foobaz') }
it { is_expected.to run.with_params('foobarbabarz', ['foo', 'bar']).and_return('baz') }
- # this is so sick
+ it { is_expected.to run.with_params('ƒōōβậяβậβậяź', ['ƒōō', 'βậя']).and_return('βậź') }
+
it { is_expected.to run.with_params('barfoobar', ['barbar', 'foo']).and_return('barbar') }
it { is_expected.to run.with_params('barfoobar', ['foo', 'barbar']).and_return('') }
end
@@ -47,6 +49,10 @@ describe 'delete' do
.with_params({'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3'}, ['key1', 'key2']) \
.and_return( {'key3' => 'value3'})
}
+ it { is_expected.to run \
+ .with_params({'ĸəұ1' => 'νãŀủĕ1', 'ĸəұ2' => 'νãŀủĕ2', 'ĸəұ3' => 'νãŀủĕ3'}, ['ĸəұ1', 'ĸəұ2']) \
+ .and_return( {'ĸəұ3' => 'νãŀủĕ3'})
+ }
end
it "should leave the original array intact" do