delete_at_spec.rb 1.2 KB

1234567891011121314151617181920212223242526272829
  1. require 'spec_helper'
  2. describe 'delete_at' 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('one', 1).and_raise_error(Puppet::ParseError) }
  6. it { is_expected.to run.with_params(1, 1).and_raise_error(Puppet::ParseError) }
  7. it { is_expected.to run.with_params(['one'], 'two').and_raise_error(Puppet::ParseError) }
  8. it {
  9. pending('Current implementation ignores parameters after the first two.')
  10. is_expected.to run.with_params(['one'], 0, 1).and_raise_error(Puppet::ParseError)
  11. }
  12. describe 'argument validation' do
  13. it { is_expected.to run.with_params([0, 1, 2], 3).and_raise_error(Puppet::ParseError) }
  14. end
  15. it { is_expected.to run.with_params([0, 1, 2], 1).and_return([0, 2]) }
  16. it { is_expected.to run.with_params([0, 1, 2], -1).and_return([0, 1]) }
  17. it { is_expected.to run.with_params([0, 1, 2], -4).and_return([0, 1, 2]) }
  18. it { is_expected.to run.with_params(%w[ƒờở βāř ьầż], 1).and_return(%w[ƒờở ьầż]) }
  19. it 'leaves the original array intact' do
  20. argument = [1, 2, 3]
  21. original = argument.dup
  22. _result = subject.call([argument, 2])
  23. expect(argument).to eq(original)
  24. end
  25. end