Created
February 21, 2009 01:16
-
-
Save aaroncampos/67821 to your computer and use it in GitHub Desktop.
Testing CSV import with Cucumber and Ruport
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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