Skip to content

Commit

Permalink
Updates to syntax and tests for ruby 3
Browse files Browse the repository at this point in the history
  • Loading branch information
bbpennel committed Oct 11, 2024
1 parent a1e46ae commit 6386d10
Show file tree
Hide file tree
Showing 16 changed files with 166 additions and 153 deletions.
4 changes: 2 additions & 2 deletions app/overrides/jobs/attach_files_to_work_job_override.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

def perform(work, uploaded_files, **work_attributes)
uploaded_files.each do |uploaded_file|
# [hyc-override] check all files for viruses
# [hyc-override] check all files for viruses
virus_check!(uploaded_file)
end
original_perform(work, uploaded_files, work_attributes)
original_perform(work, uploaded_files, **work_attributes)
# [hyc-override] Log viruses
rescue VirusDetectedError => error
user = User.find_by_user_key(proxy_or_depositor(work))
Expand Down
2 changes: 1 addition & 1 deletion app/services/tasks/dimensions_ingest_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def extract_pdf(publication)
headers['Wiley-TDM-Client-Token'] = "#{@wiley_tdm_api_token}"
else
# Use the encoded linkout URL from dimensions otherwise
encoded_url = URI.encode(pdf_url)
encoded_url = URI::DEFAULT_PARSER.escape(pdf_url)
end
download_pdf(encoded_url, publication, headers)
end
Expand Down
18 changes: 9 additions & 9 deletions spec/features/create_article_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@

# required fields
fill_in 'Title', with: 'Test Article work'
fill_in 'Creator', { with: 'Test Default Creator', id: 'article_creators_attributes_0_name' }
fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'article_creators_attributes_0_orcid' }
fill_in 'Creator', with: 'Test Default Creator', id: 'article_creators_attributes_0_name'
fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'article_creators_attributes_0_orcid'
select 'Department of Biology', from: 'article_creators_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'article_creators_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'article_creators_attributes_0_other_affiliation'
fill_in 'Abstract', with: 'some abstract'
fill_in 'Date of publication', with: '2018-10-03'

Expand Down Expand Up @@ -180,10 +180,10 @@

# required fields
fill_in 'Title', with: 'Test Article work'
fill_in 'Creator', { with: 'Test Default Creator', id: 'article_creators_attributes_0_name' }
fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'article_creators_attributes_0_orcid' }
fill_in 'Creator', with: 'Test Default Creator', id: 'article_creators_attributes_0_name'
fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'article_creators_attributes_0_orcid'
select 'Department of Biology', from: 'article_creators_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'article_creators_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'article_creators_attributes_0_other_affiliation'
fill_in 'Abstract', with: 'some abstract'
fill_in 'Date of publication', with: '2018-10-03'

Expand Down Expand Up @@ -217,10 +217,10 @@
select 'Yes', from: 'article_peer_review_status'
fill_in 'Place of publication', with: 'UNC'
fill_in 'Rights holder', with: 'an author'
fill_in 'Translator', { with: 'translator', id: 'article_translators_attributes_0_name' }
fill_in 'ORCID', { with: 'translator orcid', id: 'article_translators_attributes_0_orcid' }
fill_in 'Translator', with: 'translator', id: 'article_translators_attributes_0_name'
fill_in 'ORCID', with: 'translator orcid', id: 'article_translators_attributes_0_orcid'
select 'Department of Biology', from: 'article_translators_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'article_translators_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'article_translators_attributes_0_other_affiliation'
fill_in 'Rights notes', with: 'some rights notes'

expect(page).to have_selector('#article_language_label', visible: false)
Expand Down
12 changes: 6 additions & 6 deletions spec/features/create_artwork_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@

# required fields
fill_in 'Title', with: 'Test Artwork work'
fill_in 'Creator', { with: 'Test Default Creator', id: 'artwork_creators_attributes_0_name' }
fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'artwork_creators_attributes_0_orcid' }
fill_in 'Creator', with: 'Test Default Creator', id: 'artwork_creators_attributes_0_name'
fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'artwork_creators_attributes_0_orcid'
select 'Department of Biology', from: 'artwork_creators_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'artwork_creators_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'artwork_creators_attributes_0_other_affiliation'
fill_in 'Date of publication', with: '2018-10-03'
fill_in 'Abstract', with: 'a description'
fill_in 'Extent', with: 'some extent'
Expand Down Expand Up @@ -145,10 +145,10 @@
fill_in 'DOI', with: 'some-doi'
select 'Attribution 3.0 United States', from: 'artwork_license'
select 'In Copyright', from: 'artwork_rights_statement'
fill_in 'Creator', { with: 'Test Default Creator', id: 'artwork_creators_attributes_0_name' }
fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'artwork_creators_attributes_0_orcid' }
fill_in 'Creator', with: 'Test Default Creator', id: 'artwork_creators_attributes_0_name'
fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'artwork_creators_attributes_0_orcid'
select 'Department of Biology', from: 'artwork_creators_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'artwork_creators_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'artwork_creators_attributes_0_other_affiliation'

