-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add specs for wizard and system specs for altered views
- Loading branch information
Showing
10 changed files
with
102 additions
and
40 deletions.
There are no files selected for viewing
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
4 changes: 2 additions & 2 deletions
4
spec/fixtures/claims/sampling/invalid_example_sampling_upload.csv
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
claim_reference,sample_reason | ||
11111111,Valid paid claim | ||
22222222,Invalid claim | ||
88888888,Valid reason | ||
11111111, |
2 changes: 2 additions & 0 deletions
2
spec/fixtures/claims/sampling/invalid_headers_sampling_upload.csv
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
claim_refrence,sampl_reason | ||
11111111,Random audit |
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
72 changes: 72 additions & 0 deletions
72
...rt/claims/sampling/upload_data/support_user_uploads_a_csv_file_with_wrong_headers_spec.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "Support user uploads a CSV file with the wrong headers", | ||
service: :claims, | ||
type: :system do | ||
scenario do | ||
given_claims_exist | ||
and_i_am_signed_in | ||
|
||
when_i_navigate_to_the_sampling_claims_index_page | ||
then_i_see_the_sampling_claims_index_page | ||
|
||
when_i_click_on_upload_claims_to_be_audited | ||
then_i_see_the_upload_csv_page | ||
|
||
when_i_upload_a_csv_file_not_containing_invalid_headers | ||
and_i_click_on_upload_csv_file | ||
then_i_see_validation_error_regarding_invalid_headers | ||
end | ||
|
||
private | ||
|
||
def given_claims_exist | ||
@paid_claim_1 = create(:claim, :submitted, status: :paid, reference: 11_111_111) | ||
end | ||
|
||
def and_i_am_signed_in | ||
sign_in_claims_support_user | ||
end | ||
|
||
def when_i_navigate_to_the_sampling_claims_index_page | ||
within primary_navigation do | ||
click_on "Claims" | ||
end | ||
|
||
within secondary_navigation do | ||
click_on "Auditing" | ||
end | ||
end | ||
|
||
def then_i_see_the_sampling_claims_index_page | ||
expect(page).to have_title("Claims - Claim funding for mentor training - GOV.UK") | ||
expect(page).to have_h1("Claims") | ||
expect(primary_navigation).to have_current_item("Claims") | ||
expect(secondary_navigation).to have_current_item("Auditing") | ||
expect(page).to have_current_path(claims_support_claims_samplings_path, ignore_query: true) | ||
end | ||
|
||
def then_i_see_the_upload_csv_page | ||
expect(page).to have_h1("Upload claims to be audited") | ||
have_element(:span, text: "Auditing", class: "govuk-caption-l") | ||
expect(page).to have_element(:label, text: "Upload CSV file") | ||
end | ||
|
||
def when_i_click_on_upload_claims_to_be_audited | ||
click_on "Upload claims to be audited" | ||
end | ||
|
||
def and_i_click_on_upload_csv_file | ||
click_on "Upload CSV file" | ||
end | ||
|
||
def when_i_upload_a_csv_file_not_containing_invalid_headers | ||
attach_file "Upload CSV file", | ||
"spec/fixtures/claims/sampling/invalid_headers_sampling_upload.csv" | ||
end | ||
|
||
def then_i_see_validation_error_regarding_invalid_headers | ||
expect(page).to have_css(".govuk-error-summary__list", text: "Your file needs a column called ‘claim_reference’ and ‘sample_reason’") | ||
expect(page).to have_css(".govuk-error-summary__list", text: "Right now it has columns called ‘claim_refrence’ and ‘sampl_reason’.") | ||
end | ||
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
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
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
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
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