Sha256: 41f6a8dcd8e36912085a4b77636d656abcad4d0202b1eccb6d283ddf9161aabc

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "ImportEverything" do
  describe Preview do
    describe 'csv' do
      before do
        @preview = Preview.new(:filename => spec_file('players.csv'), :table => 'players')
      end
      it 'ready' do
        @preview.should be_ready
      end
      it 'values' do
        table = @preview.preview_table
        table.row_value_arrays.first.should == ['Albert','Pujols',29]
        table.row_value_arrays.should size(3)
      end
      it 'keys' do
        @preview.preview_table.keys.should == ['first','last','age']
      end
    end
    
    describe 'xml' do
      before do
        @preview = Preview.new(:filename => spec_file('players.xml'))
        #@preview.table_paths = nil
      end
      it 'should need fields' do
        @preview.addl_required_fields.should == [:root_path,:table_paths]
      end
      it 'can set needed fields' do
        @preview.root_path = 'abc'
        @preview.addl_required_fields.should == [:table_paths]
      end
      describe 'ready' do
        before do
          @preview.root_path = 'top'
          @preview.table_paths = [['players','player']]
        end
        it 'ready' do
          @preview.should be_ready
        end
        it 'values' do
          @preview.table.row_value_arrays.first.should == ['Albert','Pujols',29]
        end
      end
    end
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
import_everything-0.1.6 spec/preview_spec.rb
import_everything-0.1.5 spec/preview_spec.rb
import_everything-0.1.3 spec/preview_spec.rb
import_everything-0.1.2 spec/preview_spec.rb
import_everything-0.1.0 spec/preview_spec.rb