-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
591412e
commit ed03df5
Showing
5 changed files
with
63 additions
and
4 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
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,7 @@ | ||
%h1 Edit CSV Upload #{csv_upload.id} | ||
|
||
%p= link_to "Show CSV Upload", admin_csv_upload_path(csv_upload) | ||
|
||
= form_with model: [:admin, csv_upload] do |form| | ||
= form.text_field :original_filename, placeholder: "original filename" | ||
= form.button "update" |
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
36 changes: 36 additions & 0 deletions
36
spec/system/csv_uploads/admin_edits_financial_account_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,36 @@ | ||
require "rails_helper" | ||
|
||
describe "Admin edits csv upload" do | ||
include_context "admin password matches" | ||
|
||
scenario "from show page" do | ||
csv_upload = FactoryBot.create(:csv_upload) | ||
visit "/admin/csv_uploads/#{csv_upload.id}" | ||
click_on "Edit CSV Upload" | ||
expect(page).to have_css "h1", text: "Edit CSV Upload #{csv_upload.id}" | ||
expect(page).to have_css "a", text: "Show CSV Upload" | ||
expect(current_path).to eq edit_admin_csv_upload_path(csv_upload) | ||
end | ||
|
||
scenario "edit with errors" do | ||
csv_upload = FactoryBot.create(:csv_upload) | ||
visit "/admin/csv_uploads/#{csv_upload.id}/edit" | ||
fill_in "original filename", with: "" | ||
click_on "update" | ||
expect(page).to have_css ".alert", text: "Original filename can't be blank" | ||
end | ||
|
||
scenario "edit successfully" do | ||
csv_upload = FactoryBot.create( | ||
:csv_upload, | ||
original_filename: "some-gret-data.csl" | ||
) | ||
visit "/admin/csv_uploads/#{csv_upload.id}/edit" | ||
fill_in "original filename", with: "some-great-data.csv" | ||
click_on "update" | ||
|
||
expect(page).to have_css ".notice", text: "CSV Upload updated" | ||
expect(current_path).to eq admin_csv_upload_path(csv_upload) | ||
expect(page).to have_css "td", text: "some-great-data.csv" | ||
end | ||
end |