1 | #! /usr/bin/env ruby -S rspec
|
---|
2 | require 'spec_helper_acceptance'
|
---|
3 |
|
---|
4 | describe 'squeeze function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
---|
5 | describe 'success' do
|
---|
6 | it 'squeezes arrays' do
|
---|
7 | pp = <<-EOS
|
---|
8 | # Real words!
|
---|
9 | $a = ["wallless", "laparohysterosalpingooophorectomy", "brrr", "goddessship"]
|
---|
10 | $o = squeeze($a)
|
---|
11 | notice(inline_template('squeeze is <%= @o.inspect %>'))
|
---|
12 | EOS
|
---|
13 |
|
---|
14 | apply_manifest(pp, :catch_failures => true) do |r|
|
---|
15 | expect(r.stdout).to match(/squeeze is \["wales", "laparohysterosalpingophorectomy", "br", "godeship"\]/)
|
---|
16 | end
|
---|
17 | end
|
---|
18 | it 'squeezez arrays with an argument'
|
---|
19 | it 'squeezes strings' do
|
---|
20 | pp = <<-EOS
|
---|
21 | $a = "wallless laparohysterosalpingooophorectomy brrr goddessship"
|
---|
22 | $o = squeeze($a)
|
---|
23 | notice(inline_template('squeeze is <%= @o.inspect %>'))
|
---|
24 | EOS
|
---|
25 |
|
---|
26 | apply_manifest(pp, :catch_failures => true) do |r|
|
---|
27 | expect(r.stdout).to match(/squeeze is "wales laparohysterosalpingophorectomy br godeship"/)
|
---|
28 | end
|
---|
29 | end
|
---|
30 |
|
---|
31 | it 'squeezes strings with an argument' do
|
---|
32 | pp = <<-EOS
|
---|
33 | $a = "countessship duchessship governessship hostessship"
|
---|
34 | $o = squeeze($a, 's')
|
---|
35 | notice(inline_template('squeeze is <%= @o.inspect %>'))
|
---|
36 | EOS
|
---|
37 |
|
---|
38 | apply_manifest(pp, :catch_failures => true) do |r|
|
---|
39 | expect(r.stdout).to match(/squeeze is "counteship ducheship governeship hosteship"/)
|
---|
40 | end
|
---|
41 | end
|
---|
42 | end
|
---|
43 | describe 'failure' do
|
---|
44 | it 'handles no arguments'
|
---|
45 | it 'handles non strings or arrays'
|
---|
46 | end
|
---|
47 | end
|
---|