mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 17:28:18 +02:00
added test
This commit is contained in:
parent
0d40feb9c0
commit
7c8c9120b5
5 changed files with 107 additions and 8 deletions
|
@ -1,19 +1,17 @@
|
|||
class ScanCsvRegistryBusinnesContactsJob < ApplicationJob
|
||||
FILE_NAME = './ettevotja_rekvisiidid_init.csv'.freeze
|
||||
|
||||
def perform
|
||||
def perform(filename)
|
||||
BusinessRegistryContact.delete_all
|
||||
|
||||
return p 'File not exist!' unless File.exist?(FILE_NAME)
|
||||
return p 'File not exist!' unless File.exist?(filename)
|
||||
|
||||
enumurate_csv_file
|
||||
enumurate_csv_file(filename)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def enumurate_csv_file
|
||||
def enumurate_csv_file(filename)
|
||||
i = 0
|
||||
CSV.foreach(FILE_NAME, headers: true, col_sep: ';') do |row|
|
||||
CSV.foreach(filename, headers: true, col_sep: ';') do |row|
|
||||
record = BusinessRegistryContact.create(
|
||||
name: row[0],
|
||||
registry_code: row[1],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue