Fix for Robocop

pull/16326/head
moicalcob 3 years ago
parent 072a1e2d58
commit eb535ac9a7

@ -389,11 +389,11 @@ module CartoDB
end
def try_fix_invalid_field(filepath, command_output)
line = command_output.split("line")[1].split(':')[0].split(',')[0].delete(' ').to_i - 1
column = command_output.split("column")[1].split(':')[0].split(',')[0].delete(' ')
line = command_output.split('line')[1].split(':')[0].split(',')[0].delete(' ').to_i - 1
column = command_output.split('column')[1].split(':')[0].split(',')[0].delete(' ')
csv_content = CSV.read(filepath, headers: true)
csv_content[line][column] = '"' + csv_content[line][column] + '"'
File.open(filepath, "w") {|file| file.puts csv_content.to_s }
csv_content[line][column] = "\"#{csv_content[line][column]}\""
File.open(filepath, 'w') { |file| file.puts csv_content.to_s }
end
end
end

@ -374,7 +374,6 @@ describe 'csv regression tests' do
runner = runner_with_fixture('wrong_date.csv', nil, true)
runner.run
byebug
runner.results.first.success?.should eq true
end
@ -383,14 +382,14 @@ describe 'csv regression tests' do
runner.run
result = runner.results.first
@user.in_database[%Q{
@user.in_database[%{
SELECT *
from #{result.schema}.#{result.table_name}
}].first.fetch(:age).class.should eq (Integer)
}].first.fetch(:age).class.should eq Integer
end
def sample_for(job)
job.db[%Q{
job.db[%{
SELECT *
FROM #{job.qualified_table_name}
}].first

Loading…
Cancel
Save