|
30 | 30 | File.write(file_1_path, 'value 1')
|
31 | 31 | file_2_path = File.join(dir, '2.txt')
|
32 | 32 | File.write(file_2_path, 'value 2')
|
33 |
| - file_3_path = File.join(dir, '3.txt') |
34 |
| - File.write(file_3_path, 'value 3') |
35 | 33 |
|
36 | 34 | described_class.run(
|
37 | 35 | po_file_path: output_path,
|
|
40 | 38 | release_note: release_notes_path,
|
41 | 39 | whats_new: whats_new_path,
|
42 | 40 | key1: file_1_path,
|
43 |
| - key2: file_2_path, |
44 |
| - key3: file_3_path # This is not in the input .po and won't be added |
| 41 | + key2: file_2_path |
45 | 42 | }
|
46 | 43 | )
|
47 | 44 |
|
|
52 | 49 | # - The new line after each block is added by the conversion
|
53 | 50 | # - That there's no new line between release_note_0122 and key1, because
|
54 | 51 | # the notes are copied as they are with no extra manipulation
|
55 |
| - # - The key3 source is not part of the output because was not in the |
56 |
| - # original .po input |
57 | 52 | expected = <<~PO
|
58 | 53 | msgctxt "v1.23-whats-new"
|
59 | 54 | msgid ""
|
|
83 | 78 | expect(File.read(output_path)).to eq(expected)
|
84 | 79 | end
|
85 | 80 | end
|
| 81 | + |
| 82 | + it 'adds entries passed as input even if not part of the original `.po` file' do |
| 83 | + pending 'this currently fails and will be addressed as part of the upcoming refactor/rewrite of the functionality' |
| 84 | + Dir.mktmpdir do |dir| |
| 85 | + output_path = File.join(dir, 'output.po') |
| 86 | + dummy_text = <<~PO |
| 87 | + msgctxt "key1" |
| 88 | + msgid "this value should change" |
| 89 | + msgstr "" |
| 90 | + PO |
| 91 | + File.write(output_path, dummy_text) |
| 92 | + |
| 93 | + # 2: Create source files with value to insert in the .po |
| 94 | + file_1_path = File.join(dir, '1.txt') |
| 95 | + File.write(file_1_path, 'value 1') |
| 96 | + file_2_path = File.join(dir, '2.txt') |
| 97 | + File.write(file_2_path, 'value 2') |
| 98 | + |
| 99 | + described_class.run( |
| 100 | + po_file_path: output_path, |
| 101 | + source_files: { |
| 102 | + key1: file_1_path, |
| 103 | + key2: file_2_path |
| 104 | + } |
| 105 | + ) |
| 106 | + |
| 107 | + expected = <<~PO |
| 108 | + msgctxt "key1" |
| 109 | + msgid "value 1" |
| 110 | + msgstr "" |
| 111 | +
|
| 112 | + msgctxt "key2" |
| 113 | + msgid "value 2" |
| 114 | + msgstr "" |
| 115 | +
|
| 116 | + PO |
| 117 | + expect(File.read(output_path)).to eq(expected) |
| 118 | + end |
| 119 | + end |
86 | 120 | end
|
0 commit comments