Skip to content
This repository has been archived by the owner on Nov 28, 2024. It is now read-only.

Show number of rows processed #286

Merged
merged 5 commits into from
May 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/views/validation/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
<% else %>
<p><%= t(:invalid_html) %></p>
<% end %>

<% if @result.header?
@rows_processed = @result.current_line-1
end
%>
<p><%= "Total Rows Processed = "+ (@rows_processed-1).to_s %></p>
<!--TODO ^ above will return one increment greater than current number of rows, due to current_line's logic-->
<%= link_to '<i class="fa fa-cloud-download"></i> '.html_safe + t(:standardised_csv_download), validation_path(@validation, format: :csv), class: 'btn btn-primary btn-lg' %>

<%= render :partial => 'revalidate' %>
Expand Down
12 changes: 12 additions & 0 deletions features/step_definitions/validation_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
page.body.should include(@url)
end

Then(/^I should see the number of rows processed/) do
page.body.should include("Total Rows Processed")
# TODO - decide how to incorporate the number returned
end

Then(/^the number of rows processed should equal (\d+)/) do | row_count|
page.body.should include("Total Rows Processed = #{row_count}")
# TODO - decide how to incorporate the number returned
end



Then(/^my file should be persisted in the database$/) do
Validation.count.should == 1
Validation.first.filename.should =~ /#{File.basename(@file)}/
Expand Down
13 changes: 13 additions & 0 deletions features/validation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Feature: CSV Validation

Background:
Given the fixture "csvs/valid.csv" is available at the URL "http://example.org/test.csv"
Given the fixture "csvs/3000_rows.csv" is available at the URL "http://example.org/large.csv"
Given the fixture "csvs/info.csv" is available at the URL "http://example.org/info.csv"
Given the fixture "csvs/errors.csv" is available at the URL "http://example.org/errors.csv"
Given the fixture "csvs/revalidate.csv" is available at the URL "http://example.org/revalidate.csv"
Expand Down Expand Up @@ -85,6 +86,18 @@ Feature: CSV Validation
Then I should see a page of validation results
And I should see my URL

Scenario: Validate a large CSV by url
Given I have not already validated the URL "http://example.org/large.csv"
When I load the validation by URL
Then I should get a 202 response
When the CSV has finished processing
And I load the validation by URL
Then I should see a page of validation results
And I should see the number of rows processed
And the number of rows processed should equal 3000
#TODO this is the new addition - decide on how row number is to be evaluated
And I should see my URL

Scenario: Validate a CSV and request badge
Given I have not already validated the URL "http://example.org/test.csv"
When I load the validation badge by URL in "png" format
Expand Down
Loading