|
144 | 144 | result = testobj.puppet_command |
145 | 145 | expect(result).to match(%r{--hiera_config=.*/hiera\.yaml}) |
146 | 146 | end |
| 147 | + |
| 148 | + it 'should call override_and_append_commandline_with_user_supplied_arguments' do |
| 149 | + testobj = OctocatalogDiff::CatalogUtil::Command.new(@default_opts.merge(command_line: ['--foo=bar'])) |
| 150 | + result = testobj.puppet_command |
| 151 | + expect(result).to match(/--foo=bar/) |
| 152 | + end |
| 153 | + end |
| 154 | + |
| 155 | + describe '#override_and_append_commandline_with_user_supplied_arguments' do |
| 156 | + context 'with standalone key' do |
| 157 | + context 'when not existing' do |
| 158 | + it 'should append standalone key' do |
| 159 | + end |
| 160 | + end |
| 161 | + |
| 162 | + context 'when existing as standalone key' do |
| 163 | + it 'should keep standalone key' do |
| 164 | + end |
| 165 | + end |
| 166 | + |
| 167 | + context 'when existing as key=val' do |
| 168 | + it 'should replace key=val with standalone key' do |
| 169 | + end |
| 170 | + end |
| 171 | + end |
| 172 | + |
| 173 | + context 'with key=val' do |
| 174 | + context 'when not existing' do |
| 175 | + it 'should append key=val' do |
| 176 | + end |
| 177 | + end |
| 178 | + |
| 179 | + context 'when existing as standalone key' do |
| 180 | + it 'should replace standalone key with key=val' do |
| 181 | + end |
| 182 | + end |
| 183 | + |
| 184 | + context 'when existing as key=val' do |
| 185 | + it 'should replace key=val with new key=val' do |
| 186 | + end |
| 187 | + end |
| 188 | + end |
| 189 | + |
| 190 | + context 'with invalid format' do |
| 191 | + it 'should raise ArgumentError' do |
| 192 | + end |
| 193 | + end |
| 194 | + end |
| 195 | + |
| 196 | + describe '#key_position' do |
| 197 | + it 'should return nil if key is not found' do |
| 198 | + described_object = described_class.allocate |
| 199 | + cmdline = ['--foo', '--bar=baz'] |
| 200 | + result = described_object.send(:key_position, cmdline, 'baz') |
| 201 | + expect(result).to be_nil |
| 202 | + end |
| 203 | + |
| 204 | + it 'should return position if key is found as standalone' do |
| 205 | + described_object = described_class.allocate |
| 206 | + cmdline = ['--foo', '--bar=baz'] |
| 207 | + result = described_object.send(:key_position, cmdline, 'foo') |
| 208 | + expect(result).to eq(0) |
| 209 | + end |
| 210 | + |
| 211 | + it 'should return position if key is found as key=val' do |
| 212 | + described_object = described_class.allocate |
| 213 | + cmdline = ['--foo', '--bar=baz'] |
| 214 | + result = described_object.send(:key_position, cmdline, 'bar') |
| 215 | + expect(result).to eq(1) |
| 216 | + end |
147 | 217 | end |
148 | 218 | end |
0 commit comments