chomp_spec.rb 1.3 KB

12345678910111213141516171819202122232425
  1. require 'spec_helper'
  2. describe 'chomp' do
  3. it { is_expected.not_to eq(nil) }
  4. it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError) }
  5. it { is_expected.to run.with_params(1).and_raise_error(Puppet::ParseError) }
  6. it {
  7. pending('Current implementation ignores parameters after the first.')
  8. is_expected.to run.with_params('a', 'b').and_raise_error(Puppet::ParseError)
  9. }
  10. it { is_expected.to run.with_params('one').and_return('one') }
  11. it { is_expected.to run.with_params("one\n").and_return('one') }
  12. it { is_expected.to run.with_params("one\n\n").and_return("one\n") }
  13. it { is_expected.to run.with_params(%W[one\n two three\n]).and_return(%w[one two three]) }
  14. it { is_expected.to run.with_params(AlsoString.new('one')).and_return('one') }
  15. it { is_expected.to run.with_params(AlsoString.new("one\n")).and_return('one') }
  16. it { is_expected.to run.with_params(AlsoString.new("one\n\n")).and_return("one\n") }
  17. it { is_expected.to run.with_params([AlsoString.new("one\n"), AlsoString.new('two'), "three\n"]).and_return(%w[one two three]) }
  18. context 'with UTF8 and double byte characters' do
  19. it { is_expected.to run.with_params("ůťƒ8\n\n").and_return("ůťƒ8\n") }
  20. it { is_expected.to run.with_params("ネット\n\n").and_return("ネット\n") }
  21. end
  22. end