Merge pull request #4234 from b-dean/fixnum-array-args-fix
provisioner/shell: fix cannot handle Fixnum array args
This commit is contained in:
commit
f5854c5618
|
@ -30,8 +30,8 @@ module VagrantPlugins
|
|||
@binary = false if @binary == UNSET_VALUE
|
||||
@keep_color = false if @keep_color == UNSET_VALUE
|
||||
|
||||
if @args && !@args.is_a?(Array) && args_valid?
|
||||
@args = @args.to_s
|
||||
if @args && args_valid?
|
||||
@args = @args.is_a?(Array) ? @args.map { |a| a.to_s } : @args.to_s
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -86,4 +86,22 @@ describe "VagrantPlugins::Shell::Config" do
|
|||
])
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue