Update stdlib
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / spec / functions / chomp_spec.rb
1 require 'spec_helper'
2
3 describe 'chomp' do
4   it { is_expected.not_to eq(nil) }
5   it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError) }
6   it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError) }
7   it {
8     pending("Current implementation ignores parameters after the first.")
9     is_expected.to run.with_params("a", "b").and_raise_error(Puppet::ParseError)
10   }
11   it { is_expected.to run.with_params("one").and_return("one") }
12   it { is_expected.to run.with_params("one\n").and_return("one") }
13   it { is_expected.to run.with_params("one\n\n").and_return("one\n") }
14   it { is_expected.to run.with_params(["one\n", "two", "three\n"]).and_return(["one", "two", "three"]) }
15
16   it { is_expected.to run.with_params(AlsoString.new("one")).and_return("one") }
17   it { is_expected.to run.with_params(AlsoString.new("one\n")).and_return("one") }
18   it { is_expected.to run.with_params(AlsoString.new("one\n\n")).and_return("one\n") }
19   it { is_expected.to run.with_params([AlsoString.new("one\n"), AlsoString.new("two"), "three\n"]).and_return(["one", "two", "three"]) }
20
21   context 'should run with UTF8 and double byte characters' do
22     it { is_expected.to run.with_params("ůťƒ8\n\n").and_return("ůťƒ8\n") }
23     it { is_expected.to run.with_params("ネット\n\n").and_return("ネット\n") }
24   end
25 end