Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/puppet/parser/functions/any2array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module Puppet::Parser::Functions

return arguments unless arguments.length == 1
return arguments[0] if arguments[0].is_a?(Array)
return [] if arguments == ['']
if arguments[0].is_a?(Hash)
result = []
arguments[0].each do |key, value|
Expand Down
1 change: 1 addition & 0 deletions spec/functions/any2array_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
describe 'any2array' do
it { is_expected.not_to eq(nil) }
it { is_expected.to run.with_params.and_return([]) }
it { is_expected.to run.with_params('').and_return([]) }
it { is_expected.to run.with_params(true).and_return([true]) }
it { is_expected.to run.with_params('one').and_return(['one']) }
it { is_expected.to run.with_params('one', 'two').and_return(['one', 'two']) }
Expand Down