File: openoffice_spec.rb

package info (click to toggle)
ruby-roo 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 8,216 kB
  • sloc: ruby: 6,529; xml: 88; makefile: 6
file content (43 lines) | stat: -rw-r--r-- 1,150 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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