Sha256: 797dc5d6b895cd7c4bda35d6dab66cfb91bc8deb7753700599bbf7924f2da2d3

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe Roo::CSV do
  let(:path) { 'test/files/csvtypes.csv' }
  let(:csv) { Roo::CSV.new(path) }

  describe '.new' do
    it 'creates an instance' do
      expect(csv).to be_a(Roo::CSV)
    end
  end

  describe '#parse' do
    subject {
      csv.parse(options)
    }
    context 'with headers: true' do
      let(:options) { {headers: true} }

      it "doesn't blow up" do
        expect { subject }.to_not raise_error
      end
    end
  end

  describe '#csv_options' do
    context 'when created with the csv_options option' do
      let(:options) {
        {
          col_sep: '\t',
          quote_char: "'"
        }
      }

      it 'returns the csv options' do
        csv = Roo::CSV.new(path, csv_options: options)
        csv.csv_options.should == options
      end
    end

    context 'when created without the csv_options option' do
      it 'returns a hash' do
        csv = Roo::CSV.new(path)
        csv.csv_options.should == {}
      end
    end
  end
end

describe Roo::Csv do
  it 'is an alias of LibreOffice' do
    expect(Roo::Csv).to eq(Roo::CSV)
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/roo-1.13.2/spec/lib/roo/csv_spec.rb
roo-1.13.2 spec/lib/roo/csv_spec.rb
roo-1.13.1 spec/lib/roo/csv_spec.rb
roo-1.13.0 spec/lib/roo/csv_spec.rb
roo-1.12.2 spec/lib/roo/csv_spec.rb
roo-1.12.1 spec/lib/roo/csv_spec.rb
roo-1.12.0 spec/lib/roo/csv_spec.rb