From 0be6a5ca5e3273989c2787d7151a886f6fc283dd Mon Sep 17 00:00:00 2001 From: Ben Pennell Date: Fri, 18 Oct 2024 14:22:05 -0400 Subject: [PATCH] HYC-1840 - Updates for ruby 3 (#1124) * Updates for ruby 3 * Add webrick dependency, which was removed from ruby core in 3 * Update docker compose and startup scripts so that web and sidekiq don't share gems anymore (symlinking didn't work across containers), get solr working again * Updates to syntax and tests for ruby 3 * Boolean name fixes and ruby 3 param adjustment in test * Update passenger and sidekiq * Downgrade to match server * Downgrade sidekiq back to 6 --------- --- .github/workflows/build.yml | 6 +-- Dockerfile | 21 ++++---- Gemfile | 12 +++-- Gemfile.lock | 40 ++++++++------ .../jobs/attach_files_to_work_job_override.rb | 2 +- .../tasks/dimensions_ingest_service.rb | 2 +- docker-compose.yml | 21 +++----- docker/CentOS-Base.repo | 54 +++++++++++++++++++ docker/start-app.sh | 19 ++++--- docker/start-sidekiq.sh | 33 +++++------- spec/features/create_article_spec.rb | 18 +++---- spec/features/create_artwork_spec.rb | 12 ++--- spec/features/create_data_set_spec.rb | 48 ++++++++--------- spec/features/create_dissertation_spec.rb | 24 ++++----- spec/features/create_general_spec.rb | 54 +++++++++---------- spec/features/create_honors_thesis_spec.rb | 24 ++++----- spec/features/create_journal_spec.rb | 12 ++--- spec/features/create_masters_paper_spec.rb | 36 ++++++------- spec/features/create_multimed_spec.rb | 12 ++--- spec/features/create_scholarly_work_spec.rb | 24 ++++----- ...ate_work_in_honors_thesis_workflow_spec.rb | 12 ++--- spec/features/edit_work_spec.rb | 6 +-- spec/features/set_embargo_spec.rb | 18 +++---- spec/jobs/attach_files_to_work_job_spec.rb | 2 +- spec/mailers/dimensions_report_mailer_spec.rb | 4 +- .../dimensions_report_mailer_preview.rb | 2 +- .../tasks/dimensions_ingest_service_spec.rb | 13 +++++ .../dimensions_reporting_service_spec.rb | 6 +-- 28 files changed, 304 insertions(+), 233 deletions(-) create mode 100644 docker/CentOS-Base.repo diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e3690c4d..448578c9e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,10 +83,10 @@ jobs: strategy: matrix: - ruby-version: ['2.7.4'] + ruby-version: ['3.0.4'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Ruby # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, # change this to (see https://github.com/ruby/setup-ruby#versioning): @@ -97,7 +97,7 @@ jobs: - name: Update rubygems run: | gem update --system 3.3.25 - gem install bundler:2.2.33 + gem install bundler:2.3.27 # Run Rubocop as soon as gems are installed, so we fail early if there are issues - name: Run RuboCop diff --git a/Dockerfile b/Dockerfile index c269f87ea..914b76d25 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,8 @@ CMD ["/usr/sbin/init"] FROM systemd-enabled +COPY docker/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo + # Install dependencies # Install compilers for gems & more dependencies - this section is > 1 GB so might see if we can shrink it down some # Should we remove git, since the mutagen files can't see the git directory? @@ -25,15 +27,13 @@ FROM systemd-enabled RUN yum -y update \ && yum -y install epel-release \ && yum -y install centos-release-scl-rh centos-release-scl \ -&& yum -y --enablerepo=centos-sclo-rh install rh-ruby27 rh-ruby27-ruby-devel \ +&& yum -y install libyaml libyaml-devel \ +&& yum -y --enablerepo=centos-sclo-rh install rh-ruby30 rh-ruby30-ruby-devel \ && yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm \ && yum -y install gcc gcc-c++ zlib-devel devtoolset-8 postgresql14 libpq5-devel libxslt-devel \ && yum -y install git libreoffice clamav-devel clamav clamav-update clamd redhat-lsb libXScrnSaver wget unzip \ -&& yum -y install epel-release \ && yum -y install ghostscript GraphicsMagick \ -&& wget -q -P /tmp "https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm" \ -&& yum -y localinstall /tmp/google-chrome-stable_current_x86_64.rpm \ -&& rm -f google-chrome-stable_current_x86_64.rpm \ +&& yum -y install chromium \ && yum -y install rh-nodejs14 \ && yum install -y python3 \ && yum clean all && rm -rf /var/cache/yum \ @@ -42,7 +42,7 @@ RUN yum -y update \ && unzip /tmp/fits-1.5.5.zip -d /fits/fits-1.5.5 \ && rm -f /tmp/fits-1.5.5.zip \ && echo "source scl_source enable devtoolset-8" >> /etc/bashrc \ -&& echo "source scl_source enable rh-ruby27" >> /etc/bashrc \ +&& echo "source scl_source enable rh-ruby30" >> /etc/bashrc \ && scl enable rh-nodejs14 -- npm install yarn -g \ && scl enable rh-nodejs14 -- yarn \ && yum -y update ca-certificates @@ -54,11 +54,10 @@ COPY docker/fits.xml /fits/fits-1.5.5/xml/fits.xml COPY Gemfile* /hyrax/ WORKDIR /hyrax -RUN scl enable devtoolset-8 rh-ruby27 -- gem install rubygems-update \ -&& scl enable devtoolset-8 rh-ruby27 -- update_rubygems \ -&& scl enable devtoolset-8 rh-ruby27 -- gem update --system \ -&& scl enable devtoolset-8 rh-ruby27 -- gem install bundler:2.2.33 \ -&& scl enable devtoolset-8 rh-ruby27 -- bundle install --jobs=3 --retry=3 +ENV BUNDLER_ALLOW_ROOT=1 +RUN scl enable devtoolset-8 rh-ruby30 -- gem install rubygems-update \ +&& scl enable devtoolset-8 rh-ruby30 -- update_rubygems \ +&& scl enable devtoolset-8 rh-ruby30 -- gem update --system # Create FTP directories RUN mkdir -p /opt/data/ftp/proquest && mkdir -p /opt/data/ftp/sage diff --git a/Gemfile b/Gemfile index a80399315..997df08c3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ # frozen_string_literal: true source 'https://rubygems.org' -ruby '~> 2.7.4' +ruby '~> 3.0.2' git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/') @@ -9,6 +9,7 @@ end gem 'browser', '~> 5.3', '>= 5.3.1' gem 'active-fedora', '~> 14.0' +gem 'base64', '0.1.0' # Downgrade from 0.2 so that it will match the version being used by passenger on the server gem 'blacklight', git: 'https://github.com/UNC-Libraries/blacklight.git', branch: 'unc-development' gem 'blacklight_advanced_search', '~> 8.0.0.alpha2' gem 'blacklight_oai_provider', '7.0.2' @@ -20,7 +21,7 @@ gem 'clamav-client', require: 'clamav/client' gem 'coffee-rails', '~> 5.0.0' gem 'devise', '~> 4.8.0' gem 'devise-guests', '~> 0.8.1' -gem 'edtf-humanize', '2.0.1' +gem 'edtf-humanize', '~> 2.1' # See https://github.com/rails/execjs#readme for more supported runtimes gem 'execjs', '2.8.1' gem 'httparty', '~>0.21.0' @@ -32,10 +33,11 @@ gem 'jbuilder', '~> 2.11.2' # Use jquery as the JavaScript library gem 'jquery-rails', '~> 4.5.0' gem 'json-canonicalization', '0.3.1' -gem 'json-ld', '< 3.2' +gem 'json-ld', '~> 3.2' gem 'libv8', '~> 7.3' # linkeddata gem is released with rdf gems and should be the same version as rdf gem 'sparql', '3.2.5' +gem 'ldp', '~> 1.1' gem 'linkeddata' gem 'logger', '1.5.3' gem 'loofah', '~>2.19.1' @@ -45,7 +47,8 @@ gem 'nokogiri', '~>1.14.2' gem 'omniauth', '~> 2.0' gem 'omniauth-rails_csrf_protection' gem 'omniauth-shibboleth', '~> 1.3' -gem 'passenger', '6.0.14', require: 'phusion_passenger/rack_handler' +# Cannot use 6.0.23 because it adds rackup as a dependency, which leads to conflicts for now +gem 'passenger', '6.0.22', require: 'phusion_passenger/rack_handler' # Use postgresql as the database for Active Record gem 'pg', '~> 1.3.5' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' @@ -96,6 +99,7 @@ group :test do gem 'selenium-webdriver', '~> 4.8' gem 'shoulda-matchers', '~> 5.3.0' gem 'simplecov' + gem 'webrick' gem 'webdrivers', '~> 5.3', require: false gem 'webmock', '~> 3.14.0' end diff --git a/Gemfile.lock b/Gemfile.lock index f3408aa8a..5b2b85675 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -201,7 +201,7 @@ GEM bagit (0.4.6) docopt (~> 0.5.0) validatable (~> 1.6) - base64 (0.2.0) + base64 (0.1.0) bcp47 (0.3.3) i18n bcrypt (3.1.20) @@ -383,7 +383,7 @@ GEM unicode-types (~> 1.8) edtf (3.1.1) activesupport (>= 3.0, < 8.0) - edtf-humanize (2.0.1) + edtf-humanize (2.2.0) activesupport (>= 4) edtf (>= 2.3, < 4) roman (~> 0.2.0) @@ -534,13 +534,13 @@ GEM thor (>= 0.14, < 2.0) json (2.7.1) json-canonicalization (0.3.1) - json-ld (3.1.10) + json-ld (3.2.4) htmlentities (~> 4.3) - json-canonicalization (~> 0.2) + json-canonicalization (~> 0.3) link_header (~> 0.0, >= 0.0.8) - multi_json (~> 1.14) - rack (~> 2.0) - rdf (~> 3.1) + multi_json (~> 1.15) + rack (>= 2.2, < 4) + rdf (~> 3.2, >= 3.2.10) json-ld-preloaded (3.1.6) json-ld (~> 3.1) rdf (~> 3.1) @@ -568,13 +568,14 @@ GEM rdf-xsd (~> 3.2) sparql (~> 3.2) sxp (~> 1.2) - ldp (1.0.3) + ldp (1.2.0) deprecation - faraday + faraday (>= 1) http_logger - json-ld - rdf (>= 1.1) + json-ld (~> 3.2) + rdf (~> 3.2) rdf-isomorphic + rdf-ldp rdf-turtle rdf-vocab (>= 0.8) slop @@ -703,7 +704,7 @@ GEM ast (~> 2.4.1) racc parslet (2.0.0) - passenger (6.0.14) + passenger (6.0.22) rack rake (>= 0.8.1) pg (1.3.5) @@ -770,6 +771,9 @@ GEM rdf (~> 3.2) rdf-json (3.2.0) rdf (~> 3.2) + rdf-ldp (0.1.0) + deprecation + rdf rdf-microdata (3.2.1) htmlentities (~> 4.3) nokogiri (~> 1.13) @@ -1066,6 +1070,7 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.8.2) websocket (1.2.10) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) @@ -1079,6 +1084,7 @@ PLATFORMS DEPENDENCIES active-fedora (~> 14.0) + base64 (= 0.1.0) blacklight! blacklight_advanced_search (~> 8.0.0.alpha2) blacklight_oai_provider (= 7.0.2) @@ -1093,7 +1099,7 @@ DEPENDENCIES database_cleaner devise (~> 4.8.0) devise-guests (~> 0.8.1) - edtf-humanize (= 2.0.1) + edtf-humanize (~> 2.1) execjs (= 2.8.1) factory_bot_rails (~> 6.2.0) fcrepo_wrapper (~> 0.9.0) @@ -1105,7 +1111,8 @@ DEPENDENCIES jbuilder (~> 2.11.2) jquery-rails (~> 4.5.0) json-canonicalization (= 0.3.1) - json-ld (< 3.2) + json-ld (~> 3.2) + ldp (~> 1.1) libv8 (~> 7.3) linkeddata listen (~> 3.7.0) @@ -1117,7 +1124,7 @@ DEPENDENCIES omniauth (~> 2.0) omniauth-rails_csrf_protection omniauth-shibboleth (~> 1.3) - passenger (= 6.0.14) + passenger (= 6.0.22) pg (~> 1.3.5) puma rails (~> 6.0) @@ -1147,9 +1154,10 @@ DEPENDENCIES web-console (~> 3.7.0) webdrivers (~> 5.3) webmock (~> 3.14.0) + webrick RUBY VERSION - ruby 2.7.4p191 + ruby 3.0.2p107 BUNDLED WITH 2.2.33 diff --git a/app/overrides/jobs/attach_files_to_work_job_override.rb b/app/overrides/jobs/attach_files_to_work_job_override.rb index 3998ea6c3..9a90c721b 100644 --- a/app/overrides/jobs/attach_files_to_work_job_override.rb +++ b/app/overrides/jobs/attach_files_to_work_job_override.rb @@ -9,7 +9,7 @@ def perform(work, uploaded_files, **work_attributes) # [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)) diff --git a/app/services/tasks/dimensions_ingest_service.rb b/app/services/tasks/dimensions_ingest_service.rb index 98cdc781d..83b0faa90 100644 --- a/app/services/tasks/dimensions_ingest_service.rb +++ b/app/services/tasks/dimensions_ingest_service.rb @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 445327a6a..c8bbf1142 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,7 +42,7 @@ services: - docker/.env volumes: - mount-code:/hyrax - - mount-gems:/hyc-gems + - mount-sidekiq-gems:/hyc-gems - fcrepo_data:/opt/fedora/ - hyrax_data:/opt/hyrax - ftp_data:/opt/data/ftp @@ -95,13 +95,14 @@ services: solr8: image: solr:8.11-slim volumes: - - solr8-data:/opt/solr/server/solr/configsets/hy-c + - ./solr/config:/opt/solr/server/solr/configsets/hy-c + - solr8-data:/var/solr/data ports: - "8983:8983" command: > bash -c " - precreate-core hydra-development /opt/solr/server/solr/configsets/hy-c; - precreate-core hydra-test /opt/solr/server/solr/configsets/hy-c; + precreate-core hydra-development /opt/solr/server/solr/configsets/hy-c && + precreate-core hydra-test /opt/solr/server/solr/configsets/hy-c && exec solr -f " networks: @@ -109,6 +110,7 @@ services: volumes: mount-code: mount-gems: + mount-sidekiq-gems: solr8-data: clam: pg_data: @@ -138,14 +140,3 @@ x-mutagen: permissions: defaultFileMode: 0644 defaultDirectoryMode: 0755 - #mount-gems: - #alpha: '../hyc-gems' - #beta: "volume://mount-gems" - # TODO: can we move these to simple volumes by auto-copying the configs over? - solr8-data: - alpha: './solr/config' - beta: 'volume://solr8-data' - configurationBeta: - permissions: - defaultOwner: 'id:8983' - defaultGroup: 'id:8983' diff --git a/docker/CentOS-Base.repo b/docker/CentOS-Base.repo new file mode 100644 index 000000000..0de626671 --- /dev/null +++ b/docker/CentOS-Base.repo @@ -0,0 +1,54 @@ +# +# The mirror system uses the connecting IP address of the client and the +# update status of each mirror to pick mirrors that are updated to and +# geographically close to the client. You should use this for CentOS updates +# unless you are manually picking other mirrors. +# +# If the mirrorlist= does not work for you, as a fall back you can try the +# remarked out baseurl= line instead. +# +# + +[base] +name=CentOS-$releasever - Base +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra +baseurl=http://vault.centos.org/centos/$releasever/os/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 + +#released updates +[updates] +name=CentOS-$releasever - Updates +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra +baseurl=http://vault.centos.org/centos/$releasever/updates/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 + +[centos-sclo-rh] +name=CentOS-7.9.2009 - SCLo rh +baseurl=https://vault.centos.org/7.9.2009/sclo/$basearch/rh/ +gpgcheck=0 +enabled=1 + +[centos-sclo-sclo] +name=CentOS-7.9.2009 - SCLo sclo +baseurl=https://vault.centos.org/7.9.2009/sclo/$basearch/sclo/ +gpgcheck=0 +enabled=1 + +#additional packages that may be useful +[extras] +name=CentOS-$releasever - Extras +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra +baseurl=http://vault.centos.org/centos/$releasever/extras/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 + +#additional packages that extend functionality of existing packages +[centosplus] +name=CentOS-$releasever - Plus +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra +baseurl=http://vault.centos.org/centos/$releasever/centosplus/$basearch/ +gpgcheck=1 +enabled=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 \ No newline at end of file diff --git a/docker/start-app.sh b/docker/start-app.sh index 1213c5711..45134b62a 100644 --- a/docker/start-app.sh +++ b/docker/start-app.sh @@ -1,20 +1,27 @@ #!/bin/bash echo "#### Running start-app.sh" -source scl_source enable rh-ruby27 +source scl_source enable rh-ruby30 source scl_source enable devtoolset-8 mkdir -p /opt/hyrax/log/ echo "#### Ensure rubygems system is up to date before bundle installing" gem install rubygems-update -v 3.4.20 -update_rubygems >> /dev/null - -echo "#### Bundle install" -bundle check || bundle install +update_rubygems >> /dev/null echo "#### Performing config steps" # The bundle config and package are needed for the odd way we manage gems in production bundle config --local cache_path /hyc-gems -bundle package + +if ! bundle check; then + echo "#### Bundle install required" + bundle install + bundle package + echo "#### Creating symlink for libsass otherwise bundle cannot find it" + [ ! -L /opt/rh/rh-ruby30/root/usr/share/gems/gems/sassc-2.4.0/ext/libsass.so ] && ln -s /opt/rh/rh-ruby30/root/usr/lib64/gems/ruby/sassc-2.4.0/sassc/libsass.so /opt/rh/rh-ruby30/root/usr/share/gems/gems/sassc-2.4.0/ext/libsass.so +else + echo "#### Gems already installed, skipping bundle install" +fi + find . -name *.pid -delete bundle exec rake tmp:cache:clear bundle exec rake db:create && bundle exec rake db:migrate diff --git a/docker/start-sidekiq.sh b/docker/start-sidekiq.sh index 734bfa949..3f3c41528 100644 --- a/docker/start-sidekiq.sh +++ b/docker/start-sidekiq.sh @@ -1,29 +1,24 @@ #!/bin/bash echo "#### Running start-sidekiq.sh" -source scl_source enable rh-ruby27 +source scl_source enable rh-ruby30 source scl_source enable devtoolset-8 -# Wait for the web container, so that it can handle installation of bundle gems for both -echo "#### Waiting for web application to become available" -ATTEMPT_COUNTER=0 -MAX_ATTEMPTS=100 -SERVICE_URL=http://web:3000/ - -until $(curl --output /dev/null --silent --head --fail $SERVICE_URL); do - if [ ${ATTEMPT_COUNTER} -eq ${MAX_ATTEMPTS} ];then - echo "Max attempts to connect to web application reached, cannot start sidekiq" - exit 1 - fi - - printf '.' - ATTEMPT_COUNTER=$(($ATTEMPT_COUNTER+1)) - sleep 5 -done - echo "#### Ensure rubygems system is up to date before bundle installing" gem install rubygems-update -v 3.4.20 update_rubygems >> /dev/null +bundle config --local cache_path /hyc-gems + +if ! bundle check; then + echo "#### Bundle install required" + bundle install + bundle package + echo "#### Creating symlink for libsass otherwise bundle cannot find it" + [ ! -L /opt/rh/rh-ruby30/root/usr/share/gems/gems/sassc-2.4.0/ext/libsass.so ] && ln -s /opt/rh/rh-ruby30/root/usr/lib64/gems/ruby/sassc-2.4.0/sassc/libsass.so /opt/rh/rh-ruby30/root/usr/share/gems/gems/sassc-2.4.0/ext/libsass.so +else + echo "#### Gems already installed, skipping bundle install" +fi + echo "#### Starting sidekiq" -bundle && bundle exec sidekiq +bundle exec sidekiq echo "#### Shutdown sidekiq" \ No newline at end of file diff --git a/spec/features/create_article_spec.rb b/spec/features/create_article_spec.rb index 781aa4eaf..ffbf7afb2 100755 --- a/spec/features/create_article_spec.rb +++ b/spec/features/create_article_spec.rb @@ -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' @@ -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' @@ -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) diff --git a/spec/features/create_artwork_spec.rb b/spec/features/create_artwork_spec.rb index 44a4fc499..6bdc3ad23 100644 --- a/spec/features/create_artwork_spec.rb +++ b/spec/features/create_artwork_spec.rb @@ -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' @@ -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) diff --git a/spec/features/create_data_set_spec.rb b/spec/features/create_data_set_spec.rb index 17cecbc65..fb0b61f54 100644 --- a/spec/features/create_data_set_spec.rb +++ b/spec/features/create_data_set_spec.rb @@ -65,10 +65,10 @@ # 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' @@ -76,23 +76,23 @@ 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' @@ -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' @@ -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' diff --git a/spec/features/create_dissertation_spec.rb b/spec/features/create_dissertation_spec.rb index 12a0c6772..6f121bf4e 100755 --- a/spec/features/create_dissertation_spec.rb +++ b/spec/features/create_dissertation_spec.rb @@ -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' @@ -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' diff --git a/spec/features/create_general_spec.rb b/spec/features/create_general_spec.rb index f354385b6..7fad60d91 100644 --- a/spec/features/create_general_spec.rb +++ b/spec/features/create_general_spec.rb @@ -77,31 +77,31 @@ fill_in 'Abstract', with: 'an abstract' select 'Clinical Nutrition', from: 'Academic Concentration' fill_in 'Access Right', with: 'some access' - fill_in 'Advisor', { with: 'advisor', id: 'general_advisors_attributes_0_name' } - fill_in 'ORCID', { with: 'advisor orcid', id: 'general_advisors_attributes_0_orcid' } + fill_in 'Advisor', with: 'advisor', id: 'general_advisors_attributes_0_name' + fill_in 'ORCID', with: 'advisor orcid', id: 'general_advisors_attributes_0_orcid' select 'Department of Biology', from: 'general_advisors_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'general_advisors_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'general_advisors_attributes_0_other_affiliation' fill_in 'Alternate title', with: 'another title' - fill_in 'Arranger', { with: 'arranger', id: 'general_arrangers_attributes_0_name' } - fill_in 'ORCID', { with: 'arranger orcid', id: 'general_arrangers_attributes_0_orcid' } + fill_in 'Arranger', with: 'arranger', id: 'general_arrangers_attributes_0_name' + fill_in 'ORCID', with: 'arranger orcid', id: 'general_arrangers_attributes_0_orcid' select 'Department of Biology', from: 'general_arrangers_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'general_arrangers_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'general_arrangers_attributes_0_other_affiliation' select 'Honors', from: 'Honors level' fill_in 'Bibliographic citation', with: 'a citation' - fill_in 'Creator', { with: 'Test Default Creator', id: 'general_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'general_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'general_creators_attributes_0_name' + fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'general_creators_attributes_0_orcid' select 'Department of Biology', from: 'general_creators_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'general_creators_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'general_creators_attributes_0_other_affiliation' fill_in 'Conference name', with: 'a conference' - fill_in 'Contributor', { with: 'contributor', id: 'general_contributors_attributes_0_name' } - fill_in 'ORCID', { with: 'contributor orcid', id: 'general_contributors_attributes_0_orcid' } + fill_in 'Contributor', with: 'contributor', id: 'general_contributors_attributes_0_name' + fill_in 'ORCID', with: 'contributor orcid', id: 'general_contributors_attributes_0_orcid' select 'Department of Biology', from: 'general_contributors_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'general_contributors_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'general_contributors_attributes_0_other_affiliation' fill_in 'Copyright date', with: '2018' - fill_in 'Composer', { with: 'composer', id: 'general_composers_attributes_0_name' } - fill_in 'ORCID', { with: 'composer orcid', id: 'general_composers_attributes_0_orcid' } + fill_in 'Composer', with: 'composer', id: 'general_composers_attributes_0_name' + fill_in 'ORCID', with: 'composer orcid', id: 'general_composers_attributes_0_orcid' select 'Department of Biology', from: 'general_composers_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'general_composers_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'general_composers_attributes_0_other_affiliation' fill_in 'Date of publication', with: '2018-10-03' fill_in 'Date other', with: '2018-10-03' select 'Bachelor of Science', from: 'general_degree' @@ -130,21 +130,21 @@ fill_in 'Page end', with: '32' fill_in 'Page start', with: '30' fill_in 'Place of publication', with: 'UNC' - fill_in 'Project Director', { with: 'project director', id: 'general_project_directors_attributes_0_name' } - fill_in 'ORCID', { with: 'project director orcid', id: 'general_project_directors_attributes_0_orcid' } + fill_in 'Project Director', with: 'project director', id: 'general_project_directors_attributes_0_name' + fill_in 'ORCID', with: 'project director orcid', id: 'general_project_directors_attributes_0_orcid' select 'Department of Biology', from: 'general_project_directors_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'general_project_directors_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'general_project_directors_attributes_0_other_affiliation' select 'Yes', from: 'general_peer_review_status' fill_in 'Publisher', with: 'UNC Press' select 'Other', from: 'general_resource_type' - fill_in 'Researcher', { with: 'researcher', id: 'general_researchers_attributes_0_name' } - fill_in 'ORCID', { with: 'researcher orcid', id: 'general_researchers_attributes_0_orcid' } + fill_in 'Researcher', with: 'researcher', id: 'general_researchers_attributes_0_name' + fill_in 'ORCID', with: 'researcher orcid', id: 'general_researchers_attributes_0_orcid' select 'Department of Biology', from: 'general_researchers_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'general_researchers_attributes_0_other_affiliation' } - fill_in 'Reviewer', { with: 'reviewer', id: 'general_reviewers_attributes_0_name' } - fill_in 'ORCID', { with: 'reviewer orcid', id: 'general_reviewers_attributes_0_orcid' } + fill_in 'Additional affiliation', with: 'UNC', id: 'general_researchers_attributes_0_other_affiliation' + fill_in 'Reviewer', with: 'reviewer', id: 'general_reviewers_attributes_0_name' + fill_in 'ORCID', with: 'reviewer orcid', id: 'general_reviewers_attributes_0_orcid' select 'Department of Biology', from: 'general_reviewers_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'general_reviewers_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'general_reviewers_attributes_0_other_affiliation' fill_in 'Related resource URL', with: 'something.com' fill_in 'Rights holder', with: 'an author' select 'In Copyright', from: 'general_rights_statement' @@ -152,10 +152,10 @@ fill_in 'Sponsor', with: 'a sponsor' fill_in 'Subject', with: 'test' fill_in 'Table of contents', with: 'contents' - fill_in 'Translator', { with: 'translator', id: 'general_translators_attributes_0_name' } - fill_in 'ORCID', { with: 'translator orcid', id: 'general_translators_attributes_0_orcid' } + fill_in 'Translator', with: 'translator', id: 'general_translators_attributes_0_name' + fill_in 'ORCID', with: 'translator orcid', id: 'general_translators_attributes_0_orcid' select 'Department of Biology', from: 'general_translators_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'general_translators_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'general_translators_attributes_0_other_affiliation' fill_in 'Rights notes', with: 'some rights notes' expect(page).to have_selector('#general_language_label', visible: false) diff --git a/spec/features/create_honors_thesis_spec.rb b/spec/features/create_honors_thesis_spec.rb index 661b02482..d40814833 100644 --- a/spec/features/create_honors_thesis_spec.rb +++ b/spec/features/create_honors_thesis_spec.rb @@ -65,14 +65,14 @@ # required fields fill_in 'Title', with: 'Test HonorsThesis work' fill_in 'Abstract', with: 'an abstract' - fill_in 'Advisor', { with: 'advisor', id: 'honors_thesis_advisors_attributes_0_name' } - fill_in 'ORCID', { with: 'advisor orcid', id: 'honors_thesis_advisors_attributes_0_orcid' } + fill_in 'Advisor', with: 'advisor', id: 'honors_thesis_advisors_attributes_0_name' + fill_in 'ORCID', with: 'advisor orcid', id: 'honors_thesis_advisors_attributes_0_orcid' select 'Department of Biology', from: 'honors_thesis_advisors_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'honors_thesis_advisors_attributes_0_other_affiliation' } - fill_in 'Creator', { with: 'Test Default Creator', id: 'honors_thesis_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'honors_thesis_creators_attributes_0_orcid' } + fill_in 'Additional affiliation', with: 'UNC', id: 'honors_thesis_advisors_attributes_0_other_affiliation' + fill_in 'Creator', with: 'Test Default Creator', id: 'honors_thesis_creators_attributes_0_name' + fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'honors_thesis_creators_attributes_0_orcid' select 'Department of Biology', from: 'honors_thesis_creators_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'honors_thesis_creators_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'honors_thesis_creators_attributes_0_other_affiliation' fill_in 'Date of publication', with: '2018-10-03' select 'Bachelor of Science', from: 'honors_thesis_degree' fill_in 'Graduation year', with: '2018' @@ -162,14 +162,14 @@ # required fields fill_in 'Title', with: 'Test HonorsThesis work' fill_in 'Abstract', with: 'an abstract' - fill_in 'Advisor', { with: 'advisor', id: 'honors_thesis_advisors_attributes_0_name' } - fill_in 'ORCID', { with: 'advisor orcid', id: 'honors_thesis_advisors_attributes_0_orcid' } + fill_in 'Advisor', with: 'advisor', id: 'honors_thesis_advisors_attributes_0_name' + fill_in 'ORCID', with: 'advisor orcid', id: 'honors_thesis_advisors_attributes_0_orcid' select 'Department of Biology', from: 'honors_thesis_advisors_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'honors_thesis_advisors_attributes_0_other_affiliation' } - fill_in 'Creator', { with: 'Test Default Creator', id: 'honors_thesis_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'honors_thesis_creators_attributes_0_orcid' } + fill_in 'Additional affiliation', with: 'UNC', id: 'honors_thesis_advisors_attributes_0_other_affiliation' + fill_in 'Creator', with: 'Test Default Creator', id: 'honors_thesis_creators_attributes_0_name' + fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'honors_thesis_creators_attributes_0_orcid' select 'Department of Biology', from: 'honors_thesis_creators_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'honors_thesis_creators_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'honors_thesis_creators_attributes_0_other_affiliation' fill_in 'Date of publication', with: '2018-10-03' select 'Honors', from: 'Honors level' select 'Bachelor of Science', from: 'honors_thesis_degree' diff --git a/spec/features/create_journal_spec.rb b/spec/features/create_journal_spec.rb index ad4a00dd6..16d7ed946 100644 --- a/spec/features/create_journal_spec.rb +++ b/spec/features/create_journal_spec.rb @@ -68,10 +68,10 @@ # extra fields fill_in 'Abstract', with: 'an abstract' - fill_in 'Creator', { with: 'Test Default Creator', id: 'journal_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'journal_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'journal_creators_attributes_0_name' + fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'journal_creators_attributes_0_orcid' select 'Department of Biology', from: 'journal_creators_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'journal_creators_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'journal_creators_attributes_0_other_affiliation' fill_in 'Extent', with: 'some extent' find('#journal_based_near_attributes_0_id', visible: false).set('http://sws.geonames.org/4460162/') fill_in 'ISBN', with: 'some isbn' @@ -165,10 +165,10 @@ # extra fields fill_in 'Abstract', with: 'an abstract' fill_in 'Alternate title', with: 'another title' - fill_in 'Creator', { with: 'Test Default Creator', id: 'journal_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'journal_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'journal_creators_attributes_0_name' + fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'journal_creators_attributes_0_orcid' select 'Department of Biology', from: 'journal_creators_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'journal_creators_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'journal_creators_attributes_0_other_affiliation' fill_in 'Digital collection', with: 'my collection' fill_in 'DOI', with: 'some-doi' fill_in 'Extent', with: 'some extent' diff --git a/spec/features/create_masters_paper_spec.rb b/spec/features/create_masters_paper_spec.rb index 0983e481d..0e51eb8c8 100755 --- a/spec/features/create_masters_paper_spec.rb +++ b/spec/features/create_masters_paper_spec.rb @@ -92,15 +92,15 @@ # required fields fill_in 'Title', with: 'Test MastersPaper work' - fill_in 'Creator', { with: 'Test Default Creator', id: 'masters_paper_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'masters_paper_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'masters_paper_creators_attributes_0_name' + fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'masters_paper_creators_attributes_0_orcid' select 'Department of Biology', from: 'masters_paper_creators_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'masters_paper_creators_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'masters_paper_creators_attributes_0_other_affiliation' fill_in 'Abstract', with: 'an abstract' - fill_in 'Advisor', { with: 'advisor', id: 'masters_paper_advisors_attributes_0_name' } - fill_in 'ORCID', { with: 'advisor orcid', id: 'masters_paper_advisors_attributes_0_orcid' } + fill_in 'Advisor', with: 'advisor', id: 'masters_paper_advisors_attributes_0_name' + fill_in 'ORCID', with: 'advisor orcid', id: 'masters_paper_advisors_attributes_0_orcid' select 'Department of Biology', from: 'masters_paper_advisors_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'masters_paper_advisors_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'masters_paper_advisors_attributes_0_other_affiliation' fill_in 'Date of publication', with: '2018-10-03' select 'Master of Science', from: 'masters_paper_degree' fill_in 'Graduation year', with: '2018' @@ -112,10 +112,10 @@ fill_in 'Keyword', with: 'Test Default Keyword' select 'Attribution 4.0 International', from: 'masters_paper_license' fill_in 'Note', with: 'a note' - fill_in 'Reviewer', { with: 'reviewer', id: 'masters_paper_reviewers_attributes_0_name' } - fill_in 'ORCID', { with: 'reviewer orcid', id: 'masters_paper_reviewers_attributes_0_orcid' } + fill_in 'Reviewer', with: 'reviewer', id: 'masters_paper_reviewers_attributes_0_name' + fill_in 'ORCID', with: 'reviewer orcid', id: 'masters_paper_reviewers_attributes_0_orcid' select 'Department of Biology', from: 'masters_paper_reviewers_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'masters_paper_reviewers_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'masters_paper_reviewers_attributes_0_other_affiliation' select 'In Copyright', from: 'masters_paper_rights_statement' fill_in 'Subject', with: 'test' @@ -197,15 +197,15 @@ # required fields fill_in 'Title', with: 'Test MastersPaper work' - fill_in 'Creator', { with: 'Test Default Creator', id: 'masters_paper_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'masters_paper_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'masters_paper_creators_attributes_0_name' + fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'masters_paper_creators_attributes_0_orcid' select 'Department of Biology', from: 'masters_paper_creators_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'masters_paper_creators_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'masters_paper_creators_attributes_0_other_affiliation' fill_in 'Abstract', with: 'an abstract' - fill_in 'Advisor', { with: 'advisor', id: 'masters_paper_advisors_attributes_0_name' } - fill_in 'ORCID', { with: 'advisor orcid', id: 'masters_paper_advisors_attributes_0_orcid' } + fill_in 'Advisor', with: 'advisor', id: 'masters_paper_advisors_attributes_0_name' + fill_in 'ORCID', with: 'advisor orcid', id: 'masters_paper_advisors_attributes_0_orcid' select 'Department of Biology', from: 'masters_paper_advisors_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'masters_paper_advisors_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'masters_paper_advisors_attributes_0_other_affiliation' fill_in 'Date of publication', with: '2018-10-03' select 'Master of Science', from: 'masters_paper_degree' fill_in 'Degree granting institution', with: 'UNC' @@ -221,10 +221,10 @@ fill_in 'Keyword', with: 'Test Default Keyword' select 'Attribution 3.0 United States', from: 'masters_paper_license' fill_in 'Note', with: 'a note' - fill_in 'Reviewer', { with: 'reviewer', id: 'masters_paper_reviewers_attributes_0_name' } - fill_in 'ORCID', { with: 'reviewer orcid', id: 'masters_paper_reviewers_attributes_0_orcid' } + fill_in 'Reviewer', with: 'reviewer', id: 'masters_paper_reviewers_attributes_0_name' + fill_in 'ORCID', with: 'reviewer orcid', id: 'masters_paper_reviewers_attributes_0_orcid' select 'Department of Biology', from: 'masters_paper_reviewers_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'masters_paper_reviewers_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'masters_paper_reviewers_attributes_0_other_affiliation' select 'In Copyright', from: 'masters_paper_rights_statement' fill_in 'Subject', with: 'test' fill_in 'Rights notes', with: 'some rights notes' diff --git a/spec/features/create_multimed_spec.rb b/spec/features/create_multimed_spec.rb index 71d793092..54081de62 100644 --- a/spec/features/create_multimed_spec.rb +++ b/spec/features/create_multimed_spec.rb @@ -63,10 +63,10 @@ # required fields fill_in 'Title', with: 'Test Multimed' - fill_in 'Creator', { with: 'Test Default Creator', id: 'multimed_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'multimed_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'multimed_creators_attributes_0_name' + fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'multimed_creators_attributes_0_orcid' select 'Department of Biology', from: 'multimed_creators_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'multimed_creators_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'multimed_creators_attributes_0_other_affiliation' fill_in 'Abstract', with: 'an abstract' fill_in 'Date of publication', with: '2018-10-03' select 'Video', from: 'multimed_resource_type' @@ -147,10 +147,10 @@ # required fields fill_in 'Title', with: 'Test Multimed' - fill_in 'Creator', { with: 'Test Default Creator', id: 'multimed_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'multimed_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'multimed_creators_attributes_0_name' + fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'multimed_creators_attributes_0_orcid' select 'Department of Biology', from: 'multimed_creators_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'multimed_creators_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'multimed_creators_attributes_0_other_affiliation' fill_in 'Abstract', with: 'an abstract' fill_in 'Date of publication', with: '2018-10-03' select 'Video', from: 'multimed_resource_type' diff --git a/spec/features/create_scholarly_work_spec.rb b/spec/features/create_scholarly_work_spec.rb index b413e1684..c980b7b11 100644 --- a/spec/features/create_scholarly_work_spec.rb +++ b/spec/features/create_scholarly_work_spec.rb @@ -64,18 +64,18 @@ # required fields fill_in 'Title', with: 'Test ScholarlyWork work' - fill_in 'Creator', { with: 'Test Default Creator', id: 'scholarly_work_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'scholarly_work_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'scholarly_work_creators_attributes_0_name' + fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'scholarly_work_creators_attributes_0_orcid' select 'Department of Biology', from: 'scholarly_work_creators_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'scholarly_work_creators_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'scholarly_work_creators_attributes_0_other_affiliation' fill_in 'Abstract', with: 'an abstract' fill_in 'Date of publication', with: '2018-10-03' # extra fields - fill_in 'Advisor', { with: 'advisor', id: 'scholarly_work_advisors_attributes_0_name' } - fill_in 'ORCID', { with: 'advisor orcid', id: 'scholarly_work_advisors_attributes_0_orcid' } + fill_in 'Advisor', with: 'advisor', id: 'scholarly_work_advisors_attributes_0_name' + fill_in 'ORCID', with: 'advisor orcid', id: 'scholarly_work_advisors_attributes_0_orcid' select 'Department of Biology', from: 'scholarly_work_advisors_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'scholarly_work_advisors_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'scholarly_work_advisors_attributes_0_other_affiliation' fill_in 'Conference name', with: 'a conference' find('#scholarly_work_based_near_attributes_0_id', visible: false).set('http://sws.geonames.org/4460162/') fill_in 'Keyword', with: 'Test Default Keyword' @@ -152,18 +152,18 @@ # required fields fill_in 'Title', with: 'Test ScholarlyWork work' - fill_in 'Creator', { with: 'Test Default Creator', id: 'scholarly_work_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'http://orcid.org/creator', id: 'scholarly_work_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'scholarly_work_creators_attributes_0_name' + fill_in 'ORCID', with: 'http://orcid.org/creator', id: 'scholarly_work_creators_attributes_0_orcid' select 'Department of Biology', from: 'scholarly_work_creators_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'scholarly_work_creators_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'scholarly_work_creators_attributes_0_other_affiliation' fill_in 'Abstract', with: 'an abstract' fill_in 'Date of publication', with: '2018-10-03' # extra fields - fill_in 'Advisor', { with: 'advisor', id: 'scholarly_work_advisors_attributes_0_name' } - fill_in 'ORCID', { with: 'advisor orcid', id: 'scholarly_work_advisors_attributes_0_orcid' } + fill_in 'Advisor', with: 'advisor', id: 'scholarly_work_advisors_attributes_0_name' + fill_in 'ORCID', with: 'advisor orcid', id: 'scholarly_work_advisors_attributes_0_orcid' select 'Department of Biology', from: 'scholarly_work_advisors_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'scholarly_work_advisors_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'scholarly_work_advisors_attributes_0_other_affiliation' fill_in 'Conference name', with: 'a conference' select 'Text', from: 'Dcmi type' fill_in 'Description', with: 'a description' diff --git a/spec/features/create_work_in_honors_thesis_workflow_spec.rb b/spec/features/create_work_in_honors_thesis_workflow_spec.rb index 40b582a0f..6b28a450d 100644 --- a/spec/features/create_work_in_honors_thesis_workflow_spec.rb +++ b/spec/features/create_work_in_honors_thesis_workflow_spec.rb @@ -133,10 +133,10 @@ expect(page).to have_content 'Add New Undergraduate Honors Thesis' fill_in 'Title', with: 'Honors workflow test 1' - fill_in 'Creator', { with: 'Test Default Creator', id: 'honors_thesis_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'creator orcid', id: 'honors_thesis_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'honors_thesis_creators_attributes_0_name' + fill_in 'ORCID', with: 'creator orcid', id: 'honors_thesis_creators_attributes_0_orcid' select 'Department of Biology', from: 'honors_thesis_creators_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'honors_thesis_creators_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'honors_thesis_creators_attributes_0_other_affiliation' fill_in 'Keyword', with: 'Test Default Keyword' select 'In Copyright', from: 'honors_thesis_rights_statement' expect(page).to have_field('honors_thesis_visibility_embargo') @@ -329,10 +329,10 @@ expect(page).to have_content 'Add New Undergraduate Honors Thesis' fill_in 'Title', with: 'Honors workflow test 2' - fill_in 'Creator', { with: 'Test Default Creator', id: 'honors_thesis_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'creator orcid', id: 'honors_thesis_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'honors_thesis_creators_attributes_0_name' + fill_in 'ORCID', with: 'creator orcid', id: 'honors_thesis_creators_attributes_0_orcid' select 'Department of Biology', from: 'honors_thesis_creators_attributes_0_affiliation' - fill_in 'Additional affiliation', { with: 'UNC', id: 'honors_thesis_creators_attributes_0_other_affiliation' } + fill_in 'Additional affiliation', with: 'UNC', id: 'honors_thesis_creators_attributes_0_other_affiliation' fill_in 'Keyword', with: 'Test Default Keyword' select 'In Copyright', from: 'honors_thesis_rights_statement' expect(page).to have_field('honors_thesis_visibility_embargo') diff --git a/spec/features/edit_work_spec.rb b/spec/features/edit_work_spec.rb index aaf7cf912..31d1494df 100644 --- a/spec/features/edit_work_spec.rb +++ b/spec/features/edit_work_spec.rb @@ -64,10 +64,10 @@ expect(page).to have_content 'Add New Scholarly Article or Book Chapter' fill_in 'Title', with: 'Test Article work' - fill_in 'Creator', { with: 'Test Default Creator', id: 'article_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'creator orcid', id: 'article_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'article_creators_attributes_0_name' + fill_in 'ORCID', with: 'creator orcid', 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 'Keyword', with: 'Test Default Keyword' select 'In Copyright', from: 'article_rights_statement' choose 'article_visibility_open' diff --git a/spec/features/set_embargo_spec.rb b/spec/features/set_embargo_spec.rb index b67201345..0e4578ecd 100644 --- a/spec/features/set_embargo_spec.rb +++ b/spec/features/set_embargo_spec.rb @@ -46,10 +46,10 @@ expect(page).to have_content 'Add New Scholarly Article or Book Chapter' fill_in 'Title', with: 'Test Article work' - fill_in 'Creator', { with: 'Test Default Creator', id: 'article_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'creator orcid', id: 'article_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'article_creators_attributes_0_name' + fill_in 'ORCID', with: 'creator orcid', 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 'Keyword', with: 'Test Default Keyword' select 'In Copyright', from: 'article_rights_statement' choose 'article_visibility_embargo' @@ -68,10 +68,10 @@ # Hyrax empties the form fill_in 'Title', with: 'Test Article work' - fill_in 'Creator', { with: 'Test Default Creator', id: 'article_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'creator orcid', id: 'article_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'article_creators_attributes_0_name' + fill_in 'ORCID', with: 'creator orcid', 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 'Keyword', with: 'Test Default Keyword' select 'In Copyright', from: 'article_rights_statement' choose 'article_visibility_embargo' @@ -99,10 +99,10 @@ expect(page).to have_content 'Add New Scholarly Article or Book Chapter' fill_in 'Title', with: 'Test Article work' - fill_in 'Creator', { with: 'Test Default Creator', id: 'article_creators_attributes_0_name' } - fill_in 'ORCID', { with: 'creator orcid', id: 'article_creators_attributes_0_orcid' } + fill_in 'Creator', with: 'Test Default Creator', id: 'article_creators_attributes_0_name' + fill_in 'ORCID', with: 'creator orcid', 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 'Keyword', with: 'Test Default Keyword' select 'In Copyright', from: 'article_rights_statement' choose 'article_visibility_embargo' diff --git a/spec/jobs/attach_files_to_work_job_spec.rb b/spec/jobs/attach_files_to_work_job_spec.rb index 98ac5046b..d23737bc6 100644 --- a/spec/jobs/attach_files_to_work_job_spec.rb +++ b/spec/jobs/attach_files_to_work_job_spec.rb @@ -56,7 +56,7 @@ context 'with safe file' do it 'succeeds without any reporting' do # Catch expected call to wrapped implementation of perform - expect(subject).to receive(:original_perform).with(work, [uploaded_file], {}) + expect(subject).to receive(:original_perform).with(work, [uploaded_file]) expect(Hyc::VirusScanner).to receive(:hyc_infected?).and_return(ClamAV::SuccessResponse.new(target_file)) subject.perform(work, [uploaded_file]) end diff --git a/spec/mailers/dimensions_report_mailer_spec.rb b/spec/mailers/dimensions_report_mailer_spec.rb index d474ae317..bc3dc8abc 100644 --- a/spec/mailers/dimensions_report_mailer_spec.rb +++ b/spec/mailers/dimensions_report_mailer_spec.rb @@ -51,7 +51,7 @@ let(:ingested_publications) do ingest_service.ingest_publications(test_publications) end - let(:report) { Tasks::DimensionsReportingService.new(ingested_publications, FIXED_DIMENSIONS_TOTAL_COUNT, { start_date: TEST_START_DATE, end_date: TEST_END_DATE }, FALSE).generate_report } + let(:report) { Tasks::DimensionsReportingService.new(ingested_publications, FIXED_DIMENSIONS_TOTAL_COUNT, { start_date: TEST_START_DATE, end_date: TEST_END_DATE }, false).generate_report } before do ActiveFedora::Cleaner.clean! @@ -109,7 +109,7 @@ end it 'renders a different message for manually executed ingest' do - service = Tasks::DimensionsReportingService.new(ingested_publications, FIXED_DIMENSIONS_TOTAL_COUNT, { start_date: TEST_START_DATE, end_date: TEST_END_DATE }, FALSE) + service = Tasks::DimensionsReportingService.new(ingested_publications, FIXED_DIMENSIONS_TOTAL_COUNT, { start_date: TEST_START_DATE, end_date: TEST_END_DATE }, false) report = service.generate_report mail = DimensionsReportMailer.dimensions_report_email(report) expect(mail.body.encoded).to include('Reporting publications from manually executed Dimensions ingest') diff --git a/spec/mailers/previews/dimensions_report_mailer_preview.rb b/spec/mailers/previews/dimensions_report_mailer_preview.rb index 543fe74e2..537939f41 100644 --- a/spec/mailers/previews/dimensions_report_mailer_preview.rb +++ b/spec/mailers/previews/dimensions_report_mailer_preview.rb @@ -46,7 +46,7 @@ def dimensions_report_email end end - dimensions_reporting_service = Tasks::DimensionsReportingService.new(ingested_publications, FIXED_DIMENSIONS_TOTAL_COUNT, { start_date: TEST_START_DATE, end_date: TEST_END_DATE }, FALSE) + dimensions_reporting_service = Tasks::DimensionsReportingService.new(ingested_publications, FIXED_DIMENSIONS_TOTAL_COUNT, { start_date: TEST_START_DATE, end_date: TEST_END_DATE }, false) report = dimensions_reporting_service.generate_report DimensionsReportMailer.dimensions_report_email(report) end diff --git a/spec/services/tasks/dimensions_ingest_service_spec.rb b/spec/services/tasks/dimensions_ingest_service_spec.rb index 826aa73ad..72e190db5 100644 --- a/spec/services/tasks/dimensions_ingest_service_spec.rb +++ b/spec/services/tasks/dimensions_ingest_service_spec.rb @@ -31,6 +31,15 @@ let(:pdf_content) { File.binread(File.join(Rails.root, '/spec/fixtures/files/sample_pdf.pdf')) } let(:test_publications) { JSON.parse(dimensions_ingest_test_fixture)['publications'] } + let(:temp_storage) { Dir.mktmpdir } + + around do |example| + cached_temp_storage = ENV['TEMP_STORAGE'] + ENV['TEMP_STORAGE'] = temp_storage.to_s + example.run + ENV['TEMP_STORAGE'] = cached_temp_storage + end + before do ActiveFedora::Cleaner.clean! admin_set @@ -51,6 +60,10 @@ allow(CharacterizeJob).to receive(:perform_later) end + after do + FileUtils.rm_rf(temp_storage) + end + describe '#initialize' do context 'when admin set and depositor are found' do it 'successfully initializes the service' do diff --git a/spec/services/tasks/dimensions_reporting_service_spec.rb b/spec/services/tasks/dimensions_reporting_service_spec.rb index 4e47172f7..b8dc6f3f5 100644 --- a/spec/services/tasks/dimensions_reporting_service_spec.rb +++ b/spec/services/tasks/dimensions_reporting_service_spec.rb @@ -80,7 +80,7 @@ describe '#generate_report' do it 'generates a report for ingest dimensions publications' do - service = described_class.new(ingested_publications, FIXED_DIMENSIONS_TOTAL_COUNT, { start_date: TEST_START_DATE, end_date: TEST_END_DATE }, TRUE) + service = described_class.new(ingested_publications, FIXED_DIMENSIONS_TOTAL_COUNT, { start_date: TEST_START_DATE, end_date: TEST_END_DATE }, true) report = service.generate_report headers = report[:headers] expect(report[:subject]).to eq('Dimensions Ingest Report for May 21, 2024 at 10:00 AM UTC') @@ -93,7 +93,7 @@ end it 'provides a different message for manually executed ingest' do - service = described_class.new(ingested_publications, FIXED_DIMENSIONS_TOTAL_COUNT, { start_date: TEST_START_DATE, end_date: TEST_END_DATE }, FALSE) + service = described_class.new(ingested_publications, FIXED_DIMENSIONS_TOTAL_COUNT, { start_date: TEST_START_DATE, end_date: TEST_END_DATE }, false) report = service.generate_report headers = report[:headers] expect(headers[:reporting_message]).to eq('Reporting publications from manually executed Dimensions ingest on May 21, 2024 at 10:00 AM UTC by admin.') @@ -120,7 +120,7 @@ def expect_publication_info(info_array, sample_array, failed, sample_start_index end it 'extracts publication information for the report' do - service = described_class.new(ingested_publications, FIXED_DIMENSIONS_TOTAL_COUNT, { start_date: TEST_START_DATE, end_date: TEST_END_DATE }, TRUE) + service = described_class.new(ingested_publications, FIXED_DIMENSIONS_TOTAL_COUNT, { start_date: TEST_START_DATE, end_date: TEST_END_DATE }, true) extracted_info = service.extract_publication_info expect(extracted_info[:successfully_ingested].length).to eq(8) expect(extracted_info[:failed_to_ingest].length).to eq(3)