diff options
| author | 2025-11-26 19:02:46 -0500 | |
|---|---|---|
| committer | 2025-11-26 19:02:46 -0500 | |
| commit | c77a15eed515fe6dc9b2e831670f4d484e23dace (patch) | |
| tree | 87c79155c0b52b0e59eaf971f2b5bf9d860c77e4 /spec/lib/roo/base_spec.rb | |
| parent | 537c7673bedbb1a2f77a3a088710546cb46506d0 (diff) | |
| parent | c62f8376a13e7a4f493167aba1c66a9201fc59c6 (diff) | |
Update upstream source from tag 'upstream/3.0.0'
Update to upstream version '3.0.0'
with Debian dir ceed7b02bc1417ad11993c466d2350a6b62fbecf
Diffstat (limited to 'spec/lib/roo/base_spec.rb')
| -rw-r--r-- | spec/lib/roo/base_spec.rb | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/spec/lib/roo/base_spec.rb b/spec/lib/roo/base_spec.rb index 9d44656..2d8d8d7 100644 --- a/spec/lib/roo/base_spec.rb +++ b/spec/lib/roo/base_spec.rb @@ -183,10 +183,22 @@ describe Roo::Base do end describe '#each_with_pagename' do - it 'should return an enumerator with all the rows' do - each_with_pagename = spreadsheet.each_with_pagename - expect(each_with_pagename).to be_a(Enumerator) - expect(each_with_pagename.to_a.last).to eq([spreadsheet.default_sheet, spreadsheet]) + context 'when block given' do + it 'iterate with sheet and sheet_name' do + sheet_names = [] + spreadsheet.each_with_pagename do |sheet_name, sheet| + sheet_names << sheet_name + end + expect(sheet_names).to eq ['my_sheet', 'blank sheet'] + end + end + + context 'when called without block' do + it 'should return an enumerator with all the rows' do + each_with_pagename = spreadsheet.each_with_pagename + expect(each_with_pagename).to be_a(Enumerator) + expect(each_with_pagename.to_a.last).to eq([spreadsheet.default_sheet, spreadsheet]) + end end end @@ -277,7 +289,21 @@ EOS end it 'should convert the spreadsheet to csv using the separator when is passed on the parameter' do - expect(spreadsheet.to_csv(nil, ';')).to eq(expected_csv_with_semicolons) + expect(spreadsheet.to_csv(separator: ';')).to eq(expected_csv_with_semicolons) + end + + context 'should contains the deprecation warning message' do + it 'convert the spreadsheet to csv using the separator' do + converting =-> { spreadsheet.to_csv(nil, ';') } + expect(converting.call).to eq(expected_csv_with_semicolons) + expect(&converting).to output(/DEPRECATION.*:separator\b/).to_stderr + end + + it 'be able to arguments: filename, separator, sheet' do + converting =-> { spreadsheet.to_csv(nil, ';', spreadsheet.default_sheet) } + expect(converting.call).to eq(expected_csv_with_semicolons) + expect(&converting).to output(/DEPRECATION.*:sheet\b/).to_stderr + end end end end |
