|
131 | 131 | it_behaves_like 'populated task node'
|
132 | 132 | end
|
133 | 133 |
|
| 134 | + context 'when task has meta_data' do |
| 135 | + let(:custom_namespaces) { [{prefix: 'namespace', uri: 'custom_namespace.org'}] } |
| 136 | + let(:task) do |
| 137 | + build(:task, :populated, meta_data: {namespace: {meta: 'data', nested: {test: {abc: '123'}, foo: 'bar'}}}) |
| 138 | + end |
| 139 | + let(:meta_data_node) { doc.xpath('/xmlns:task/xmlns:meta-data') } |
| 140 | + |
| 141 | + it_behaves_like 'task node' |
| 142 | + it_behaves_like 'populated task node' |
| 143 | + |
| 144 | + it 'adds meta-data node task node' do |
| 145 | + expect(meta_data_node).to have(1).items |
| 146 | + end |
| 147 | + |
| 148 | + it 'adds two children nodes to meta-data node' do |
| 149 | + expect(meta_data_node.children).to have(2).items |
| 150 | + end |
| 151 | + |
| 152 | + it 'adds meta node with correct namespace to meta-data node' do |
| 153 | + expect(meta_data_node.xpath('namespace:meta').text).to eql 'data' |
| 154 | + end |
| 155 | + |
| 156 | + it 'adds nested test node with correct namespace to meta-data node' do |
| 157 | + expect(meta_data_node.xpath('namespace:nested/namespace:foo').text).to eql 'bar' |
| 158 | + end |
| 159 | + |
| 160 | + it 'adds multiple times nested node with correct namespace to meta-data node' do |
| 161 | + expect(meta_data_node.xpath('namespace:nested/namespace:test/namespace:abc').text).to eql '123' |
| 162 | + end |
| 163 | + end |
| 164 | + |
134 | 165 | context 'when a populated task with embedded text file is supplied' do
|
135 | 166 | let(:task) { build(:task, :populated, :with_embedded_txt_file) }
|
136 | 167 | let(:file) { task.all_files.filter { |file| file.id != 'ms-placeholder-file' }.first }
|
|
280 | 311 | end
|
281 | 312 |
|
282 | 313 | context 'when test has meta-data' do
|
| 314 | + let(:custom_namespaces) { [{prefix: 'namespace', uri: 'custom_namespace.org'}] } |
283 | 315 | let(:task) do
|
284 |
| - build(:task, :populated, tests: build_list(:test, 1, meta_data: [{namespace: 'test', key: 'test', value: 'data'}, |
285 |
| - {namespace: 'test', key: 'meta', value: 'data'}])) |
| 316 | + build(:task, :populated, |
| 317 | + tests: build_list(:test, 1, meta_data: {namespace: {meta: 'data', nested: {test: {abc: '123'}, foo: 'bar'}}})) |
286 | 318 | end
|
287 | 319 | let(:meta_data_node) { doc.xpath('/xmlns:task/xmlns:tests/xmlns:test/xmlns:test-configuration/xmlns:test-meta-data') }
|
288 | 320 |
|
|
296 | 328 | expect(meta_data_node.children).to have(2).items
|
297 | 329 | end
|
298 | 330 |
|
299 |
| - it 'adds test node with correct namespace to test-meta-data node' do |
300 |
| - expect(meta_data_node.xpath('test:test').text).to eql 'data' |
| 331 | + it 'adds meta node with correct namespace to test-meta-data node' do |
| 332 | + expect(meta_data_node.xpath('namespace:meta').text).to eql 'data' |
301 | 333 | end
|
302 | 334 |
|
303 |
| - it 'adds meta node with correct namespace to test-meta-data node' do |
304 |
| - expect(meta_data_node.xpath('test:meta').text).to eql 'data' |
| 335 | + it 'adds nested node with correct namespace to test-meta-data node' do |
| 336 | + expect(meta_data_node.xpath('namespace:nested/namespace:foo').text).to eql 'bar' |
| 337 | + end |
| 338 | + |
| 339 | + it 'adds multiple times nested node with correct namespace to test-meta-data node' do |
| 340 | + expect(meta_data_node.xpath('namespace:nested/namespace:test/namespace:abc').text).to eql '123' |
305 | 341 | end
|
306 | 342 | end
|
307 | 343 |
|
|
0 commit comments