Skip to content

Commit

Permalink
don't kak on Pathname in excelx, openoffice
Browse files Browse the repository at this point in the history
  • Loading branch information
lastobelus committed Apr 29, 2015
1 parent e7216e2 commit a527799
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/roo/excelx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def initialize(filename, options = {})

file_type_check(filename,'.xlsx','an Excel-xlsx', file_warning, packed)

@tmpdir = make_tmpdir(filename.split('/').last, options[:tmpdir_root])
@tmpdir = make_tmpdir(File.basename(filename), options[:tmpdir_root])
@filename = local_filename(filename, @tmpdir, packed)
@comments_files = []
@rels_files = []
Expand Down
2 changes: 1 addition & 1 deletion lib/roo/open_office.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(filename, options={})

@only_visible_sheets = options[:only_visible_sheets]
file_type_check(filename,'.ods','an Roo::OpenOffice', file_warning, packed)
@tmpdir = make_tmpdir(filename.split('/').last, options[:tmpdir_root])
@tmpdir = make_tmpdir(File.basename(filename), options[:tmpdir_root])
@filename = local_filename(filename, @tmpdir, packed)
#TODO: @cells_read[:default] = false
Zip::File.open(@filename) do |zip_file|
Expand Down
9 changes: 9 additions & 0 deletions spec/lib/roo/excelx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
expect(Roo::Excelx.new(path, cell_max: 100)).to be_a(Roo::Excelx)
end
end

context 'file path is a Pathname' do
let(:path) { Pathname.new('test/files/file_item_error.xlsx') }

it 'creates an instance' do
expect(subject).to be_a(Roo::Excelx)
end
end

end

describe '#cell' do
Expand Down
11 changes: 11 additions & 0 deletions spec/lib/roo/openoffice_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@
it 'creates an instance' do
expect(subject).to be_a(Roo::OpenOffice)
end

context 'file path is a Pathname' do
subject do
Roo::OpenOffice.new(Pathname.new('test/files/numbers1.ods'))
end

it 'creates an instance' do
expect(subject).to be_a(Roo::OpenOffice)
end
end

end

# OpenOffice is an alias of LibreOffice. See libreoffice_spec.
Expand Down

0 comments on commit a527799

Please sign in to comment.