Skip to content

Instantly share code, notes, and snippets.

@theist
Created October 27, 2016 22:06
Show Gist options
  • Save theist/342fc1c826814c54a999f48a345e097a to your computer and use it in GitHub Desktop.
Save theist/342fc1c826814c54a999f48a345e097a to your computer and use it in GitHub Desktop.
rspec sample 1
require 'csv'
require 'excon'
# Cargamos los datos de redirecciones
csv_data = CSV(File.open('redirects.csv').read).read
#borramos la columna de encabezado
csv_data.delete_at(0)
# Configuramos excon para que no verifique el SSL y tenga un timeout bajo
Excon.defaults[:ssl_verify_peer] = false
Excon.defaults[:read_timeout] = 10
csv_data.each do |redirect|
# trabajamos con el tipico CSV "origen -> destino"
origin = redirect[0]
destination = redirect[1]
# Code!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment