diff --git a/spec/fixtures/escaped.xlsx b/spec/fixtures/escaped.xlsx new file mode 100644 index 0000000..a8ee772 Binary files /dev/null and b/spec/fixtures/escaped.xlsx differ diff --git a/spec/fixtures/escaped2.xlsx b/spec/fixtures/escaped2.xlsx new file mode 100644 index 0000000..7a70942 Binary files /dev/null and b/spec/fixtures/escaped2.xlsx differ diff --git a/spec/sheet_spec.rb b/spec/sheet_spec.rb index 887109e..4d2ef14 100644 --- a/spec/sheet_spec.rb +++ b/spec/sheet_spec.rb @@ -12,6 +12,18 @@ def load_cell(rows, cell_name) cell[cell_name] if cell end + context 'escaped ampersand' do + let(:book_escaped) { Creek::Book.new('spec/fixtures/escaped.xlsx') } + it 'does NOT escape ampersand' do + expect(book_escaped.sheets[0].rows.to_enum.map(&:values)).to eq([["abc", "def"], ["ghi", "j&k"]]) + end + + let(:book_escaped2) { Creek::Book.new('spec/fixtures/escaped2.xlsx') } + it 'does escape ampersand' do + expect(book_escaped2.sheets[0].rows.to_enum.map(&:values)).to eq([["abc", "def"], ["ghi", "j&k"]]) + end + end + describe '#rows' do context 'with excel with images' do context 'with images preloading' do