4 context 'Checking parameter validity' do
5 it { is_expected.not_to eq(nil) }
7 is_expected.to run.with_params.and_raise_error(ArgumentError, /Wrong number of arguments/)
10 is_expected.to run.with_params('one', 'two').and_raise_error(ArgumentError, /Wrong number of arguments/)
13 is_expected.to run.with_params([]).and_raise_error(Puppet::ParseError)
16 is_expected.to run.with_params({}).and_raise_error(Puppet::ParseError)
19 is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError)
23 context 'Converting from dos to unix format' do
24 sample_text = "Hello\r\nWorld\r\n"
25 desired_output = "Hello\nWorld\n"
27 it 'should output unix format' do
28 should run.with_params(sample_text).and_return(desired_output)
32 context 'Internationalization (i18N) values' do
33 sample_text_utf8 = "Ħ℮ļłǿ\r\nשׁөŕłđ\r\n"
34 desired_output_utf8 = "Ħ℮ļłǿ\nשׁөŕłđ\n"
36 sample_text_doublebyte = "こんにちは\r\n世界\r\n"
37 desired_output_doublebyte = "こんにちは\n世界\n"
39 it 'should output uft8 string' do
40 should run.with_params(sample_text_utf8).and_return(desired_output_utf8)
43 it 'should output double byte string' do
44 should run.with_params(sample_text_doublebyte).and_return(desired_output_doublebyte)