expect(page).to have_selector('#artwork_license_label', visible: false)
expect(page).to have_selector('#artwork_rights_statement_label', visible: false)
Expand Down
48 changes: 24 additions & 24 deletions spec/features/create_data_set_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,34 +65,34 @@

# required fields
fill_in 'Title', with: 'Test Data Set'
fill_in 'Creator', { with: 'Test Default Creator', id: 'data_set_creators_attributes_0_name' }
fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'data_set_creators_attributes_0_orcid' }
fill_in 'Creator', with: 'Test Default Creator', id: 'data_set_creators_attributes_0_name'
fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'data_set_creators_attributes_0_orcid'
select 'Department of Biology', from: 'data_set_creators_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'data_set_creators_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'data_set_creators_attributes_0_other_affiliation'
select 'Text', from: 'data_set_kind_of_data'
select 'Dataset', from: 'data_set_resource_type'
fill_in 'Abstract', with: 'some abstract'
fill_in 'Methods', with: 'My methodology'
fill_in 'Date of publication', with: '2018-10-03'

# extra fields
fill_in 'Contributor', { with: 'contributor', id: 'data_set_contributors_attributes_0_name' }
fill_in 'ORCID', { with: 'contributor orcid', id: 'data_set_contributors_attributes_0_orcid' }
fill_in 'Contributor', with: 'contributor', id: 'data_set_contributors_attributes_0_name'
fill_in 'ORCID', with: 'contributor orcid', id: 'data_set_contributors_attributes_0_orcid'
select 'Department of Biology', from: 'data_set_contributors_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'data_set_contributors_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'data_set_contributors_attributes_0_other_affiliation'
fill_in 'Funder', with: 'some funder'
find('#data_set_based_near_attributes_0_id', visible: false).set('http://sws.geonames.org/4460162/')
fill_in 'Keyword', with: 'Test Default Keyword'
fill_in 'Last modified date', with: '2018-10-03'
select 'Attribution 4.0 International', from: 'data_set_license'
fill_in 'Project Director', { with: 'project director', id: 'data_set_project_directors_attributes_0_name' }
fill_in 'ORCID', { with: 'project director orcid', id: 'data_set_project_directors_attributes_0_orcid' }
fill_in 'Project Director', with: 'project director', id: 'data_set_project_directors_attributes_0_name'
fill_in 'ORCID', with: 'project director orcid', id: 'data_set_project_directors_attributes_0_orcid'
select 'Department of Biology', from: 'data_set_project_directors_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'data_set_project_directors_attributes_0_other_affiliation' }
fill_in 'Researcher', { with: 'researcher', id: 'data_set_researchers_attributes_0_name' }
fill_in 'ORCID', { with: 'researcher orcid', id: 'data_set_researchers_attributes_0_orcid' }
fill_in 'Additional affiliation', with: 'UNC', id: 'data_set_project_directors_attributes_0_other_affiliation'
fill_in 'Researcher', with: 'researcher', id: 'data_set_researchers_attributes_0_name'
fill_in 'ORCID', with: 'researcher orcid', id: 'data_set_researchers_attributes_0_orcid'
select 'Department of Biology', from: 'data_set_researchers_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'data_set_researchers_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'data_set_researchers_attributes_0_other_affiliation'
fill_in 'Related resource URL', with: 'something.com'
fill_in 'Sponsor', with: 'a sponsor'
fill_in 'Subject', with: 'test'
Expand Down Expand Up @@ -171,20 +171,20 @@

# required fields
fill_in 'Title', with: 'Test Data Set'
fill_in 'Creator', { with: 'Test Default Creator', id: 'data_set_creators_attributes_0_name' }
fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'data_set_creators_attributes_0_orcid' }
fill_in 'Creator', with: 'Test Default Creator', id: 'data_set_creators_attributes_0_name'
fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'data_set_creators_attributes_0_orcid'
select 'Department of Biology', from: 'data_set_creators_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'data_set_creators_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'data_set_creators_attributes_0_other_affiliation'
select 'Text', from: 'data_set_kind_of_data'
select 'Dataset', from: 'data_set_resource_type'
fill_in 'Methods', with: 'My methodology'
fill_in 'Date of publication', with: '2018-10-03'

