From 3a91f8cf69dc6ba643f8d06f9d3aa61bd69d6b8a Mon Sep 17 00:00:00 2001 From: Lavinia Foldenyi Date: Fri, 21 Sep 2018 16:45:50 +0300 Subject: (MODULES-7814) Ignore nil values when parsing commands. Fix for: Could not evaluate: undefined method strip! for nil:NilClass --- spec/unit/provider/augeas/augeas_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'spec/unit/provider') diff --git a/spec/unit/provider/augeas/augeas_spec.rb b/spec/unit/provider/augeas/augeas_spec.rb index 180f89c..7c9336a 100644 --- a/spec/unit/provider/augeas/augeas_spec.rb +++ b/spec/unit/provider/augeas/augeas_spec.rb @@ -46,6 +46,16 @@ describe Puppet::Type.type(:augeas).provider(:augeas) do end describe 'command parsing' do + it 'ignores nil values when parsing commands' do + commands = [nil, 'set Jar/Jar Binks'] + tokens = provider.parse_commands(commands) + expect(tokens.size).to eq(1) + expect(tokens[0].size).to eq(3) + expect(tokens[0][0]).to eq('set') + expect(tokens[0][1]).to eq('Jar/Jar') + expect(tokens[0][2]).to eq('Binks') + end + it 'breaks apart a single line into three tokens and clean up the context' do resource[:context] = '/context' tokens = provider.parse_commands('set Jar/Jar Binks') -- cgit v1.2.3