diff options
| author | 2017-06-12 03:37:11 -0400 | |
|---|---|---|
| committer | 2017-06-12 03:37:11 -0400 | |
| commit | 8280a21a23d44aa90177e2bc041d0b8dc8556f4b (patch) | |
| tree | dadef7ee085c0e990a5070bd41b6a5b98c97f4fd /spec/lib/roo/openoffice_spec.rb | |
Import Upstream version 2.7.1upstream/2.7.1
Diffstat (limited to 'spec/lib/roo/openoffice_spec.rb')
| -rw-r--r-- | spec/lib/roo/openoffice_spec.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/lib/roo/openoffice_spec.rb b/spec/lib/roo/openoffice_spec.rb new file mode 100644 index 0000000..9810f45 --- /dev/null +++ b/spec/lib/roo/openoffice_spec.rb @@ -0,0 +1,43 @@ +require 'spec_helper' + +describe Roo::OpenOffice do + describe '.new' do + subject do + Roo::OpenOffice.new('test/files/numbers1.ods') + end + + it 'creates an instance' do + expect(subject).to be_a(Roo::OpenOffice) + end + + context 'for float/integer values' do + context 'integer without point' do + it { expect(subject.cell(3,"A","Sheet4")).to eq(1234) } + it { expect(subject.cell(3,"A","Sheet4")).to be_a(Integer) } + end + + context 'float with point' do + it { expect(subject.cell(3,"B","Sheet4")).to eq(1234.00) } + it { expect(subject.cell(3,"B","Sheet4")).to be_a(Float) } + end + + context 'float with point' do + it { expect(subject.cell(3,"C","Sheet4")).to eq(1234.12) } + it { expect(subject.cell(3,"C","Sheet4")).to be_a(Float) } + end + 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. +end |
