Sha256: db55b41114a4a43a27a0450588fa64f61429a75f551a7eae4f63820ec954b672
Contents?: true
Size: 811 Bytes
Versions: 20
Compression:
Stored size: 811 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "COPY FROM BINARY" do before(:each) do ActiveRecord::Base.connection.execute %{ TRUNCATE TABLE test_models; SELECT setval('test_models_id_seq', 1, false); } end it "should import from file if path is passed without field_map" do TestModel.copy_from File.expand_path('spec/fixtures/2_col_binary_data.dat'), :format => :binary, columns: [:id, :data] TestModel.order(:id).map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'text'}] end it "should import from file if columns are not specified" do TestModel.copy_from File.expand_path('spec/fixtures/2_col_binary_data.dat'), :format => :binary TestModel.order(:id).map{|r| r.attributes}.should == [{'id' => 1, 'data' => 'text'}] end end
Version data entries
20 entries across 20 versions & 1 rubygems