Skip to content

Commit debb898

Browse files
davichpythonicrubyist
authored andcommitted
Ampersand escaped failing test (#75)
* Failing test to show that ampersand gets escaped * Added working example for when xlsx file uses shared strings
1 parent caf40b6 commit debb898

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

spec/fixtures/escaped.xlsx

3.47 KB
Binary file not shown.

spec/fixtures/escaped2.xlsx

8.37 KB
Binary file not shown.

spec/sheet_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ def load_cell(rows, cell_name)
1212
cell[cell_name] if cell
1313
end
1414

15+
context 'escaped ampersand' do
16+
let(:book_escaped) { Creek::Book.new('spec/fixtures/escaped.xlsx') }
17+
it 'does NOT escape ampersand' do
18+
expect(book_escaped.sheets[0].rows.to_enum.map(&:values)).to eq([["abc", "def"], ["ghi", "j&k"]])
19+
end
20+
21+
let(:book_escaped2) { Creek::Book.new('spec/fixtures/escaped2.xlsx') }
22+
it 'does escape ampersand' do
23+
expect(book_escaped2.sheets[0].rows.to_enum.map(&:values)).to eq([["abc", "def"], ["ghi", "j&k"]])
24+
end
25+
end
26+
1527
describe '#rows' do
1628
context 'with excel with images' do
1729
context 'with images preloading' do

0 commit comments

Comments
 (0)