Sha256: cb83efcd623d9e6107a265f062e74045aacc74e70cdeb8483dfce573830eff36

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 KB

Contents

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
roo-2.10.1 spec/lib/roo/openoffice_spec.rb
roo-2.10.0 spec/lib/roo/openoffice_spec.rb
roo-2.9.0 spec/lib/roo/openoffice_spec.rb
roo-2.8.3 spec/lib/roo/openoffice_spec.rb
roo-2.8.2 spec/lib/roo/openoffice_spec.rb
roo-2.8.1 spec/lib/roo/openoffice_spec.rb
roo-2.8.0 spec/lib/roo/openoffice_spec.rb
roo-2.7.1 spec/lib/roo/openoffice_spec.rb
roo-2.7.0 spec/lib/roo/openoffice_spec.rb
roo-2.6.0 spec/lib/roo/openoffice_spec.rb