Merge pull request #4234 from b-dean/fixnum-array-args-fix

provisioner/shell: fix cannot handle Fixnum array args
This commit is contained in:
Mitchell Hashimoto 2014-08-05 17:29:59 -07:00
commit f5854c5618
2 changed files with 20 additions and 2 deletions

View File

@ -30,8 +30,8 @@ module VagrantPlugins
@binary = false if @binary == UNSET_VALUE @binary = false if @binary == UNSET_VALUE
@keep_color = false if @keep_color == UNSET_VALUE @keep_color = false if @keep_color == UNSET_VALUE
if @args && !@args.is_a?(Array) && args_valid? if @args && args_valid?
@args = @args.to_s @args = @args.is_a?(Array) ? @args.map { |a| a.to_s } : @args.to_s
end end
end end

View File

@ -86,4 +86,22 @@ describe "VagrantPlugins::Shell::Config" do
]) ])
end end
end end
describe 'finalize!' do
it 'changes fixnum args into strings' do
subject.path = file_that_exists
subject.args = 1
subject.finalize!
expect(subject.args).to eq '1'
end
it 'changes fixnum args in arrays into strings' do
subject.path = file_that_exists
subject.args = ["string", 1, 2]
subject.finalize!
expect(subject.args).to eq ["string", '1', '2']
end
end
end end