Sha256: 91b1e9131a21016f93b277facd47422ff35158cf6b227e1a758fe19a50adf01b

Contents?: true

Size: 892 Bytes

Versions: 3

Compression:

Stored size: 892 Bytes

Contents

describe Importer::XlsxReader do

  it 'should load our nanodrop data' do
    importer = Importer.build do
      column :sample_id do
        required!
        validate do |val|
          raise 'Invalid ID' unless val.match(/[0-9]{3,}\.[0-9]\z/)
        end
      end
      column :a260 do
        type :float
      end
      column :a280 do
        type :float
      end
      column :factor do
        type :integer
      end
      
      # Skip empty rows
      filter do |row|
        row.all?
      end
    end
    res = importer.import(SpecHelper.sample_path('nanodrop.xlsx'))
    importer.error_summary.should be_nil
    res.should be_true
    importer.default_sheet.dump.should == [
      {:sample_id => 'Windsor_buccal_500.1', :a260 => 2.574, :a280 => 1.277, :factor => 50},
      {:sample_id => 'Weston_fecal_206.2', :a260 => 0.746, :a280 => 0.351, :factor => 50}
    ]
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
iron-import-0.6.1 spec/importer/xlsx_reader_spec.rb
iron-import-0.6.0 spec/importer/xlsx_reader_spec.rb
iron-import-0.5.0 spec/importer/xlsx_reader_spec.rb