1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper_acceptance'
4 describe 'reject function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
6 it 'rejects array of values' do
8 $o = reject(['aaa','bbb','ccc','aaaddd'], 'aaa')
9 notice(inline_template('reject is <%= @o.inspect %>'))
12 apply_manifest(pp, :catch_failures => true) do |r|
13 expect(r.stdout).to match(/reject is \["bbb", "ccc"\]/)
16 it 'rejects with empty array' do
19 notice(inline_template('reject is <%= @o.inspect %>'))
22 apply_manifest(pp, :catch_failures => true) do |r|
23 expect(r.stdout).to match(/reject is \[\]/)
26 it 'rejects array of values with undef' do
28 $o = reject(['aaa','bbb','ccc','aaaddd'], undef)
29 notice(inline_template('reject is <%= @o.inspect %>'))
32 apply_manifest(pp, :catch_failures => true) do |r|
33 expect(r.stdout).to match(/reject is \[\]/)
38 it 'fails with no arguments'
39 it 'fails when first argument is not array'
40 it 'fails when second argument is not string'