cartodb-4.29/spec/models/data_import_regression.rb

29 lines
817 B
Ruby
Raw Permalink Normal View History

2020-06-15 10:58:47 +08:00
require_relative '../spec_helper'
require 'ruby-debug'
describe DataImport do
before(:all) do
::User.all.each(&:destroy)
@user = create_user(:username => 'test', :email => "client@example.com", :password => "clientex")
@table = create_table :user_id => @user.id
end
after(:all) do
bypass_named_maps
@user.destroy
end
folder = ENV['TEST_FILES'] || File.join(File.dirname(__FILE__), '../support/data/')
Dir[folder + '/*'].each do |file|
it "imports #{file}" do
data_import = DataImport.create(
:user_id => @user.id,
:data_source => '/../'+Pathname.new(file).relative_path_from(Pathname.new(Rails.root.to_s)).to_s,
:updated_at => Time.now
).run_import!
table = Table[data_import.table_id]
table.should_not be_nil
end
end
end