reject_spec.rb 1.1 KB

1234567891011121314151617181920
  1. require 'spec_helper'
  2. describe 'reject' do
  3. it { is_expected.not_to eq(nil) }
  4. it { is_expected.to run.with_params.and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
  5. it { is_expected.to run.with_params([], 'pattern', 'extra').and_raise_error(Puppet::ParseError, %r{wrong number of arguments}i) }
  6. it {
  7. pending('reject does not actually check this, and raises NoMethodError instead')
  8. is_expected.to run.with_params('one', 'two').and_raise_error(Puppet::ParseError, %r{first argument not an array})
  9. }
  10. it {
  11. pending('reject does not actually check this, and raises NoMethodError instead')
  12. is_expected.to run.with_params(1, 'two').and_raise_error(Puppet::ParseError, %r{first argument not an array})
  13. }
  14. it { is_expected.to run.with_params([], 'two').and_return([]) }
  15. it { is_expected.to run.with_params(%w[one two three], 'two').and_return(%w[one three]) }
  16. it { is_expected.to run.with_params(%w[one two three], 't(wo|hree)').and_return(['one']) }
  17. it { is_expected.to run.with_params(%w[όʼnệ ţщồ ţңяέέ], 'ţ(щồ|ңяέέ)').and_return(['όʼnệ']) }
  18. end