Sha256: 3dd85b3125b9318b28b496404c2385e53ca6c796f02cccc17cea58686e9a2296

Contents?: true

Size: 1.12 KB

Versions: 7

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(Fixnum) }
      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

7 entries across 7 versions & 1 rubygems

Version Path
roo-2.5.1 spec/lib/roo/openoffice_spec.rb
roo-2.5.0 spec/lib/roo/openoffice_spec.rb
roo-2.4.0 spec/lib/roo/openoffice_spec.rb
roo-2.3.2 spec/lib/roo/openoffice_spec.rb
roo-2.3.1 spec/lib/roo/openoffice_spec.rb
roo-2.3.0 spec/lib/roo/openoffice_spec.rb
roo-2.2.0 spec/lib/roo/openoffice_spec.rb