# extra fields
fill_in 'Contributor', { with: 'contributor', id: 'data_set_contributors_attributes_0_name' }
fill_in 'ORCID', { with: 'contributor orcid', id: 'data_set_contributors_attributes_0_orcid' }
fill_in 'Contributor', with: 'contributor', id: 'data_set_contributors_attributes_0_name'
fill_in 'ORCID', with: 'contributor orcid', id: 'data_set_contributors_attributes_0_orcid'
select 'Department of Biology', from: 'data_set_contributors_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'data_set_contributors_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'data_set_contributors_attributes_0_other_affiliation'
fill_in 'Copyright date', with: '2018'
fill_in 'DOI', with: 'some-doi'
fill_in 'Extent', with: 'some extent'
Expand All @@ -193,14 +193,14 @@
fill_in 'Keyword', with: 'Test Default Keyword'
fill_in 'Last modified date', with: '2018-10-03'
select 'Attribution 3.0 United States', from: 'data_set_license'
fill_in 'Project Director', { with: 'project director', id: 'data_set_project_directors_attributes_0_name' }
fill_in 'ORCID', { with: 'project director orcid', id: 'data_set_project_directors_attributes_0_orcid' }
fill_in 'Project Director', with: 'project director', id: 'data_set_project_directors_attributes_0_name'
fill_in 'ORCID', with: 'project director orcid', id: 'data_set_project_directors_attributes_0_orcid'
select 'Department of Biology', from: 'data_set_project_directors_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'data_set_project_directors_attributes_0_other_affiliation' }
fill_in 'Researcher', { with: 'researcher', id: 'data_set_researchers_attributes_0_name' }
fill_in 'ORCID', { with: 'researcher orcid', id: 'data_set_researchers_attributes_0_orcid' }
fill_in 'Additional affiliation', with: 'UNC', id: 'data_set_project_directors_attributes_0_other_affiliation'
fill_in 'Researcher', with: 'researcher', id: 'data_set_researchers_attributes_0_name'
fill_in 'ORCID', with: 'researcher orcid', id: 'data_set_researchers_attributes_0_orcid'
select 'Department of Biology', from: 'data_set_researchers_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'data_set_researchers_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'data_set_researchers_attributes_0_other_affiliation'
fill_in 'Rights holder', with: 'an author'
fill_in 'Related resource URL', with: 'something.com'
select 'In Copyright', from: 'data_set_rights_statement'
Expand Down
24 changes: 12 additions & 12 deletions spec/features/create_dissertation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,24 @@

# required fields
fill_in 'Title', with: 'Test Dissertation work'
fill_in 'Creator', { with: 'Test Default Creator', id: 'dissertation_creators_attributes_0_name' }
fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'dissertation_creators_attributes_0_orcid' }
fill_in 'Creator', with: 'Test Default Creator', id: 'dissertation_creators_attributes_0_name'
fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'dissertation_creators_attributes_0_orcid'
select 'Department of Biology', from: 'dissertation_creators_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'dissertation_creators_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'dissertation_creators_attributes_0_other_affiliation'
fill_in 'Date of publication', with: '2018-10-03'
fill_in 'Degree granting institution', with: 'UNC'

# extra fields
fill_in 'Abstract', with: 'some abstract'
fill_in 'Advisor', { with: 'advisor', id: 'dissertation_advisors_attributes_0_name' }
fill_in 'ORCID', { with: 'advisor orcid', id: 'dissertation_advisors_attributes_0_orcid' }
fill_in 'Advisor', with: 'advisor', id: 'dissertation_advisors_attributes_0_name'
fill_in 'ORCID', with: 'advisor orcid', id: 'dissertation_advisors_attributes_0_orcid'
select 'Department of Biology', from: 'dissertation_advisors_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'dissertation_advisors_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'dissertation_advisors_attributes_0_other_affiliation'
fill_in 'Alternate title', with: 'another title'
fill_in 'Contributor', { with: 'contributor', id: 'dissertation_contributors_attributes_0_name' }
fill_in 'ORCID', { with: 'contributor orcid', id: 'dissertation_contributors_attributes_0_orcid' }
fill_in 'Contributor', with: 'contributor', id: 'dissertation_contributors_attributes_0_name'
fill_in 'ORCID', with: 'contributor orcid', id: 'dissertation_contributors_attributes_0_orcid'
select 'Department of Biology', from: 'dissertation_contributors_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'dissertation_contributors_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'dissertation_contributors_attributes_0_other_affiliation'
select 'Doctor of Philosophy', from: 'dissertation_degree'
fill_in 'DOI', with: 'some-doi'
select 'Dissertation', from: 'dissertation_resource_type'
Expand All @@ -100,10 +100,10 @@
fill_in 'Note', with: 'a note'
fill_in 'Place of publication', with: 'UNC'
fill_in 'Publisher', with: 'UNC Press'
fill_in 'Reviewer', { with: 'reviewer', id: 'dissertation_reviewers_attributes_0_name' }
fill_in 'ORCID', { with: 'reviewer orcid', id: 'dissertation_reviewers_attributes_0_orcid' }
fill_in 'Reviewer', with: 'reviewer', id: 'dissertation_reviewers_attributes_0_name'
fill_in 'ORCID', with: 'reviewer orcid', id: 'dissertation_reviewers_attributes_0_orcid'
select 'Department of Biology', from: 'dissertation_reviewers_attributes_0_affiliation'
fill_in 'Additional affiliation', { with: 'UNC', id: 'dissertation_reviewers_attributes_0_other_affiliation' }
fill_in 'Additional affiliation', with: 'UNC', id: 'dissertation_reviewers_attributes_0_other_affiliation'
select 'In Copyright', from: 'dissertation_rights_statement'
fill_in 'Subject', with: 'test'
fill_in 'Rights notes', with: 'some rights notes'
Expand Down
Loading

0 comments on commit 6386d10

Please sign in to comment.