Skip to content

Instantly share code, notes, and snippets.

@liangzan
Created August 31, 2009 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liangzan/178501 to your computer and use it in GitHub Desktop.
Save liangzan/178501 to your computer and use it in GitHub Desktop.
Before('@upload') do
$upload_path = File.join(RAILS_ROOT, 'features', 'upload_files')
end
After('@upload') do
Dir.foreach($upload_path) do |file|
file_path = File.join($upload_path, file)
if file == '.' or file == '..' then next
else File.delete(file_path)
end
end
end
module UploadFileHelpers
def create_csv_file(file_name, csv_values)
file_path = File.join($upload_path, file_name)
File.open(file_path, "w") do |file|
file.puts csv_values
end
end
end
World(UploadFileHelpers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment