Skip to content

Commit 46dbe3c

Browse files
committed
added error handling to urn upload and spec
1 parent 9ab22ab commit 46dbe3c

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

app/controllers/admin/urn_lists_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ def create
1818
return redirect_to admin_urn_lists_path
1919
end
2020

21-
render action: :new
21+
rescue ActionController::ParameterMissing
22+
redirect_to new_admin_urn_list_path, alert: 'Please choose a file to upload'
2223
end
2324

2425
def download

spec/features/admin_can_upload_urn_list_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,14 @@
2424

2525
expect(UrnListImporterJob).to have_been_enqueued
2626
end
27+
28+
context 'without attaching a file' do
29+
scenario 'displays an error' do
30+
visit new_admin_urn_list_path
31+
32+
click_button 'Upload'
33+
34+
expect(page).to have_text 'Please choose a file to upload'
35+
end
36+
end
2737
end

0 commit comments

Comments
 (0)