Skip to content

Instantly share code, notes, and snippets.

@aaroncampos
Created February 21, 2009 01:16
Show Gist options
  • Save aaroncampos/67821 to your computer and use it in GitHub Desktop.
Save aaroncampos/67821 to your computer and use it in GitHub Desktop.
Testing CSV import with Cucumber and Ruport
require 'tempfile'
Given /^an import file exists with the following data:$/ do |field_table|
report = Ruport::Data::Table.new(:column_names => field_table.hashes.first.keys)
field_table.hashes.each { |hash| report << hash }
@current_import_file = Tempfile.new("import.csv")
@current_import_file << report.to_csv
@current_import_file.close
end
Scenario: A valid import
Given an import file exists with the following data:
| first name | last name | other info | ... |
| Some | Dude | Random | |
When I import that data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment