features/step_definitions/format_steps.rb in activeadmin-0.4.4 vs features/step_definitions/format_steps.rb in activeadmin-0.5.0.pre
- old
+ new
@@ -17,18 +17,18 @@
Then /^I should not see a link to download "([^"]*)"$/ do |format_type|
page.should_not have_css("#index_footer a", :text => format_type)
end
# Check first rows of the displayed CSV.
-Then /^I should download a CSV file for "([^"]*)" containing:$/ do |resource_name, table|
+Then /^I should download a CSV file with "([^"]*)" separator for "([^"]*)" containing:$/ do |sep, resource_name, table|
page.response_headers['Content-Type'].should == 'text/csv; charset=utf-8'
csv_filename = "#{resource_name}-#{Time.now.strftime("%Y-%m-%d")}.csv"
page.response_headers['Content-Disposition'].should == %{attachment; filename="#{csv_filename}"}
body = page.driver.response.body
begin
- csv = CSVLib.parse(body)
+ csv = CSVLib.parse(body, :col_sep => sep)
table.raw.each_with_index do |expected_row, row_index|
expected_row.each_with_index do |expected_cell, col_index|
cell = csv.try(:[], row_index).try(:[], col_index)
if expected_cell.blank?
cell.should be_nil
@@ -43,5 +43,9 @@
puts "to match:"
p csv
raise $!
end
end
+
+Then /^I should download a CSV file for "([^"]*)" containing:$/ do |resource_name, table|
+ step "I should download a CSV file with \",\" separator for \"#{resource_name}\" containing:", table
+end
\ No newline at end of file