<commit_before># encoding: utf-8
gem 'minitest'
require 'minitest/autorun'
require_relative '../../runner'
require_relative '../factories/pg_connection'

include CartoDB::Importer

describe 'csv regression tests' do
  it 'imports files exported from the SQL API' do
    filepath    = path_to('ne_10m_populated_places_simple.csv')
    pg_options  = Factories::PGConnection.new.pg_options
    runner      = Runner.new(pg_options, filepath)
    runner.run

    runner.exit_code.must_equal 0
  end

  it 'imports files from Google Fusion Tables' do
    url =
      "https://www.google.com/fusiontables/exporttable" +
      "?query=select+*+from+1dimNIKKwROG1yTvJ6JlMm4-B4LxMs2YbncM4p9g"
    pg_options  = Factories::PGConnection.new.pg_options
    runner      = Runner.new(pg_options, url)
    runner.run

    puts runner.job.logger.to_s
    runner.exit_code.must_equal 0
  end

  def path_to(filepath)
    File.join(File.dirname(__FILE__), "../fixtures/#{filepath}")
  end #path_to
end # csv regression tests
<commit_msg>[importer] Adapt acceptace specs to latest changes<commit_after># encoding: utf-8
gem 'minitest'
require 'minitest/autorun'
require_relative '../../runner'
require_relative '../../job'
require_relative '../../downloader'
require_relative '../factories/pg_connection'

include CartoDB::Importer

describe 'csv regression tests' do
  before do
    pg_options  = Factories::PGConnection.new.pg_options
    @job        = Job.new(pg_options: pg_options)
  end

  it 'imports files exported from the SQL API' do
    filepath    = path_to('ne_10m_populated_places_simple.csv')
    downloader  = Downloader.new(filepath)
    runner      = Runner.new(@job, downloader)
    runner.run

    puts "\n" + runner.report
    runner.exit_code.must_equal 0
  end

  it 'imports files from Google Fusion Tables' do
    url = "https://www.google.com/fusiontables/exporttable" +
          "?query=select+*+from+1dimNIKKwROG1yTvJ6JlMm4-B4LxMs2YbncM4p9g"
    downloader  = Downloader.new(url)
    runner      = Runner.new(@job, downloader)
    runner.run

    puts "\n" + runner.report
    runner.exit_code.must_equal 0
  end

  def path_to(filepath)
    File.join(File.dirname(__FILE__), "../fixtures/#{filepath}")
  end #path_to
end # csv regression tests

{'fraction_non_alphanumeric': 0.11180124223602485, 'fraction_numerical': 0.011535048802129548, 'mean_word_length': 3.6209016393442623, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6951383', 'n_tokens_mistral': 807, 'n_tokens_neox': 772, 'n_words': 162}