diff options
author | Helen <helen@puppetlabs.com> | 2017-02-21 16:40:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-21 16:40:02 +0000 |
commit | 6f160c37ba0883c27baae534ae8dfd45e231cc01 (patch) | |
tree | fb26bbd9b120aedace303edf160ebd60f1182273 | |
parent | f564377492018de351b365f4205d422d41d2865b (diff) | |
parent | 150696a028d047321e9e53081d0922e039a66312 (diff) |
Merge pull request #724 from pmcmaw/MODULES-4429-unitTests
Modules 4429 unit tests
-rwxr-xr-x | spec/functions/concat_spec.rb | 1 | ||||
-rwxr-xr-x | spec/functions/count_spec.rb | 5 | ||||
-rwxr-xr-x | spec/functions/delete_at_spec.rb | 2 | ||||
-rwxr-xr-x | spec/functions/delete_spec.rb | 8 | ||||
-rwxr-xr-x | spec/functions/delete_values_spec.rb | 6 |
5 files changed, 20 insertions, 2 deletions
diff --git a/spec/functions/concat_spec.rb b/spec/functions/concat_spec.rb index eb76233..0e67a60 100755 --- a/spec/functions/concat_spec.rb +++ b/spec/functions/concat_spec.rb @@ -12,6 +12,7 @@ describe 'concat' do it { is_expected.to run.with_params(['1','2'],['3','4'],['5','6']).and_return(['1','2','3','4','5','6']) } it { is_expected.to run.with_params(['1','2'],'3','4',['5','6']).and_return(['1','2','3','4','5','6']) } it { is_expected.to run.with_params([{"a" => "b"}], {"c" => "d", "e" => "f"}).and_return([{"a" => "b"}, {"c" => "d", "e" => "f"}]) } + it { is_expected.to run.with_params(['ấ','β','c'],['đ','ể','ƒ']).and_return(['ấ','β','c','đ','ể','ƒ']) } it "should leave the original array intact" do argument1 = ['1','2','3'] diff --git a/spec/functions/count_spec.rb b/spec/functions/count_spec.rb index c8d1960..3854cb8 100755 --- a/spec/functions/count_spec.rb +++ b/spec/functions/count_spec.rb @@ -15,4 +15,9 @@ describe 'count' do it { is_expected.to run.with_params(["one", nil, "two"]).and_return(2) } it { is_expected.to run.with_params(["one", "", "two"]).and_return(2) } it { is_expected.to run.with_params(["one", :undef, "two"]).and_return(2) } + + it { is_expected.to run.with_params(["ổņ℮", "ŧщộ", "three"]).and_return(3) } + it { is_expected.to run.with_params(["ổņ℮", "ŧщộ", "ŧщộ"], "ŧщộ").and_return(2) } + it { is_expected.to run.with_params(["ổņ℮", nil, "ŧщộ"]).and_return(2) } + it { is_expected.to run.with_params(["ổņ℮", :undef, "ŧщộ"]).and_return(2) } end diff --git a/spec/functions/delete_at_spec.rb b/spec/functions/delete_at_spec.rb index 0e19472..0471039 100755 --- a/spec/functions/delete_at_spec.rb +++ b/spec/functions/delete_at_spec.rb @@ -18,6 +18,8 @@ describe 'delete_at' do it { is_expected.to run.with_params([0, 1, 2], 1).and_return([0, 2]) } it { is_expected.to run.with_params([0, 1, 2], -1).and_return([0, 1]) } it { is_expected.to run.with_params([0, 1, 2], -4).and_return([0, 1, 2]) } + it { is_expected.to run.with_params(["ƒờở", "βāř", "ьầż"], 1).and_return(["ƒờở", "ьầż"]) } + it "should leave the original array intact" do argument = [1, 2, 3] 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 diff --git a/spec/functions/delete_values_spec.rb b/spec/functions/delete_values_spec.rb index 12907d4..329fa0b 100755 --- a/spec/functions/delete_values_spec.rb +++ b/spec/functions/delete_values_spec.rb @@ -19,7 +19,11 @@ describe 'delete_values' do .and_return({'key1' => 'value1'}) } it { is_expected.to run \ - .with_params({'key1' => 'value1', 'key2' => 'value to delete'}, 'value to delete') \ + .with_params({'ҝếỵ1 ' => 'νâĺūẹ1', 'ҝếỵ2' => 'value to delete'}, 'value to delete') \ + .and_return({'ҝếỵ1 ' => 'νâĺūẹ1'}) + } + it { is_expected.to run \ + .with_params({'key1' => 'value1', 'key2' => 'νǎŀữ℮ ťớ đêłểťė'}, 'νǎŀữ℮ ťớ đêłểťė') \ .and_return({'key1' => 'value1'}) } it { is_expected.to run \ |