Skip to content

Commit 74d2e58

Browse files
committed
Add dedicated pending test to document undesired behavior
1 parent 6c487aa commit 74d2e58

File tree

1 file changed

+40
-6
lines changed

1 file changed

+40
-6
lines changed

spec/gp_update_metadata_source_spec.rb

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
File.write(file_1_path, 'value 1')
3131
file_2_path = File.join(dir, '2.txt')
3232
File.write(file_2_path, 'value 2')
33-
file_3_path = File.join(dir, '3.txt')
34-
File.write(file_3_path, 'value 3')
3533

3634
described_class.run(
3735
po_file_path: output_path,
@@ -40,8 +38,7 @@
4038
release_note: release_notes_path,
4139
whats_new: whats_new_path,
4240
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
4542
}
4643
)
4744

@@ -52,8 +49,6 @@
5249
# - The new line after each block is added by the conversion
5350
# - That there's no new line between release_note_0122 and key1, because
5451
# 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
5752
expected = <<~PO
5853
msgctxt "v1.23-whats-new"
5954
msgid ""
@@ -83,4 +78,43 @@
8378
expect(File.read(output_path)).to eq(expected)
8479
end
8580
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
86120
end

0 commit comments

Comments
 (0)