diff --git a/.github/workflows/ruby_test.yml b/.github/workflows/ruby_test.yml index 768af42b09..5a2d82bf96 100644 --- a/.github/workflows/ruby_test.yml +++ b/.github/workflows/ruby_test.yml @@ -117,6 +117,8 @@ jobs: env: CI_NODE_TOTAL: ${{ matrix.ci_node_total }} CI_NODE_INDEX: ${{ matrix.ci_node_index }} + KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} DBPORT: ${{ job.services.mysql.ports[3306] }} run: bin/knapsack_pro_rspec - name: Upload capybara artifacts @@ -135,7 +137,7 @@ jobs: cucumber_tests: runs-on: ubuntu-latest env: - RAILS_ENV: cucumber + RAILS_ENV: test BUNDLE_WITHOUT: "deployment profile development test" # Services # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idservices @@ -178,12 +180,19 @@ jobs: run: | bin/setup bundle exec rake assets:precompile + echo "Reset database database cucumber" + RAILS_ENV=cucumber bundle exec rake db:reset + echo "Seed database" + RAILS_ENV=cucumber bundle exec rake db:seed # Actually run our tests - name: Run Cucumber tests env: CI_NODE_TOTAL: ${{ matrix.ci_node_total }} CI_NODE_INDEX: ${{ matrix.ci_node_index }} + KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} + KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} DBPORT: ${{ job.services.mysql.ports[3306] }} + RAILS_ENV: cucumber run: bin/knapsack_pro_cucumber - name: Upload capybara artifacts uses: actions/upload-artifact@v2 diff --git a/.rubocop.yml b/.rubocop.yml index 35e85b6f16..2f2d462cac 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -39,9 +39,10 @@ Rails/SkipsModelValidations: - "features/support/step_definitions/*.rb" Style/Documentation: - Exclude: - - "test/**/*" - - "spec/**/*" + Enabled: false + #Exclude: + # - "test/**/*" + # - "spec/**/*" Rails: Enabled: true @@ -176,7 +177,7 @@ Rails/UniqueValidationWithoutIndex: Enabled: false # Disabling newly introduced cops until we have time to sort out the offenses -RSpec/FactoryBot/ConsistentParenthesesStyle: +FactoryBot/ConsistentParenthesesStyle: Enabled: false Rails/I18nLocaleTexts: # new in 2.14 @@ -193,3 +194,28 @@ Rails/ActionControllerTestCase: # new in 2.14 RSpec/NoExpectationExample: # new in 2.13 Enabled: false + +# New in ruby 3 upgrade +RSpec/IndexedLet: + Enabled: false + +RSpec/SpecFilePathFormat: + Enabled: false + +RSpec/PendingWithoutReason: + Enabled: false + +Capybara/ClickLinkOrButtonStyle: + Enabled: false + +FactoryBot/FactoryAssociationWithStrategy: + Enabled: false + +Performance/MapMethodChain: + Enabled: false + +Rails/ThreeStateBooleanColumn: + Enabled: false + +RSpec/ExpectInHook: + Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 092d0f5d11..93558eed12 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -589,6 +589,7 @@ RSpec/ContextWording: - 'spec/shared_contexts/limber_shared_context.rb' - 'spec/uat_actions/integration_suite_tools_spec.rb' - 'spec/uat_actions/test_submission_spec.rb' + - 'spec/features/gpl207_bug_incorrect_submission_id_on_transfer_spec.rb' # Offense count: 4 RSpec/EmptyExampleGroup: @@ -1860,3 +1861,8 @@ Style/ZeroLengthPredicate: - 'app/models/sequencing_pipeline.rb' - 'features/support/step_definitions/samples_steps.rb' - 'test/shoulda_macros/sanger_macros/resource_test.rb' + +Metrics/ClassLength: + Exclude: + - 'app/middleware/api/endpoint_handler.rb' + - 'lib/tasks/add_templates_and_printers_to_pmb.rake' \ No newline at end of file diff --git a/.ruby-version b/.ruby-version index 6a81b4c837..818bd47abf 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.8 +3.0.6 diff --git a/Dockerfile b/Dockerfile index 3057a999c9..45b7e8f2ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ ARG CHIPSET=default # Use the correct base image depending on the architecture # For Apple M1 Chip, run: docker build --build-arg CHIPSET=m1 -FROM ruby:2.7.8-slim AS base_default +FROM ruby:3.0.6-slim AS base_default FROM --platform=linux/amd64 ruby:2.7.8-slim AS base_m1 FROM base_${CHIPSET} AS base @@ -45,6 +45,7 @@ ADD . /code/ # Install Chrome for being able to run tests RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb +RUN apt update RUN apt install -y ./google-chrome-stable_current_amd64.deb RUN rm ./google-chrome-stable_current_amd64.deb diff --git a/Gemfile b/Gemfile index 80dcd9dd7f..cf48a5fdd5 100644 --- a/Gemfile +++ b/Gemfile @@ -28,7 +28,7 @@ group :default do # Provides bulk insert capabilities gem 'activerecord-import' - gem 'record_loader' + gem 'record_loader', git: 'https://github.com/sanger/record_loader', branch: 'dpl680_upgrade_ruby3' gem 'mysql2', platforms: :mri gem 'will_paginate' @@ -40,7 +40,7 @@ group :default do gem 'will_paginate-bootstrap' # Provides eg. error_messages_for previously in rails 2, now deprecated. - gem 'dynamic_form' + #gem 'dynamic_form' gem 'daemons' gem 'puma' @@ -186,9 +186,7 @@ group :test, :cucumber do gem 'shoulda' gem 'simplecov', require: false gem 'timecop', require: false -end -group :cucumber do gem 'cucumber_github_formatter' gem 'cucumber-rails', require: false end diff --git a/Gemfile.lock b/Gemfile.lock index ea208163e4..4855e67d84 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,6 +7,13 @@ GIT activemodel activerecord (>= 4.0.0) +GIT + remote: https://github.com/sanger/record_loader + revision: d4145dc3321e977c5baaee9c4bca3cffe8b1ae07 + branch: dpl680_upgrade_ruby3 + specs: + record_loader (0.3.0) + GIT remote: https://github.com/sanger/sanger_barcode_format.git revision: 8e93771a9f38e1efb07c1d82dca1a81d74353e11 @@ -17,28 +24,28 @@ GIT GEM remote: https://rubygems.org/ specs: - aasm (5.4.0) + aasm (5.5.0) concurrent-ruby (~> 1.0) - actioncable (6.0.6) - actionpack (= 6.0.6) + actioncable (6.0.6.1) + actionpack (= 6.0.6.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.6) - actionpack (= 6.0.6) - activejob (= 6.0.6) - activerecord (= 6.0.6) - activestorage (= 6.0.6) - activesupport (= 6.0.6) + actionmailbox (6.0.6.1) + actionpack (= 6.0.6.1) + activejob (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) mail (>= 2.7.1) - actionmailer (6.0.6) - actionpack (= 6.0.6) - actionview (= 6.0.6) - activejob (= 6.0.6) + actionmailer (6.0.6.1) + actionpack (= 6.0.6.1) + actionview (= 6.0.6.1) + activejob (= 6.0.6.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.6) - actionview (= 6.0.6) - activesupport (= 6.0.6) + actionpack (6.0.6.1) + actionview (= 6.0.6.1) + activesupport (= 6.0.6.1) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) @@ -46,66 +53,67 @@ GEM actionpack-xml_parser (2.0.1) actionpack (>= 5.0) railties (>= 5.0) - actiontext (6.0.6) - actionpack (= 6.0.6) - activerecord (= 6.0.6) - activestorage (= 6.0.6) - activesupport (= 6.0.6) + actiontext (6.0.6.1) + actionpack (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) nokogiri (>= 1.8.5) - actionview (6.0.6) - activesupport (= 6.0.6) + actionview (6.0.6.1) + activesupport (= 6.0.6.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.6) - activesupport (= 6.0.6) + activejob (6.0.6.1) + activesupport (= 6.0.6.1) globalid (>= 0.3.6) - activemodel (6.0.6) - activesupport (= 6.0.6) + activemodel (6.0.6.1) + activesupport (= 6.0.6.1) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (6.0.6) - activemodel (= 6.0.6) - activesupport (= 6.0.6) - activerecord-import (1.4.1) + activerecord (6.0.6.1) + activemodel (= 6.0.6.1) + activesupport (= 6.0.6.1) + activerecord-import (1.5.0) activerecord (>= 4.2) activeresource (6.0.0) activemodel (>= 6.0) activemodel-serializers-xml (~> 1.0) activesupport (>= 6.0) - activestorage (6.0.6) - actionpack (= 6.0.6) - activejob (= 6.0.6) - activerecord (= 6.0.6) + activestorage (6.0.6.1) + actionpack (= 6.0.6.1) + activejob (= 6.0.6.1) + activerecord (= 6.0.6.1) marcel (~> 1.0) - activesupport (6.0.6) + activesupport (6.0.6.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) zeitwerk (~> 2.2, >= 2.2.2) - addressable (2.8.1) + addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) - after_commit_everywhere (1.3.0) + after_commit_everywhere (1.3.1) activerecord (>= 4.2) activesupport amq-protocol (2.3.2) ast (2.4.2) - bootsnap (1.14.0) + base64 (0.1.1) + bootsnap (1.16.0) msgpack (~> 1.2) builder (3.2.4) - bullet (7.0.3) + bullet (7.0.7) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) - bunny (2.19.0) + bunny (2.22.0) amq-protocol (~> 2.3, >= 2.3.1) sorted_set (~> 1, >= 1.0.2) byebug (11.1.3) - cancancan (3.4.0) - capybara (3.38.0) + cancancan (3.5.0) + capybara (3.39.2) addressable matrix mini_mime (>= 0.1.3) @@ -114,15 +122,14 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - carrierwave (2.2.3) - activemodel (>= 5.0.0) - activesupport (>= 5.0.0) + carrierwave (3.0.4) + activemodel (>= 6.0.0) + activesupport (>= 6.0.0) addressable (~> 2.6) image_processing (~> 1.1) marcel (~> 1.0.0) - mini_mime (>= 0.1.3) ssrf_filter (~> 1.0) - caxlsx (3.3.0) + caxlsx (3.4.1) htmlentities (~> 4.3, >= 4.3.4) marcel (~> 1.0) nokogiri (~> 1.10, >= 1.10.4) @@ -132,7 +139,7 @@ GEM coderay (1.1.3) concurrent-ruby (1.2.2) configatron (4.5.1) - connection_pool (2.3.0) + connection_pool (2.4.1) crack (0.4.5) rexml crass (1.0.6) @@ -148,7 +155,7 @@ GEM mime-types (~> 3.4, >= 3.4.1) multi_test (~> 1.1, >= 1.1.0) sys-uname (~> 1.2, >= 1.2.2) - cucumber-ci-environment (9.1.0) + cucumber-ci-environment (9.2.0) cucumber-core (11.0.0) cucumber-gherkin (~> 23.0, >= 23.0.1) cucumber-messages (~> 18.0, >= 18.0.0) @@ -170,12 +177,13 @@ GEM cucumber-tag-expressions (4.1.0) cucumber_github_formatter (0.1.0) daemons (1.4.1) - database_cleaner (2.0.1) - database_cleaner-active_record (~> 2.0.0) - database_cleaner-active_record (2.0.1) + database_cleaner (2.0.2) + database_cleaner-active_record (>= 2, < 3) + database_cleaner-active_record (2.1.0) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) + date (3.3.3) delayed_job (4.1.11) activesupport (>= 3.0, < 8.0) delayed_job_active_record (4.1.7) @@ -186,7 +194,6 @@ GEM domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dry-cli (1.0.0) - dynamic_form (1.1.4) erubi (1.12.0) exception_notification (4.5.0) actionmailer (>= 5.2, < 8) @@ -196,7 +203,7 @@ GEM factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - ffi (1.15.5) + ffi (1.16.3) flipper (0.25.4) flipper-active_record (0.25.4) activerecord (>= 4.2, < 8) @@ -209,7 +216,7 @@ GEM sanitize (< 7) formtastic (4.0.0) actionpack (>= 5.2.0) - globalid (1.0.1) + globalid (1.1.0) activesupport (>= 5.0) hashdiff (1.0.1) htmlentities (4.3.4) @@ -221,56 +228,70 @@ GEM image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - json (2.6.2) + json (2.6.3) jsonapi-resources (0.9.0) activerecord (>= 4.1) concurrent-ruby railties (>= 4.1) jsonapi-resources-matchers (1.0.0) jsonapi-resources (>= 0.9.0) - knapsack_pro (3.4.2) + knapsack_pro (5.7.0) rake - launchy (2.5.0) - addressable (~> 2.7) - listen (3.7.1) + language_server-protocol (3.17.0.3) + launchy (2.5.2) + addressable (~> 2.8) + listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) loofah (2.21.3) crass (~> 1.0.2) nokogiri (>= 1.12.0) - mail (2.7.1) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (1.0.2) matrix (0.4.2) method_source (1.0.0) - mime-types (3.4.1) + mime-types (3.5.1) mime-types-data (~> 3.2015) - mime-types-data (3.2022.0105) - mini_magick (4.11.0) - mini_mime (1.1.2) + mime-types-data (3.2023.0808) + mini_magick (4.12.0) + mini_mime (1.1.5) mini_portile2 (2.8.4) - minitest (5.19.0) + minitest (5.20.0) minitest-profiler (0.0.2) activesupport (>= 4.1.0) minitest (>= 5.3.3) - mocha (2.0.2) + mocha (2.1.0) ruby2_keywords (>= 0.0.5) - msgpack (1.6.0) + msgpack (1.7.2) multi_json (1.15.0) multi_test (1.1.0) mustermann (3.0.0) ruby2_keywords (~> 0.0.1) - mysql2 (0.5.4) - net-ldap (0.17.1) + mysql2 (0.5.5) + net-imap (0.3.7) + date + net-protocol + net-ldap (0.18.0) + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.4.0) + net-protocol netrc (0.11.0) nio4r (2.5.9) - nokogiri (1.15.3) + nokogiri (1.15.4) mini_portile2 (~> 2.8.2) racc (~> 1.4) - parallel (1.22.1) - parser (3.1.2.1) + parallel (1.23.0) + parser (3.2.2.3) ast (~> 2.4.1) - pry (0.14.1) + racc + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) pry-byebug (3.10.1) @@ -278,43 +299,43 @@ GEM pry (>= 0.13, < 0.15) pry-rails (0.3.9) pry (>= 0.10.4) - public_suffix (5.0.0) - puma (6.3.1) + public_suffix (5.0.3) + puma (6.4.0) nio4r (~> 2.0) racc (1.7.1) rack (2.2.8) rack-acceptable (0.1.0) rack (>= 1.1.0) - rack-cors (1.1.1) + rack-cors (2.0.1) rack (>= 2.0.0) - rack-mini-profiler (3.0.0) + rack-mini-profiler (3.1.1) rack (>= 1.2.0) - rack-protection (3.0.3) - rack - rack-proxy (0.7.6) + rack-protection (3.1.0) + rack (~> 2.2, >= 2.2.4) + rack-proxy (0.7.7) rack rack-test (2.1.0) rack (>= 1.3) - rails (6.0.6) - actioncable (= 6.0.6) - actionmailbox (= 6.0.6) - actionmailer (= 6.0.6) - actionpack (= 6.0.6) - actiontext (= 6.0.6) - actionview (= 6.0.6) - activejob (= 6.0.6) - activemodel (= 6.0.6) - activerecord (= 6.0.6) - activestorage (= 6.0.6) - activesupport (= 6.0.6) + rails (6.0.6.1) + actioncable (= 6.0.6.1) + actionmailbox (= 6.0.6.1) + actionmailer (= 6.0.6.1) + actionpack (= 6.0.6.1) + actiontext (= 6.0.6.1) + actionview (= 6.0.6.1) + activejob (= 6.0.6.1) + activemodel (= 6.0.6.1) + activerecord (= 6.0.6.1) + activestorage (= 6.0.6.1) + activesupport (= 6.0.6.1) bundler (>= 1.3.0) - railties (= 6.0.6) + railties (= 6.0.6.1) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.1.1) + rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) @@ -327,9 +348,9 @@ GEM loofah (~> 2.21) nokogiri (~> 1.14) rails-perftest (0.0.7) - railties (6.0.6) - actionpack (= 6.0.6) - activesupport (= 6.0.6) + railties (6.0.6.1) + actionpack (= 6.0.6.1) + activesupport (= 6.0.6.1) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) @@ -338,16 +359,15 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - rbtree (0.4.5) - record_loader (0.2.0) - regexp_parser (2.6.1) + rbtree (0.4.6) + regexp_parser (2.8.1) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.2.5) - roo (2.9.0) + rexml (3.2.6) + roo (2.10.0) nokogiri (~> 1) rubyzip (>= 1.3.0, < 3.0.0) rspec (3.12.0) @@ -356,9 +376,9 @@ GEM rspec-mocks (~> 3.12.0) rspec-collection_matchers (1.2.0) rspec-expectations (>= 2.99.0.beta1) - rspec-core (3.12.0) + rspec-core (3.12.2) rspec-support (~> 3.12.0) - rspec-expectations (3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-github (2.4.0) @@ -369,7 +389,7 @@ GEM rspec-json_expectations (2.2.0) rspec-longrun (3.1.0) rspec-core (>= 3.5.0, < 4) - rspec-mocks (3.12.0) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-rails (5.1.2) @@ -380,32 +400,40 @@ GEM rspec-expectations (~> 3.10) rspec-mocks (~> 3.10) rspec-support (~> 3.10) - rspec-support (3.12.0) - rubocop (1.39.0) + rspec-support (3.12.1) + rubocop (1.56.4) + base64 (~> 0.1.1) json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.1.2.1) + parser (>= 3.2.2.3) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.23.0, < 2.0) + rubocop-ast (>= 1.28.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.23.0) - parser (>= 3.1.1.0) - rubocop-performance (1.15.1) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.29.0) + parser (>= 3.2.1.0) + rubocop-capybara (2.19.0) + rubocop (~> 1.41) + rubocop-factory_bot (2.24.0) + rubocop (~> 1.33) + rubocop-performance (1.19.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.17.3) + rubocop-rails (2.21.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-rspec (2.15.0) + rubocop-rspec (2.24.1) rubocop (~> 1.33) + rubocop-capybara (~> 2.17) + rubocop-factory_bot (~> 2.22) ruby-graphviz (1.2.5) rexml - ruby-prof (1.4.3) - ruby-progressbar (1.11.0) + ruby-prof (1.6.3) + ruby-progressbar (1.13.0) ruby-units (3.0.0) ruby-vips (2.1.4) ffi (~> 1.12) @@ -416,50 +444,51 @@ GEM connection_pool (~> 2.2) multi_json (~> 1.0) thor (~> 1.1) - sanitize (6.0.2) + sanitize (6.1.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) - selenium-webdriver (4.8.5) + selenium-webdriver (4.13.1) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) - set (1.0.2) + set (1.0.3) shoulda (4.0.0) shoulda-context (~> 2.0) shoulda-matchers (~> 4.0) shoulda-context (2.0.0) shoulda-matchers (4.5.1) activesupport (>= 4.2.0) - simplecov (0.21.2) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - sinatra (3.0.3) + sinatra (3.1.0) mustermann (~> 3.0) rack (~> 2.2, >= 2.2.4) - rack-protection (= 3.0.3) + rack-protection (= 3.1.0) tilt (~> 2.0) slack-notifier (2.4.0) sorted_set (1.0.3) rbtree set (~> 1.0) - sprockets (4.1.1) + sprockets (4.2.1) concurrent-ruby (~> 1.0) - rack (> 1, < 3) + rack (>= 2.2.4, < 4) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - ssrf_filter (1.1.1) - sys-uname (1.2.2) + ssrf_filter (1.1.2) + sys-uname (1.2.3) ffi (~> 1.1) - test-prof (1.0.11) + test-prof (1.2.3) thor (1.2.2) thread_safe (0.3.6) - tilt (2.0.11) - timecop (0.9.5) + tilt (2.3.0) + timecop (0.9.8) + timeout (0.4.0) traceroute (0.8.1) rails (>= 3.0.0) tzinfo (1.2.11) @@ -467,37 +496,36 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.8.2) - unicode-display_width (2.3.0) + unicode-display_width (2.5.0) uniform_notifier (1.16.0) uuidtools (2.2.0) - vite_rails (3.0.15) + vite_rails (3.0.16) railties (>= 5.1, < 8) vite_ruby (~> 3.0, >= 3.2.2) vite_ruby (3.3.4) dry-cli (>= 0.7, < 2) rack-proxy (~> 0.6, >= 0.6.1) zeitwerk (~> 2.2) - webmock (3.18.1) + webmock (3.19.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.7.0) - websocket (1.2.9) - websocket-driver (0.7.5) + webrick (1.8.1) + websocket (1.2.10) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) whenever (1.0.0) chronic (>= 0.6.3) - will_paginate (3.3.1) + will_paginate (4.0.0) will_paginate-bootstrap (1.0.2) will_paginate (>= 3.0.3) xpath (3.2.0) nokogiri (~> 1.8) - yard (0.9.28) - webrick (~> 1.7.0) + yard (0.9.34) yard-activerecord (0.0.16) yard (>= 0.8.3) - zeitwerk (2.6.10) + zeitwerk (2.6.12) PLATFORMS ruby @@ -522,7 +550,6 @@ DEPENDENCIES daemons database_cleaner delayed_job_active_record - dynamic_form exception_notification factory_bot_rails flipper (~> 0.25.0) @@ -553,7 +580,7 @@ DEPENDENCIES rails-erd rails-perftest rainbow - record_loader + record_loader! rest-client roo rspec-collection_matchers @@ -588,4 +615,4 @@ DEPENDENCIES yard-activerecord (~> 0.0.16) BUNDLED WITH - 2.1.4 + 2.2.33 diff --git a/app/api/core/abilities.rb b/app/api/core/abilities.rb index c25d8e7e04..863acbdb43 100644 --- a/app/api/core/abilities.rb +++ b/app/api/core/abilities.rb @@ -25,7 +25,7 @@ def self.create(request) CompositeAbility.new(request) end - module ActionBehaviour # rubocop:todo Style/Documentation + module ActionBehaviour # Modify the behaviour so that we can only access the action if the ability permits and the super # implementation permits it too. def accessible_action?(handler, action, request, object) @@ -43,12 +43,12 @@ def initialize(request) @application.authenticate!(@user) end - def can?(*args, &block) - application.can?(*args, &block) or user.can?(*args, &block) + def can?(...) + application.can?(...) or user.can?(...) end end - class Base # rubocop:todo Style/Documentation + class Base class Recorder #:nodoc: def initialize @recorded = [] @@ -63,7 +63,7 @@ def record(&block) end end - module ClassMethods # rubocop:todo Style/Documentation + module ClassMethods def recorder_helper(name) line = __LINE__ + 1 singleton_class.class_eval( @@ -102,7 +102,7 @@ def abilitise(name) private :abilitise end - class User < Base # rubocop:todo Style/Documentation + class User < Base unregistered do # The API is designed to be read-only, at least. can(:read, :all) @@ -137,7 +137,7 @@ def authenticated! end end - class Application < Base # rubocop:todo Style/Documentation + class Application < Base recorder_helper(:tag_plates) def initialize(request) diff --git a/app/api/core/benchmarking.rb b/app/api/core/benchmarking.rb index 663b95edd1..c0b13ee420 100644 --- a/app/api/core/benchmarking.rb +++ b/app/api/core/benchmarking.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Core::Benchmarking # rubocop:todo Style/Documentation +module Core::Benchmarking def self.registered(app) app.helpers self end diff --git a/app/api/core/endpoint/basic_handler.rb b/app/api/core/endpoint/basic_handler.rb index 84e27ee23f..f566c7895b 100644 --- a/app/api/core/endpoint/basic_handler.rb +++ b/app/api/core/endpoint/basic_handler.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Core::Endpoint::BasicHandler # rubocop:todo Style/Documentation - module Json # rubocop:todo Style/Documentation +class Core::Endpoint::BasicHandler + module Json def actions(object, options) @actions .select { |_name, behaviour| accessible_action?(self, behaviour, options[:response].request, object) } diff --git a/app/api/core/endpoint/basic_handler/actions.rb b/app/api/core/endpoint/basic_handler/actions.rb index d165a09bc3..4ea6b2e366 100644 --- a/app/api/core/endpoint/basic_handler/actions.rb +++ b/app/api/core/endpoint/basic_handler/actions.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # rubocop:todo Metrics/ModuleLength -module Core::Endpoint::BasicHandler::Actions # rubocop:todo Style/Documentation - class UnsupportedAction < StandardError # rubocop:todo Style/Documentation +module Core::Endpoint::BasicHandler::Actions + class UnsupportedAction < StandardError def initialize(action, _request) super(action.to_s) end diff --git a/app/api/core/endpoint/basic_handler/actions/bound.rb b/app/api/core/endpoint/basic_handler/actions/bound.rb index 995c96e86c..7b244c6d38 100644 --- a/app/api/core/endpoint/basic_handler/actions/bound.rb +++ b/app/api/core/endpoint/basic_handler/actions/bound.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Core::Endpoint::BasicHandler::Actions::Bound # rubocop:todo Style/Documentation +module Core::Endpoint::BasicHandler::Actions::Bound def bind_action(name, options, &block) class_handler = Class.new(Handler).tap { |handler| self.class.const_set(options[:as].to_s.camelize, handler) } register_handler(options[:to], class_handler.new(self, name, options, &block)) diff --git a/app/api/core/endpoint/basic_handler/actions/factory.rb b/app/api/core/endpoint/basic_handler/actions/factory.rb index fc04f8d4c7..a04588ae36 100644 --- a/app/api/core/endpoint/basic_handler/actions/factory.rb +++ b/app/api/core/endpoint/basic_handler/actions/factory.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Core::Endpoint::BasicHandler::Actions::Factory # rubocop:todo Style/Documentation - class Nested < Core::Endpoint::BasicHandler # rubocop:todo Style/Documentation +module Core::Endpoint::BasicHandler::Actions::Factory + class Nested < Core::Endpoint::BasicHandler def initialize(name, &block) super(&block) @name = name.to_s diff --git a/app/api/core/endpoint/basic_handler/actions/guards.rb b/app/api/core/endpoint/basic_handler/actions/guards.rb index 976dfa9bb3..fcf29c54ba 100644 --- a/app/api/core/endpoint/basic_handler/actions/guards.rb +++ b/app/api/core/endpoint/basic_handler/actions/guards.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Core::Endpoint::BasicHandler::Actions::Guards # rubocop:todo Style/Documentation - class Guard # rubocop:todo Style/Documentation +module Core::Endpoint::BasicHandler::Actions::Guards + class Guard def initialize(method = nil, &block) # rubocop:todo Metrics/MethodLength if method.present? line = __LINE__ + 1 @@ -21,7 +21,7 @@ def execute(object) end end - class GuardChain # rubocop:todo Style/Documentation + class GuardChain def initialize @guards = [] end @@ -35,7 +35,7 @@ def execute(object) end end - class GuardProxy < ActiveSupport::ProxyObject # rubocop:todo Style/Documentation + class GuardProxy < ActiveSupport::ProxyObject def initialize(request, object) @request, @object = request, object end @@ -44,8 +44,8 @@ def respond_to?(method, private_methods = false) super || @object.respond_to?(method, private_methods) end - def method_missing(name, *args, &block) - @object.send(name, *args, &block) + def method_missing(name, ...) + @object.send(name, ...) end protected :method_missing end diff --git a/app/api/core/endpoint/basic_handler/actions/inner_action.rb b/app/api/core/endpoint/basic_handler/actions/inner_action.rb index b9e43ac0b8..d466b62d39 100644 --- a/app/api/core/endpoint/basic_handler/actions/inner_action.rb +++ b/app/api/core/endpoint/basic_handler/actions/inner_action.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Core::Endpoint::BasicHandler::Actions::InnerAction # rubocop:todo Style/Documentation +module Core::Endpoint::BasicHandler::Actions::InnerAction def initialize(name, options, &block) raise StandardError, "Cannot declare inner action #{name.inspect} without a block" unless block diff --git a/app/api/core/endpoint/basic_handler/actions/standard.rb b/app/api/core/endpoint/basic_handler/actions/standard.rb index e771c64c41..5addb8d48d 100644 --- a/app/api/core/endpoint/basic_handler/actions/standard.rb +++ b/app/api/core/endpoint/basic_handler/actions/standard.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Core::Endpoint::BasicHandler::Actions::Standard # rubocop:todo Style/Documentation +module Core::Endpoint::BasicHandler::Actions::Standard def self.extended(base) base.class_eval do include InstanceMethods @@ -14,7 +14,7 @@ def standard_action(*names) standard_actions.merge!(names.to_h { |a| [a.to_sym, a.to_sym] }) end - module InstanceMethods # rubocop:todo Style/Documentation + module InstanceMethods def standard_update!(request, _) request.update! end diff --git a/app/api/core/endpoint/basic_handler/associations/belongs_to.rb b/app/api/core/endpoint/basic_handler/associations/belongs_to.rb index 9b6438aea3..5cc1e859fe 100644 --- a/app/api/core/endpoint/basic_handler/associations/belongs_to.rb +++ b/app/api/core/endpoint/basic_handler/associations/belongs_to.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Core::Endpoint::BasicHandler::Associations::BelongsTo # rubocop:todo Style/Documentation - class Handler # rubocop:todo Style/Documentation +module Core::Endpoint::BasicHandler::Associations::BelongsTo + class Handler include Core::Endpoint::BasicHandler::EndpointLookup def initialize(name, options) @@ -21,7 +21,7 @@ def endpoint_details(object) end private :endpoint_details - class Association # rubocop:todo Style/Documentation + class Association include Core::Io::Json::Grammar::Intermediate include Core::Io::Json::Grammar::Resource diff --git a/app/api/core/endpoint/basic_handler/associations/has_file.rb b/app/api/core/endpoint/basic_handler/associations/has_file.rb index 2fc5fc0782..a70106a2e7 100644 --- a/app/api/core/endpoint/basic_handler/associations/has_file.rb +++ b/app/api/core/endpoint/basic_handler/associations/has_file.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Core::Endpoint::BasicHandler::Associations::HasFile # rubocop:todo Style/Documentation +module Core::Endpoint::BasicHandler::Associations::HasFile def has_file(options) ::Api::EndpointHandler.register_mimetype(options[:content_type]) @supported_types ||= {} diff --git a/app/api/core/endpoint/basic_handler/associations/has_many.rb b/app/api/core/endpoint/basic_handler/associations/has_many.rb index 18d4f1d358..dfc9e968f0 100644 --- a/app/api/core/endpoint/basic_handler/associations/has_many.rb +++ b/app/api/core/endpoint/basic_handler/associations/has_many.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Core::Endpoint::BasicHandler::Associations::HasMany # rubocop:todo Style/Documentation +module Core::Endpoint::BasicHandler::Associations::HasMany # # Defines a has_many relationship which will be exposed via the v1 api # @param name [Symbol] The name of the association to expose via the api diff --git a/app/api/core/endpoint/basic_handler/associations/has_many/handler.rb b/app/api/core/endpoint/basic_handler/associations/has_many/handler.rb index f2ccc48170..f8e1f4d6f0 100644 --- a/app/api/core/endpoint/basic_handler/associations/has_many/handler.rb +++ b/app/api/core/endpoint/basic_handler/associations/has_many/handler.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Core::Endpoint::BasicHandler::Associations::HasMany::Handler < Core::Endpoint::BasicHandler # rubocop:todo Style/Documentation +class Core::Endpoint::BasicHandler::Associations::HasMany::Handler < Core::Endpoint::BasicHandler include Core::Endpoint::BasicHandler::Paged def initialize(association, options, &block) diff --git a/app/api/core/endpoint/basic_handler/endpoint_lookup.rb b/app/api/core/endpoint/basic_handler/endpoint_lookup.rb index bbd193f1b5..31b4000655 100644 --- a/app/api/core/endpoint/basic_handler/endpoint_lookup.rb +++ b/app/api/core/endpoint/basic_handler/endpoint_lookup.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Core::Endpoint::BasicHandler::EndpointLookup # rubocop:todo Style/Documentation +module Core::Endpoint::BasicHandler::EndpointLookup EndpointError = Class.new(StandardError) MissingEndpoint = Class.new(EndpointError) diff --git a/app/api/core/endpoint/basic_handler/handlers.rb b/app/api/core/endpoint/basic_handler/handlers.rb index 91512f2bf3..d0fdfcc507 100644 --- a/app/api/core/endpoint/basic_handler/handlers.rb +++ b/app/api/core/endpoint/basic_handler/handlers.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Core::Endpoint::BasicHandler::Handlers # rubocop:todo Style/Documentation +module Core::Endpoint::BasicHandler::Handlers # Handler that behaves like it never deals with any URLs NullHandler = Object.new.tap do |handler| diff --git a/app/api/core/endpoint/basic_handler/paged.rb b/app/api/core/endpoint/basic_handler/paged.rb index 9246ae0b4d..39bc0fccb3 100644 --- a/app/api/core/endpoint/basic_handler/paged.rb +++ b/app/api/core/endpoint/basic_handler/paged.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Core::Endpoint::BasicHandler::Paged # rubocop:todo Style/Documentation +module Core::Endpoint::BasicHandler::Paged def self.page_accessor(action, will_paginate_method, default_value = nil) lambda do |object| page = object.send(will_paginate_method) || default_value @@ -54,14 +54,14 @@ def page_of_results(target, page = 1, model = target) end private :page_of_results - class PagedTarget # rubocop:todo Style/Documentation + class PagedTarget def initialize(model) @model = model end delegate :count, to: :@model - class PageOfResults # rubocop:todo Style/Documentation + class PageOfResults def initialize(page, _total, per_page) @page, @total_pages = page, page / per_page end diff --git a/app/api/core/initializable.rb b/app/api/core/initializable.rb index ef593a6cb9..ea68e4f0aa 100644 --- a/app/api/core/initializable.rb +++ b/app/api/core/initializable.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -module Core::Initializable # rubocop:todo Style/Documentation - class Initializer # rubocop:todo Style/Documentation +module Core::Initializable + class Initializer def initialize(owner) @owner = owner end @@ -13,8 +13,7 @@ def delegated_attribute_writer(*names) end def delegate_to_owner(*names) - names.push(to: :@owner) - delegate(*names) + delegate(*names, to: :@owner) end end end @@ -36,7 +35,7 @@ def initialized_delegate(*names) self::Initializer.delegate_to_owner(*names) end - module InstanceMethods # rubocop:todo Style/Documentation + module InstanceMethods def initialize yield(self.class::Initializer.new(self)) if block_given? end diff --git a/app/api/core/io/base/eager_loading_behaviour.rb b/app/api/core/io/base/eager_loading_behaviour.rb index eb3d95433b..6f3ba4e86f 100644 --- a/app/api/core/io/base/eager_loading_behaviour.rb +++ b/app/api/core/io/base/eager_loading_behaviour.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Core::Io::Base::EagerLoadingBehaviour # rubocop:todo Style/Documentation +module Core::Io::Base::EagerLoadingBehaviour def set_eager_loading singleton_class.class_eval { define_method(:eager_loading_for) { |loaded_class| yield(super(loaded_class)) } } end diff --git a/app/api/core/io/base/json_formatting_behaviour.rb b/app/api/core/io/base/json_formatting_behaviour.rb index 56f8842824..cefabc6f9a 100644 --- a/app/api/core/io/base/json_formatting_behaviour.rb +++ b/app/api/core/io/base/json_formatting_behaviour.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Core::Io::Base::JsonFormattingBehaviour # rubocop:todo Style/Documentation +module Core::Io::Base::JsonFormattingBehaviour def self.extended(base) base.class_eval do extend ::Core::Io::Base::JsonFormattingBehaviour::Input @@ -62,7 +62,6 @@ def define_attribute_and_json_mapping(mapping) end VALID_LINE_REGEXP = /^\s*((?:[a-z_][\w_]*\.)*[a-z_][\w_]*[?!]?)\s*(<=|<=>|=>)\s*((?:[a-z_][\w_]*\.)*[a-z_][\w_]*)\s*$/ - .freeze def parse_mapping_rules(mapping) # rubocop:todo Metrics/AbcSize attribute_to_json, json_to_attribute = [], [] diff --git a/app/api/core/io/base/json_formatting_behaviour/input.rb b/app/api/core/io/base/json_formatting_behaviour/input.rb index 289df6eb05..dd20a333ec 100644 --- a/app/api/core/io/base/json_formatting_behaviour/input.rb +++ b/app/api/core/io/base/json_formatting_behaviour/input.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -module Core::Io::Base::JsonFormattingBehaviour::Input # rubocop:todo Style/Documentation - class ReadOnlyAttribute < ::Core::Service::Error # rubocop:todo Style/Documentation +module Core::Io::Base::JsonFormattingBehaviour::Input + class ReadOnlyAttribute < ::Core::Service::Error def initialize(attribute) super('is read-only') @attribute = attribute @@ -138,7 +138,7 @@ def process_if_present(json, path) end private :process_if_present - module AssociationHandling # rubocop:todo Style/Documentation + module AssociationHandling def association_class(association, object) object.try(association).try(:class) || model_for_input.reflections[association.to_s].klass end diff --git a/app/api/core/io/base/json_formatting_behaviour/output.rb b/app/api/core/io/base/json_formatting_behaviour/output.rb index 1d79d2fd34..f06c61137a 100644 --- a/app/api/core/io/base/json_formatting_behaviour/output.rb +++ b/app/api/core/io/base/json_formatting_behaviour/output.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Core::Io::Base::JsonFormattingBehaviour::Output # rubocop:todo Style/Documentation +module Core::Io::Base::JsonFormattingBehaviour::Output def json_code_tree ::Core::Io::Json::Grammar::Root.new(self) end diff --git a/app/api/core/io/buffer.rb b/app/api/core/io/buffer.rb index 00e155eff8..662512e4d5 100644 --- a/app/api/core/io/buffer.rb +++ b/app/api/core/io/buffer.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Core::Io::Buffer # rubocop:todo Style/Documentation +class Core::Io::Buffer def initialize(stream) @stream, @buffer = stream, StringIO.new return unless block_given? diff --git a/app/api/core/io/collection.rb b/app/api/core/io/collection.rb index 825e6f1355..ac2b42e6b2 100644 --- a/app/api/core/io/collection.rb +++ b/app/api/core/io/collection.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Core::Io::Collection # rubocop:todo Style/Documentation +module Core::Io::Collection def as_json(options = {}) results, base_stream = options[:object], options[:stream] diff --git a/app/api/core/io/json/grammar.rb b/app/api/core/io/json/grammar.rb index 77303e1646..205239eba3 100644 --- a/app/api/core/io/json/grammar.rb +++ b/app/api/core/io/json/grammar.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module Core::Io::Json::Grammar - module Intermediate # rubocop:todo Style/Documentation + module Intermediate attr_reader :children def initialize(children) @@ -61,7 +61,7 @@ def duplicate private :duplicate end - class Root # rubocop:todo Style/Documentation + class Root include Intermediate def initialize(owner, children = nil) @@ -112,7 +112,7 @@ def inspect end end - class Node # rubocop:todo Style/Documentation + class Node include Intermediate attr_reader :name @@ -138,7 +138,7 @@ def inspect end end - class Leaf # rubocop:todo Style/Documentation + class Leaf attr_reader :name def initialize(name, attribute) @@ -178,7 +178,7 @@ def inspect end end - module Resource # rubocop:todo Style/Documentation + module Resource def resource_details(endpoint, object, options, stream) stream.block('actions') do |nested_stream| endpoint @@ -190,7 +190,7 @@ def resource_details(endpoint, object, options, stream) end end - class Actions # rubocop:todo Style/Documentation + class Actions include Intermediate include Resource diff --git a/app/api/core/io/list.rb b/app/api/core/io/list.rb index 51e4459efb..e2ebfc565f 100644 --- a/app/api/core/io/list.rb +++ b/app/api/core/io/list.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Core::Io::List # rubocop:todo Style/Documentation +class Core::Io::List include Core::Benchmarking def initialize(command, objects) diff --git a/app/api/core/io/registry.rb b/app/api/core/io/registry.rb index 642fdfaa7c..46584a915d 100644 --- a/app/api/core/io/registry.rb +++ b/app/api/core/io/registry.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Core::Io::Registry < ::Core::Registry # rubocop:todo Style/Documentation +class Core::Io::Registry < Core::Registry # Looks up the I/O class by guessing at the name based on the model. If it finds it it then registers # that class for the model class specified. def lookup_target_class_in_registry(model_class) diff --git a/app/api/core/logging.rb b/app/api/core/logging.rb index bffc9d4e92..dc775e695e 100644 --- a/app/api/core/logging.rb +++ b/app/api/core/logging.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Core::Logging # rubocop:todo Style/Documentation +module Core::Logging def self.logging_helper(name) module_eval <<-END_OF_HELPER def #{name}(message) diff --git a/app/api/core/references.rb b/app/api/core/references.rb index bfc85c473f..0f31007104 100644 --- a/app/api/core/references.rb +++ b/app/api/core/references.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Core::References # rubocop:todo Style/Documentation +module Core::References # Discards all of the references that this object is keeping to other objects. This means that # all of the objects should be garbage collected, rather than a proportion that are external to an # instance of this class. diff --git a/app/api/core/registry.rb b/app/api/core/registry.rb index 264ea53c7e..7943750814 100644 --- a/app/api/core/registry.rb +++ b/app/api/core/registry.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Core::Registry # rubocop:todo Style/Documentation +class Core::Registry include ::Singleton include ::Core::Logging @@ -18,7 +18,7 @@ def lookup_target_class_in_registry!(model_class) end def lookup_target_class_through_model_hierarchy!(model_class, root_lookup_model_class = model_class) - if model_class.nil? || (ActiveRecord::Base == model_class) + if model_class.nil? || (model_class == ActiveRecord::Base) raise UnregisteredError, "Unable to locate for #{root_lookup_model_class.name.inspect} (#{inspect})" end diff --git a/app/api/core/service.rb b/app/api/core/service.rb index af49601184..aef4957cc7 100644 --- a/app/api/core/service.rb +++ b/app/api/core/service.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true require 'sinatra/base' module Core - class Service < Sinatra::Base # rubocop:todo Style/Documentation + class Service < Sinatra::Base API_VERSION = 1 - class Error < StandardError # rubocop:todo Style/Documentation - module Behaviour # rubocop:todo Style/Documentation + class Error < StandardError + module Behaviour def self.included(base) base.class_eval do class_attribute :api_error_code @@ -23,17 +23,17 @@ def api_error(response) include Behaviour end - class UnsupportedAction < Error # rubocop:todo Style/Documentation + class UnsupportedAction < Error self.api_error_code = 501 self.api_error_message = 'requested action is not supported on this resource' end - class DeprecatedAction < Error # rubocop:todo Style/Documentation + class DeprecatedAction < Error self.api_error_code = 410 self.api_error_message = 'requested action is no longer supported' end - class MethodNotAllowed < Error # rubocop:todo Style/Documentation + class MethodNotAllowed < Error def initialize(allowed_http_verbs) super('HTTP verb was not allowed!') @allowed = Array(allowed_http_verbs).map(&:to_s).map(&:upcase).join(',') @@ -114,7 +114,7 @@ def self.after_all_actions(&block) register Core::Service::Authentication register Core::Service::ContentFiltering - class Request # rubocop:todo Style/Documentation + class Request extend Core::Initializable include Core::References include Core::Benchmarking @@ -188,7 +188,7 @@ class Response include Core::References include Core::Benchmarking - class Initializer # rubocop:todo Style/Documentation + class Initializer delegate :status, :headers, :api_path, to: '@owner.request.service' # Causes a response that will redirect the client to the specified UUID path. diff --git a/app/api/core/service/authentication.rb b/app/api/core/service/authentication.rb index 0807f20181..10c40e436b 100644 --- a/app/api/core/service/authentication.rb +++ b/app/api/core/service/authentication.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Core::Service::Authentication # rubocop:todo Style/Documentation - class UnauthenticatedError < Core::Service::Error # rubocop:todo Style/Documentation +module Core::Service::Authentication + class UnauthenticatedError < Core::Service::Error def self.no_cookie! raise self, 'no authentication provided' end @@ -14,7 +14,7 @@ def api_error(response) end end - module Helpers # rubocop:todo Style/Documentation + module Helpers def user @user end diff --git a/app/api/core/service/content_filtering.rb b/app/api/core/service/content_filtering.rb index e374278726..4874ba3c14 100644 --- a/app/api/core/service/content_filtering.rb +++ b/app/api/core/service/content_filtering.rb @@ -1,24 +1,24 @@ # frozen_string_literal: true # Everything coming in and going out should be JSON. module Core::Service::ContentFiltering - class InvalidRequestedContentType < ::Core::Service::Error # rubocop:todo Style/Documentation + class InvalidRequestedContentType < ::Core::Service::Error self.api_error_code = 406 self.api_error_message = "the 'Accept' header can only be 'application/json' or a supported filetype eg.'sequencescape/qc_file'" end - class InvalidRequestedContentTypeOnFile < ::Core::Service::Error # rubocop:todo Style/Documentation + class InvalidRequestedContentTypeOnFile < ::Core::Service::Error self.api_error_code = 406 self.api_error_message = "the 'Accept' header can only be 'application/json' when submitting a file" end - class InvalidBodyContentType < ::Core::Service::Error # rubocop:todo Style/Documentation + class InvalidBodyContentType < ::Core::Service::Error self.api_error_code = 415 self.api_error_message = "the 'Content-Type' can only be 'application/json' or a supported filetype eg.'sequencescape/qc_file'" end - module Helpers # rubocop:todo Style/Documentation + module Helpers def json @json end diff --git a/app/api/core/service/endpoint_handling.rb b/app/api/core/service/endpoint_handling.rb index 74205d15ae..fca70c3f4b 100644 --- a/app/api/core/service/endpoint_handling.rb +++ b/app/api/core/service/endpoint_handling.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Core::Service::EndpointHandling # rubocop:todo Style/Documentation +module Core::Service::EndpointHandling def self.included(base) base.class_eval { attr_reader :endpoint } end diff --git a/app/api/core/service/error_handling.rb b/app/api/core/service/error_handling.rb index a39f21342a..1b5b5664b5 100644 --- a/app/api/core/service/error_handling.rb +++ b/app/api/core/service/error_handling.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Core::Service::ErrorHandling # rubocop:todo Style/Documentation +module Core::Service::ErrorHandling def self.registered(app) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength app.instance_eval do helpers Helpers @@ -23,8 +23,8 @@ def self.registered(app) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength end end - module Helpers # rubocop:todo Style/Documentation - class JsonError # rubocop:todo Style/Documentation + module Helpers + class JsonError def initialize(error) @error = error end @@ -50,20 +50,20 @@ def content_error(code, errors = nil) end end -class ActiveRecord::ActiveRecordError # rubocop:todo Style/Documentation +class ActiveRecord::ActiveRecordError include ::Core::Service::Error::Behaviour self.api_error_code = 500 end -class ActiveRecord::RecordNotFound # rubocop:todo Style/Documentation +class ActiveRecord::RecordNotFound self.api_error_code = 404 end -class ActiveRecord::AssociationTypeMismatch # rubocop:todo Style/Documentation +class ActiveRecord::AssociationTypeMismatch self.api_error_code = 422 end -class ActiveRecord::RecordInvalid # rubocop:todo Style/Documentation +class ActiveRecord::RecordInvalid def api_error(response) io_handler = ::Core::Io::Registry.instance.lookup_for_object(record) response.content_error(422, errors_grouped_by_attribute { |attribute| io_handler.json_field_for(attribute) }) @@ -75,7 +75,7 @@ def errors_grouped_by_attribute private :errors_grouped_by_attribute end -class ActiveModel::ValidationError # rubocop:todo Style/Documentation +class ActiveModel::ValidationError def api_error(response) io_handler = ::Core::Io::Registry.instance.lookup_for_object(model) response.content_error(422, errors_grouped_by_attribute { |attribute| io_handler.json_field_for(attribute) }) @@ -87,17 +87,17 @@ def errors_grouped_by_attribute private :errors_grouped_by_attribute end -class ActiveRecord::RecordNotSaved # rubocop:todo Style/Documentation +class ActiveRecord::RecordNotSaved def api_error(response) response.content_error(422, message) end end -class IllegalOperation < RuntimeError # rubocop:todo Style/Documentation +class IllegalOperation < RuntimeError include ::Core::Service::Error::Behaviour self.api_error_code = 501 self.api_error_message = 'requested action is not supported on this resource' end -Aliquot::TagClash.include ::Core::Service::Error::Behaviour +Aliquot::TagClash.include Core::Service::Error::Behaviour Aliquot::TagClash.api_error_code = 422 diff --git a/app/api/endpoints/asset_audits.rb b/app/api/endpoints/asset_audits.rb index 852a84259f..ab2d3c0ced 100644 --- a/app/api/endpoints/asset_audits.rb +++ b/app/api/endpoints/asset_audits.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for AssetAudits -class Endpoints::AssetAudits < ::Core::Endpoint::Base +class Endpoints::AssetAudits < Core::Endpoint::Base model { action(:create) { |request, _response| request.create! } } instance { belongs_to(:asset, json: 'asset') } diff --git a/app/api/endpoints/asset_groups.rb b/app/api/endpoints/asset_groups.rb index b8e9c9cb6b..3f865f13b6 100644 --- a/app/api/endpoints/asset_groups.rb +++ b/app/api/endpoints/asset_groups.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for AssetGroups -class Endpoints::AssetGroups < ::Core::Endpoint::Base +class Endpoints::AssetGroups < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/assets.rb b/app/api/endpoints/assets.rb index 6e5d659fc6..d030826174 100644 --- a/app/api/endpoints/assets.rb +++ b/app/api/endpoints/assets.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Assets -class Endpoints::Assets < ::Core::Endpoint::Base +class Endpoints::Assets < Core::Endpoint::Base model {} instance {} diff --git a/app/api/endpoints/bait_library_layouts.rb b/app/api/endpoints/bait_library_layouts.rb index cfcd946790..af2cd7139d 100644 --- a/app/api/endpoints/bait_library_layouts.rb +++ b/app/api/endpoints/bait_library_layouts.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for BaitLibraryLayouts -class Endpoints::BaitLibraryLayouts < ::Core::Endpoint::Base +class Endpoints::BaitLibraryLayouts < Core::Endpoint::Base model do action(:create, to: :standard_create!) diff --git a/app/api/endpoints/barcode_printers.rb b/app/api/endpoints/barcode_printers.rb index db8d57f3dd..ecaf7656c9 100644 --- a/app/api/endpoints/barcode_printers.rb +++ b/app/api/endpoints/barcode_printers.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for BarcodePrinters -class Endpoints::BarcodePrinters < ::Core::Endpoint::Base +class Endpoints::BarcodePrinters < Core::Endpoint::Base model {} instance {} diff --git a/app/api/endpoints/batches.rb b/app/api/endpoints/batches.rb index d716027be3..095c07b58d 100644 --- a/app/api/endpoints/batches.rb +++ b/app/api/endpoints/batches.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Batches -class Endpoints::Batches < ::Core::Endpoint::Base +class Endpoints::Batches < Core::Endpoint::Base model {} instance { belongs_to(:pipeline, json: 'pipeline') } diff --git a/app/api/endpoints/bulk_transfers.rb b/app/api/endpoints/bulk_transfers.rb index ae39c20986..4f7075f6cb 100644 --- a/app/api/endpoints/bulk_transfers.rb +++ b/app/api/endpoints/bulk_transfers.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for BulkTransfers -class Endpoints::BulkTransfers < ::Core::Endpoint::Base +class Endpoints::BulkTransfers < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/comments.rb b/app/api/endpoints/comments.rb index 79ce9e2065..689e5b0a12 100644 --- a/app/api/endpoints/comments.rb +++ b/app/api/endpoints/comments.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Comments -class Endpoints::Comments < ::Core::Endpoint::Base +class Endpoints::Comments < Core::Endpoint::Base model {} instance { belongs_to(:user, json: 'user') } diff --git a/app/api/endpoints/custom_metadatum_collections.rb b/app/api/endpoints/custom_metadatum_collections.rb index 8e1b185646..5601f7d3d4 100644 --- a/app/api/endpoints/custom_metadatum_collections.rb +++ b/app/api/endpoints/custom_metadatum_collections.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for CustomMetadatumCollections -class Endpoints::CustomMetadatumCollections < ::Core::Endpoint::Base +class Endpoints::CustomMetadatumCollections < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/dilution_plate_purposes.rb b/app/api/endpoints/dilution_plate_purposes.rb index 0ba4f8a514..95d31f2c72 100644 --- a/app/api/endpoints/dilution_plate_purposes.rb +++ b/app/api/endpoints/dilution_plate_purposes.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for DilutionPlatePurposes -class Endpoints::DilutionPlatePurposes < ::Endpoints::PlatePurposes +class Endpoints::DilutionPlatePurposes < Endpoints::PlatePurposes end diff --git a/app/api/endpoints/extraction_attributes.rb b/app/api/endpoints/extraction_attributes.rb index 467b39a1bf..ea170ab622 100644 --- a/app/api/endpoints/extraction_attributes.rb +++ b/app/api/endpoints/extraction_attributes.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for ExtractionAttributes -class Endpoints::ExtractionAttributes < ::Core::Endpoint::Base +class Endpoints::ExtractionAttributes < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance { belongs_to(:target, json: 'target') } diff --git a/app/api/endpoints/lanes.rb b/app/api/endpoints/lanes.rb index e07a1e8328..a3e81b6ce4 100644 --- a/app/api/endpoints/lanes.rb +++ b/app/api/endpoints/lanes.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Lanes -class Endpoints::Lanes < ::Core::Endpoint::Base +class Endpoints::Lanes < Core::Endpoint::Base model {} instance { has_many(:requests, json: 'requests', to: 'requests') } diff --git a/app/api/endpoints/library_creation_requests.rb b/app/api/endpoints/library_creation_requests.rb index c800507f24..4b2ead4a16 100644 --- a/app/api/endpoints/library_creation_requests.rb +++ b/app/api/endpoints/library_creation_requests.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for LibraryCreationRequests -class Endpoints::LibraryCreationRequests < ::Endpoints::Requests +class Endpoints::LibraryCreationRequests < Endpoints::Requests end diff --git a/app/api/endpoints/library_events.rb b/app/api/endpoints/library_events.rb index 6985183a4f..8cff479975 100644 --- a/app/api/endpoints/library_events.rb +++ b/app/api/endpoints/library_events.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for LibraryEvents -class Endpoints::LibraryEvents < ::Core::Endpoint::Base +class Endpoints::LibraryEvents < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/library_tubes.rb b/app/api/endpoints/library_tubes.rb index 8b5f58f395..ecab1823f6 100644 --- a/app/api/endpoints/library_tubes.rb +++ b/app/api/endpoints/library_tubes.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for LibraryTubes -class Endpoints::LibraryTubes < ::Endpoints::Tubes +class Endpoints::LibraryTubes < Endpoints::Tubes instance do belongs_to(:custom_metadatum_collection, json: 'custom_metadatum_collection', to: 'custom_metadatum_collection') belongs_to(:purpose, json: 'purpose') diff --git a/app/api/endpoints/lot_types.rb b/app/api/endpoints/lot_types.rb index bcdc2090a4..121ff4c993 100644 --- a/app/api/endpoints/lot_types.rb +++ b/app/api/endpoints/lot_types.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for LotTypes -class Endpoints::LotTypes < ::Core::Endpoint::Base +class Endpoints::LotTypes < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/lots.rb b/app/api/endpoints/lots.rb index 90bfb14413..911d4357d4 100644 --- a/app/api/endpoints/lots.rb +++ b/app/api/endpoints/lots.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Lots -class Endpoints::Lots < ::Core::Endpoint::Base +class Endpoints::Lots < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/multiplexed_library_creation_requests.rb b/app/api/endpoints/multiplexed_library_creation_requests.rb index 33f5238bc9..f8b630f8ae 100644 --- a/app/api/endpoints/multiplexed_library_creation_requests.rb +++ b/app/api/endpoints/multiplexed_library_creation_requests.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for MultiplexedLibraryCreationRequests -class Endpoints::MultiplexedLibraryCreationRequests < ::Endpoints::LibraryCreationRequests +class Endpoints::MultiplexedLibraryCreationRequests < Endpoints::LibraryCreationRequests end diff --git a/app/api/endpoints/multiplexed_library_tubes.rb b/app/api/endpoints/multiplexed_library_tubes.rb index 5e8817e8f6..e775e028e1 100644 --- a/app/api/endpoints/multiplexed_library_tubes.rb +++ b/app/api/endpoints/multiplexed_library_tubes.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for MultiplexedLibraryTubes -class Endpoints::MultiplexedLibraryTubes < ::Endpoints::LibraryTubes +class Endpoints::MultiplexedLibraryTubes < Endpoints::LibraryTubes instance do belongs_to(:custom_metadatum_collection, json: 'custom_metadatum_collection', to: 'custom_metadatum_collection') has_many(:requests_as_source, json: 'requests', to: 'requests') diff --git a/app/api/endpoints/order_templates.rb b/app/api/endpoints/order_templates.rb index dadb15b19d..cf24305eee 100644 --- a/app/api/endpoints/order_templates.rb +++ b/app/api/endpoints/order_templates.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Endpoints::OrderTemplates < Core::Endpoint::Base # rubocop:todo Style/Documentation +class Endpoints::OrderTemplates < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/orders.rb b/app/api/endpoints/orders.rb index 1bf821d580..abec956819 100644 --- a/app/api/endpoints/orders.rb +++ b/app/api/endpoints/orders.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Endpoints::Orders < Core::Endpoint::Base # rubocop:todo Style/Documentation +class Endpoints::Orders < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/pipelines.rb b/app/api/endpoints/pipelines.rb index 239a742232..d46ed8e8f3 100644 --- a/app/api/endpoints/pipelines.rb +++ b/app/api/endpoints/pipelines.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Pipelines -class Endpoints::Pipelines < ::Core::Endpoint::Base +class Endpoints::Pipelines < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/plate_conversions.rb b/app/api/endpoints/plate_conversions.rb index 10880d92a8..46dfbc6c5c 100644 --- a/app/api/endpoints/plate_conversions.rb +++ b/app/api/endpoints/plate_conversions.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for PlateConversions -class Endpoints::PlateConversions < ::Core::Endpoint::Base +class Endpoints::PlateConversions < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/plate_creations.rb b/app/api/endpoints/plate_creations.rb index f8ad5d98f4..40bab7e0ef 100644 --- a/app/api/endpoints/plate_creations.rb +++ b/app/api/endpoints/plate_creations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for PlateCreations -class Endpoints::PlateCreations < ::Core::Endpoint::Base +class Endpoints::PlateCreations < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/plate_purposes.rb b/app/api/endpoints/plate_purposes.rb index f9dfd4d6b9..c20b4ca848 100644 --- a/app/api/endpoints/plate_purposes.rb +++ b/app/api/endpoints/plate_purposes.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for PlatePurposes -class Endpoints::PlatePurposes < ::Core::Endpoint::Base +class Endpoints::PlatePurposes < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/plate_templates.rb b/app/api/endpoints/plate_templates.rb index 64ce4b327e..d17912dcb0 100644 --- a/app/api/endpoints/plate_templates.rb +++ b/app/api/endpoints/plate_templates.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for PlateTemplates -class Endpoints::PlateTemplates < ::Core::Endpoint::Base +class Endpoints::PlateTemplates < Core::Endpoint::Base model {} instance { has_many(:wells, json: 'wells', to: 'wells', scoped: 'for_api_plate_json.in_row_major_order') } diff --git a/app/api/endpoints/plates.rb b/app/api/endpoints/plates.rb index b2dda9d800..c16ac49133 100644 --- a/app/api/endpoints/plates.rb +++ b/app/api/endpoints/plates.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Plates -class Endpoints::Plates < ::Core::Endpoint::Base +class Endpoints::Plates < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/pooled_plate_creations.rb b/app/api/endpoints/pooled_plate_creations.rb index 979dd2cfee..345e6e3f30 100644 --- a/app/api/endpoints/pooled_plate_creations.rb +++ b/app/api/endpoints/pooled_plate_creations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for PooledPlateCreations -class Endpoints::PooledPlateCreations < ::Core::Endpoint::Base +class Endpoints::PooledPlateCreations < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/projects.rb b/app/api/endpoints/projects.rb index 215872181b..96d56f5c71 100644 --- a/app/api/endpoints/projects.rb +++ b/app/api/endpoints/projects.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Endpoints::Projects < Core::Endpoint::Base # rubocop:todo Style/Documentation +class Endpoints::Projects < Core::Endpoint::Base model {} instance { has_many(:submissions, json: 'submissions', to: 'submissions') } diff --git a/app/api/endpoints/qc_decisions.rb b/app/api/endpoints/qc_decisions.rb index 1ca14b40c3..1a774e0481 100644 --- a/app/api/endpoints/qc_decisions.rb +++ b/app/api/endpoints/qc_decisions.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for QcDecisions -class Endpoints::QcDecisions < ::Core::Endpoint::Base +class Endpoints::QcDecisions < Core::Endpoint::Base model do action(:create) do |request, _| request.target.create!( diff --git a/app/api/endpoints/qc_files.rb b/app/api/endpoints/qc_files.rb index ba5d15fdc4..7cae7b2e44 100644 --- a/app/api/endpoints/qc_files.rb +++ b/app/api/endpoints/qc_files.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for QcFiles -class Endpoints::QcFiles < ::Core::Endpoint::Base +class Endpoints::QcFiles < Core::Endpoint::Base model do # action(:create, :to => :standard_create!) end diff --git a/app/api/endpoints/qcable_creators.rb b/app/api/endpoints/qcable_creators.rb index 2223ea35c9..47a328cc88 100644 --- a/app/api/endpoints/qcable_creators.rb +++ b/app/api/endpoints/qcable_creators.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for QcableCreators -class Endpoints::QcableCreators < ::Core::Endpoint::Base +class Endpoints::QcableCreators < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/qcables.rb b/app/api/endpoints/qcables.rb index 3031409c06..b34488fdb2 100644 --- a/app/api/endpoints/qcables.rb +++ b/app/api/endpoints/qcables.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Qcables -class Endpoints::Qcables < ::Core::Endpoint::Base +class Endpoints::Qcables < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/reference_genomes.rb b/app/api/endpoints/reference_genomes.rb index 4d849c2b85..3a74e86580 100644 --- a/app/api/endpoints/reference_genomes.rb +++ b/app/api/endpoints/reference_genomes.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for ReferenceGenomes -class Endpoints::ReferenceGenomes < ::Core::Endpoint::Base +class Endpoints::ReferenceGenomes < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance { action(:update, to: :standard_update!) } diff --git a/app/api/endpoints/request_types.rb b/app/api/endpoints/request_types.rb index 52c8f76249..794cd79dee 100644 --- a/app/api/endpoints/request_types.rb +++ b/app/api/endpoints/request_types.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for RequestTypes -class Endpoints::RequestTypes < ::Core::Endpoint::Base +class Endpoints::RequestTypes < Core::Endpoint::Base model {} instance {} diff --git a/app/api/endpoints/requests.rb b/app/api/endpoints/requests.rb index 798642f2d8..957861cb53 100644 --- a/app/api/endpoints/requests.rb +++ b/app/api/endpoints/requests.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Requests -class Endpoints::Requests < ::Core::Endpoint::Base +class Endpoints::Requests < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/robots.rb b/app/api/endpoints/robots.rb index cf548ec482..6811709e8a 100644 --- a/app/api/endpoints/robots.rb +++ b/app/api/endpoints/robots.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Robots -class Endpoints::Robots < ::Core::Endpoint::Base +class Endpoints::Robots < Core::Endpoint::Base model {} instance {} diff --git a/app/api/endpoints/sample_manifests.rb b/app/api/endpoints/sample_manifests.rb index c4611a7b4f..a36e858460 100644 --- a/app/api/endpoints/sample_manifests.rb +++ b/app/api/endpoints/sample_manifests.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for SampleManifests -class Endpoints::SampleManifests < ::Core::Endpoint::Base +class Endpoints::SampleManifests < Core::Endpoint::Base model do # TODO: For the moment we have to disable the read functionality as it consumes too much memory. # Loading a sample manifest of only a few thousand samples causes the memory to spike at 1.2GB diff --git a/app/api/endpoints/sample_tubes.rb b/app/api/endpoints/sample_tubes.rb index 43ee256258..6aa436852d 100644 --- a/app/api/endpoints/sample_tubes.rb +++ b/app/api/endpoints/sample_tubes.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for SampleTubes -class Endpoints::SampleTubes < ::Endpoints::Tubes +class Endpoints::SampleTubes < Endpoints::Tubes instance do belongs_to(:custom_metadatum_collection, json: 'custom_metadatum_collection', to: 'custom_metadatum_collection') has_many(:requests_as_source, json: 'requests', to: 'requests') diff --git a/app/api/endpoints/samples.rb b/app/api/endpoints/samples.rb index cc14f2ff8b..5818b13f50 100644 --- a/app/api/endpoints/samples.rb +++ b/app/api/endpoints/samples.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Samples -class Endpoints::Samples < ::Core::Endpoint::Base +class Endpoints::Samples < Core::Endpoint::Base model {} instance {} diff --git a/app/api/endpoints/searches.rb b/app/api/endpoints/searches.rb index 27ea8554d4..59509b24c2 100644 --- a/app/api/endpoints/searches.rb +++ b/app/api/endpoints/searches.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Searches -class Endpoints::Searches < ::Core::Endpoint::Base - module SearchActions # rubocop:todo Style/Documentation +class Endpoints::Searches < Core::Endpoint::Base + module SearchActions def search_action(name) # rubocop:todo Metrics/AbcSize bind_action(:create, to: name.to_s, as: name.to_sym) do |action, request, response| request.json['search']['page'] ||= request.path.fetch(1).to_i if request.path.fetch(1, false) diff --git a/app/api/endpoints/sequencing_requests.rb b/app/api/endpoints/sequencing_requests.rb index 825c09062d..20501fb2f5 100644 --- a/app/api/endpoints/sequencing_requests.rb +++ b/app/api/endpoints/sequencing_requests.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for SequencingRequests -class Endpoints::SequencingRequests < ::Endpoints::Requests +class Endpoints::SequencingRequests < Endpoints::Requests end diff --git a/app/api/endpoints/specific_tube_creations.rb b/app/api/endpoints/specific_tube_creations.rb index 1cbffdcf85..4d49cff85e 100644 --- a/app/api/endpoints/specific_tube_creations.rb +++ b/app/api/endpoints/specific_tube_creations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for SpecificTubeCreations -class Endpoints::SpecificTubeCreations < ::Core::Endpoint::Base +class Endpoints::SpecificTubeCreations < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/stamps.rb b/app/api/endpoints/stamps.rb index f19656e333..627c49f974 100644 --- a/app/api/endpoints/stamps.rb +++ b/app/api/endpoints/stamps.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Stamps -class Endpoints::Stamps < ::Core::Endpoint::Base +class Endpoints::Stamps < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/state_changes.rb b/app/api/endpoints/state_changes.rb index 6e32ff8f02..33087fd6f7 100644 --- a/app/api/endpoints/state_changes.rb +++ b/app/api/endpoints/state_changes.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for StateChanges -class Endpoints::StateChanges < ::Core::Endpoint::Base +class Endpoints::StateChanges < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/studies.rb b/app/api/endpoints/studies.rb index 4f523bb653..afafab64f7 100644 --- a/app/api/endpoints/studies.rb +++ b/app/api/endpoints/studies.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Endpoints::Studies < Core::Endpoint::Base # rubocop:todo Style/Documentation +class Endpoints::Studies < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/submission_pools.rb b/app/api/endpoints/submission_pools.rb index c34951b8e3..8b1d18ccb6 100644 --- a/app/api/endpoints/submission_pools.rb +++ b/app/api/endpoints/submission_pools.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Endpoints::SubmissionPools < Core::Endpoint::Base # rubocop:todo Style/Documentation +class Endpoints::SubmissionPools < Core::Endpoint::Base model {} instance {} diff --git a/app/api/endpoints/submissions.rb b/app/api/endpoints/submissions.rb index 49fdfae78f..6f8364f947 100644 --- a/app/api/endpoints/submissions.rb +++ b/app/api/endpoints/submissions.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Endpoints::Submissions < Core::Endpoint::Base # rubocop:todo Style/Documentation +class Endpoints::Submissions < Core::Endpoint::Base model do action(:create) do |request, _| attributes = ::Io::Submission.map_parameters_to_attributes(request.json) diff --git a/app/api/endpoints/suppliers.rb b/app/api/endpoints/suppliers.rb index b9530cdc70..8b78bd6492 100644 --- a/app/api/endpoints/suppliers.rb +++ b/app/api/endpoints/suppliers.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Suppliers -class Endpoints::Suppliers < ::Core::Endpoint::Base +class Endpoints::Suppliers < Core::Endpoint::Base model {} instance { has_many(:sample_manifests, include: [], json: 'sample_manifests', to: 'sample_manifests') } diff --git a/app/api/endpoints/tag2_layout_templates.rb b/app/api/endpoints/tag2_layout_templates.rb index b11c15fe1a..d9c8928df2 100644 --- a/app/api/endpoints/tag2_layout_templates.rb +++ b/app/api/endpoints/tag2_layout_templates.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Tag2LayoutTemplates -class Endpoints::Tag2LayoutTemplates < ::Core::Endpoint::Base +class Endpoints::Tag2LayoutTemplates < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/tag2_layouts.rb b/app/api/endpoints/tag2_layouts.rb index cb63bda899..d3935c4478 100644 --- a/app/api/endpoints/tag2_layouts.rb +++ b/app/api/endpoints/tag2_layouts.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Tag2Layouts -class Endpoints::Tag2Layouts < ::Core::Endpoint::Base +class Endpoints::Tag2Layouts < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/tag_groups.rb b/app/api/endpoints/tag_groups.rb index 1374ef2559..aaa69fd49d 100644 --- a/app/api/endpoints/tag_groups.rb +++ b/app/api/endpoints/tag_groups.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for TagGroups -class Endpoints::TagGroups < ::Core::Endpoint::Base +class Endpoints::TagGroups < Core::Endpoint::Base model {} instance {} diff --git a/app/api/endpoints/tag_layout_templates.rb b/app/api/endpoints/tag_layout_templates.rb index 8b8e3287b0..f78f6f6783 100644 --- a/app/api/endpoints/tag_layout_templates.rb +++ b/app/api/endpoints/tag_layout_templates.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for TagLayoutTemplates -class Endpoints::TagLayoutTemplates < ::Core::Endpoint::Base +class Endpoints::TagLayoutTemplates < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/tag_layouts.rb b/app/api/endpoints/tag_layouts.rb index 495b581ee7..28eb9ab787 100644 --- a/app/api/endpoints/tag_layouts.rb +++ b/app/api/endpoints/tag_layouts.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for TagLayouts -class Endpoints::TagLayouts < ::Core::Endpoint::Base +class Endpoints::TagLayouts < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance { belongs_to(:plate, json: 'plate') } diff --git a/app/api/endpoints/transfer_requests.rb b/app/api/endpoints/transfer_requests.rb index f801408d2a..e321a0b8c4 100644 --- a/app/api/endpoints/transfer_requests.rb +++ b/app/api/endpoints/transfer_requests.rb @@ -3,7 +3,7 @@ # TransferRequests are exposed via the API and allow # you to access their source and target assets, and their submissions # Controls API V1 {::Core::Endpoint::Base endpoints} for TransferRequests -class Endpoints::TransferRequests < ::Core::Endpoint::Base +class Endpoints::TransferRequests < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/transfer_templates.rb b/app/api/endpoints/transfer_templates.rb index a8b0edab8f..b4c4deff63 100644 --- a/app/api/endpoints/transfer_templates.rb +++ b/app/api/endpoints/transfer_templates.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for TransferTemplates -class Endpoints::TransferTemplates < ::Core::Endpoint::Base +class Endpoints::TransferTemplates < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/transfers.rb b/app/api/endpoints/transfers.rb index 69ea068a56..7d5a1ba4de 100644 --- a/app/api/endpoints/transfers.rb +++ b/app/api/endpoints/transfers.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Transfers -class Endpoints::Transfers < ::Core::Endpoint::Base +class Endpoints::Transfers < Core::Endpoint::Base model {} instance {} diff --git a/app/api/endpoints/tube/purposes.rb b/app/api/endpoints/tube/purposes.rb index faba400465..3e0f064791 100644 --- a/app/api/endpoints/tube/purposes.rb +++ b/app/api/endpoints/tube/purposes.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Tube -class Endpoints::Tube::Purposes < ::Core::Endpoint::Base +class Endpoints::Tube::Purposes < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/tube_creations.rb b/app/api/endpoints/tube_creations.rb index be8b0a2a80..bc0d0cfc63 100644 --- a/app/api/endpoints/tube_creations.rb +++ b/app/api/endpoints/tube_creations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for TubeCreations -class Endpoints::TubeCreations < ::Core::Endpoint::Base +class Endpoints::TubeCreations < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/tube_from_tube_creations.rb b/app/api/endpoints/tube_from_tube_creations.rb index 20760311ad..f9502dd888 100644 --- a/app/api/endpoints/tube_from_tube_creations.rb +++ b/app/api/endpoints/tube_from_tube_creations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for TubeFromTubeCreations -class Endpoints::TubeFromTubeCreations < ::Core::Endpoint::Base +class Endpoints::TubeFromTubeCreations < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/endpoints/tubes.rb b/app/api/endpoints/tubes.rb index 9342f1f2ac..8835872fb2 100644 --- a/app/api/endpoints/tubes.rb +++ b/app/api/endpoints/tubes.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Tubes -class Endpoints::Tubes < ::Core::Endpoint::Base +class Endpoints::Tubes < Core::Endpoint::Base model {} instance do diff --git a/app/api/endpoints/users.rb b/app/api/endpoints/users.rb index 930e31c7cc..d7b00e3741 100644 --- a/app/api/endpoints/users.rb +++ b/app/api/endpoints/users.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Users -class Endpoints::Users < ::Core::Endpoint::Base +class Endpoints::Users < Core::Endpoint::Base model {} instance { action(:update, to: :standard_update!) } diff --git a/app/api/endpoints/uuids.rb b/app/api/endpoints/uuids.rb index 9d9003beb2..c9bb5ce09d 100644 --- a/app/api/endpoints/uuids.rb +++ b/app/api/endpoints/uuids.rb @@ -4,8 +4,8 @@ # so it is going to go. Rather than pollute the main API code with this rubbish it's here. #++ # Controls API V1 {::Core::Endpoint::Base endpoints} for Uuids -class Endpoints::Uuids < ::Core::Endpoint::Base - module Response # rubocop:todo Style/Documentation +class Endpoints::Uuids < Core::Endpoint::Base + module Response def redirect_to(path) @owner.request.service.status(301) @owner.request.service.headers('Location' => path) @@ -25,8 +25,8 @@ def @owner.each private :render_body_json_directly end - class Search # rubocop:todo Style/Documentation - class CriteriaInvalid < ::Core::Service::Error # rubocop:todo Style/Documentation + class Search + class CriteriaInvalid < ::Core::Service::Error def initialize(*args) super @errors = { lookup: [message] } diff --git a/app/api/endpoints/volume_updates.rb b/app/api/endpoints/volume_updates.rb index 5ca1576e7c..e9a34f2512 100644 --- a/app/api/endpoints/volume_updates.rb +++ b/app/api/endpoints/volume_updates.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for VolumeUpdates -class Endpoints::VolumeUpdates < ::Core::Endpoint::Base +class Endpoints::VolumeUpdates < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance { belongs_to(:target, json: 'target') } diff --git a/app/api/endpoints/wells.rb b/app/api/endpoints/wells.rb index 2867bad3d3..ba372c7e91 100644 --- a/app/api/endpoints/wells.rb +++ b/app/api/endpoints/wells.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for Wells -class Endpoints::Wells < ::Core::Endpoint::Base +class Endpoints::Wells < Core::Endpoint::Base model {} instance { belongs_to :plate, json: 'plate' } diff --git a/app/api/endpoints/work_completions.rb b/app/api/endpoints/work_completions.rb index faf882144c..936f2056a4 100644 --- a/app/api/endpoints/work_completions.rb +++ b/app/api/endpoints/work_completions.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 {::Core::Endpoint::Base endpoints} for WorkCompletions -class Endpoints::WorkCompletions < ::Core::Endpoint::Base +class Endpoints::WorkCompletions < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do diff --git a/app/api/io/active_record/relation.rb b/app/api/io/active_record/relation.rb index 267c6011ff..bbc2ec99b2 100644 --- a/app/api/io/active_record/relation.rb +++ b/app/api/io/active_record/relation.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Io::ActiveRecord::Relation # rubocop:todo Style/Documentation +class Io::ActiveRecord::Relation extend ::Core::Io::Collection class << self diff --git a/app/api/io/asset_group.rb b/app/api/io/asset_group.rb index 00135baefa..9e9b0a459c 100644 --- a/app/api/io/asset_group.rb +++ b/app/api/io/asset_group.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::AssetGroup} -class Io::AssetGroup < ::Core::Io::Base +class Io::AssetGroup < Core::Io::Base set_model_for_input(::AssetGroup) set_json_root(:asset_group) set_eager_loading { |model| model.include_study.include_assets } diff --git a/app/api/io/bait_library_layout.rb b/app/api/io/bait_library_layout.rb index db9cb51597..9bd886f4e6 100644 --- a/app/api/io/bait_library_layout.rb +++ b/app/api/io/bait_library_layout.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::BaitLibraryLayout} -class Io::BaitLibraryLayout < ::Core::Io::Base +class Io::BaitLibraryLayout < Core::Io::Base set_model_for_input(::BaitLibraryLayout) set_json_root(:bait_library_layout) set_eager_loading(&:include_plate) diff --git a/app/api/io/barcode_printer.rb b/app/api/io/barcode_printer.rb index 4a8d41531f..2fa626fb27 100644 --- a/app/api/io/barcode_printer.rb +++ b/app/api/io/barcode_printer.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::BarcodePrinter} -class Io::BarcodePrinter < ::Core::Io::Base +class Io::BarcodePrinter < Core::Io::Base set_model_for_input(::BarcodePrinter) set_json_root(:barcode_printer) set_eager_loading(&:include_barcode_printer_type) diff --git a/app/api/io/batch.rb b/app/api/io/batch.rb index 895a5e51d7..d09f664e02 100644 --- a/app/api/io/batch.rb +++ b/app/api/io/batch.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::Batch} -class Io::Batch < ::Core::Io::Base +class Io::Batch < Core::Io::Base set_model_for_input(::Batch) set_json_root(:batch) set_eager_loading { |model| model.include_user.include_requests.include_pipeline } diff --git a/app/api/io/bulk_transfer.rb b/app/api/io/bulk_transfer.rb index 1ddeb3ace6..a09c284266 100644 --- a/app/api/io/bulk_transfer.rb +++ b/app/api/io/bulk_transfer.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::BulkTransfer} -class Io::BulkTransfer < ::Core::Io::Base +class Io::BulkTransfer < Core::Io::Base set_model_for_input(::BulkTransfer) set_json_root(:bulk_transfer) diff --git a/app/api/io/comment.rb b/app/api/io/comment.rb index 99a9ced7a4..9f4842cd57 100644 --- a/app/api/io/comment.rb +++ b/app/api/io/comment.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::Comment} -class Io::Comment < ::Core::Io::Base +class Io::Comment < Core::Io::Base set_model_for_input(::Comment) set_json_root(:comment) set_eager_loading { |model| model } diff --git a/app/api/io/custom_metadatum_collection.rb b/app/api/io/custom_metadatum_collection.rb index c8d81c22e5..0f20e80cc5 100644 --- a/app/api/io/custom_metadatum_collection.rb +++ b/app/api/io/custom_metadatum_collection.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::CustomMetadatumCollection} -class Io::CustomMetadatumCollection < ::Core::Io::Base +class Io::CustomMetadatumCollection < Core::Io::Base set_model_for_input(::CustomMetadatumCollection) set_json_root(:custom_metadatum_collection) diff --git a/app/api/io/endpoints/uuids/search.rb b/app/api/io/endpoints/uuids/search.rb index dd90e310cb..cae5e06b73 100644 --- a/app/api/io/endpoints/uuids/search.rb +++ b/app/api/io/endpoints/uuids/search.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Io::Endpoints::Uuids::Search # rubocop:todo Style/Documentation +class Io::Endpoints::Uuids::Search def self.model_for_input ::Uuids::Search end diff --git a/app/api/io/extraction_attribute.rb b/app/api/io/extraction_attribute.rb index a3e429f6ce..2de69a0c76 100644 --- a/app/api/io/extraction_attribute.rb +++ b/app/api/io/extraction_attribute.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::ExtractionAttribute} -class Io::ExtractionAttribute < ::Core::Io::Base +class Io::ExtractionAttribute < Core::Io::Base set_model_for_input(::ExtractionAttribute) set_json_root(:extraction_attribute) diff --git a/app/api/io/library_creation_request.rb b/app/api/io/library_creation_request.rb index 9b43fd24ef..ddc55f937d 100644 --- a/app/api/io/library_creation_request.rb +++ b/app/api/io/library_creation_request.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::LibraryCreationRequest} -class Io::LibraryCreationRequest < ::Io::Request +class Io::LibraryCreationRequest < Io::Request set_model_for_input(::LibraryCreationRequest) set_json_root(:library_creation_request) diff --git a/app/api/io/library_event.rb b/app/api/io/library_event.rb index 9260cca7c8..d09f3fa591 100644 --- a/app/api/io/library_event.rb +++ b/app/api/io/library_event.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::LibraryEvent} -class Io::LibraryEvent < ::Core::Io::Base +class Io::LibraryEvent < Core::Io::Base set_model_for_input(::LibraryEvent) set_json_root(:library_event) diff --git a/app/api/io/lot.rb b/app/api/io/lot.rb index 377dad13af..da48d56d42 100644 --- a/app/api/io/lot.rb +++ b/app/api/io/lot.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::Lot} -class Io::Lot < ::Core::Io::Base +class Io::Lot < Core::Io::Base set_model_for_input(::Lot) set_json_root(:lot) diff --git a/app/api/io/lot_type.rb b/app/api/io/lot_type.rb index e9c150b6e3..13b6500c1e 100644 --- a/app/api/io/lot_type.rb +++ b/app/api/io/lot_type.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::LotType} -class Io::LotType < ::Core::Io::Base +class Io::LotType < Core::Io::Base set_model_for_input(::LotType) set_json_root(:lot_type) diff --git a/app/api/io/multiplexed_library_creation_request.rb b/app/api/io/multiplexed_library_creation_request.rb index 08af61bfd9..81443c8376 100644 --- a/app/api/io/multiplexed_library_creation_request.rb +++ b/app/api/io/multiplexed_library_creation_request.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for MultiplexedLibraryCreationRequest -class Io::MultiplexedLibraryCreationRequest < ::Io::LibraryCreationRequest +class Io::MultiplexedLibraryCreationRequest < Io::LibraryCreationRequest set_model_for_input(::MultiplexedLibraryCreationRequest) set_json_root(:multiplexed_library_creation_request) define_attribute_and_json_mapping('') diff --git a/app/api/io/multiplexed_library_tube.rb b/app/api/io/multiplexed_library_tube.rb index 20e8012ae1..7a99f333a6 100644 --- a/app/api/io/multiplexed_library_tube.rb +++ b/app/api/io/multiplexed_library_tube.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Io::MultiplexedLibraryTube < ::Io::LibraryTube +class Io::MultiplexedLibraryTube < Io::LibraryTube set_model_for_input(::MultiplexedLibraryTube) set_json_root(:multiplexed_library_tube) diff --git a/app/api/io/order.rb b/app/api/io/order.rb index 9774fe71b0..cdc4acf452 100644 --- a/app/api/io/order.rb +++ b/app/api/io/order.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::Order} -class Io::Order < ::Core::Io::Base +class Io::Order < Core::Io::Base REQUEST_OPTIONS_FIELDS = { read_length: 'read_length', diff --git a/app/api/io/pac_bio_library_tube.rb b/app/api/io/pac_bio_library_tube.rb index cd6f4e2b93..bc9a32843d 100644 --- a/app/api/io/pac_bio_library_tube.rb +++ b/app/api/io/pac_bio_library_tube.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Io::PacBioLibraryTube < ::Io::Asset +class Io::PacBioLibraryTube < Io::Asset set_model_for_input(::PacBioLibraryTube) set_json_root(:pac_bio_library_tube) diff --git a/app/api/io/pipeline.rb b/app/api/io/pipeline.rb index 5a8d7ded3b..b80b213bd9 100644 --- a/app/api/io/pipeline.rb +++ b/app/api/io/pipeline.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::Pipeline} -class Io::Pipeline < ::Core::Io::Base +class Io::Pipeline < Core::Io::Base set_model_for_input(::Pipeline) set_json_root(:pipeline) diff --git a/app/api/io/plate_conversion.rb b/app/api/io/plate_conversion.rb index 6c7f7ff3c9..eda3c527dc 100644 --- a/app/api/io/plate_conversion.rb +++ b/app/api/io/plate_conversion.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::PlateConversion} -class Io::PlateConversion < ::Core::Io::Base +class Io::PlateConversion < Core::Io::Base set_model_for_input(::PlateConversion) set_json_root(:plate_conversion) set_eager_loading { |model| model } diff --git a/app/api/io/plate_creation.rb b/app/api/io/plate_creation.rb index b6273cef1e..3321a9c488 100644 --- a/app/api/io/plate_creation.rb +++ b/app/api/io/plate_creation.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::PlateCreation} -class Io::PlateCreation < ::Core::Io::Base +class Io::PlateCreation < Core::Io::Base set_model_for_input(::PlateCreation) set_json_root(:plate_creation) set_eager_loading { |model| model.include_parent.include_child } diff --git a/app/api/io/pooled_plate_creation.rb b/app/api/io/pooled_plate_creation.rb index 6af0eb0bff..14f6b4d25d 100644 --- a/app/api/io/pooled_plate_creation.rb +++ b/app/api/io/pooled_plate_creation.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::PooledPlateCreation} -class Io::PooledPlateCreation < ::Core::Io::Base +class Io::PooledPlateCreation < Core::Io::Base set_model_for_input(::PooledPlateCreation) set_json_root(:pooled_plate_creation) diff --git a/app/api/io/qc_file.rb b/app/api/io/qc_file.rb index 78732f6182..b9d31327e0 100644 --- a/app/api/io/qc_file.rb +++ b/app/api/io/qc_file.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::QcFile} -class Io::QcFile < ::Core::Io::Base +class Io::QcFile < Core::Io::Base set_model_for_input(::QcFile) set_json_root(:qc_file) diff --git a/app/api/io/reference_genome.rb b/app/api/io/reference_genome.rb index d5f759afcc..eb6d807d58 100644 --- a/app/api/io/reference_genome.rb +++ b/app/api/io/reference_genome.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::ReferenceGenome} -class Io::ReferenceGenome < ::Core::Io::Base +class Io::ReferenceGenome < Core::Io::Base set_model_for_input(::ReferenceGenome) set_json_root(:reference_genome) diff --git a/app/api/io/request.rb b/app/api/io/request.rb index e8e93a26ef..6e49804f01 100644 --- a/app/api/io/request.rb +++ b/app/api/io/request.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for Request -class Io::Request < ::Core::Io::Base +class Io::Request < Core::Io::Base set_model_for_input(::Request) set_json_root(:request) set_eager_loading do |model| diff --git a/app/api/io/request_type.rb b/app/api/io/request_type.rb index 1607c95a18..0e085a206f 100644 --- a/app/api/io/request_type.rb +++ b/app/api/io/request_type.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::RequestType} -class Io::RequestType < ::Core::Io::Base +class Io::RequestType < Core::Io::Base set_model_for_input(::RequestType) set_json_root(:request_type) diff --git a/app/api/io/robot.rb b/app/api/io/robot.rb index 5908289130..9bebf8de69 100644 --- a/app/api/io/robot.rb +++ b/app/api/io/robot.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for Robot -class Io::Robot < ::Core::Io::Base +class Io::Robot < Core::Io::Base set_model_for_input(::Robot) set_json_root(:robot) diff --git a/app/api/io/sample_manifest.rb b/app/api/io/sample_manifest.rb index 917cc49253..0e67c382c8 100644 --- a/app/api/io/sample_manifest.rb +++ b/app/api/io/sample_manifest.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::SampleManifest} -class Io::SampleManifest < ::Core::Io::Base +class Io::SampleManifest < Core::Io::Base set_model_for_input(::SampleManifest) set_json_root(:sample_manifest) set_eager_loading(&:include_samples) diff --git a/app/api/io/search.rb b/app/api/io/search.rb index f4c254f278..45616eb5af 100644 --- a/app/api/io/search.rb +++ b/app/api/io/search.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::Search} -class Io::Search < ::Core::Io::Base +class Io::Search < Core::Io::Base set_json_root(:search) define_attribute_and_json_mapping( diff --git a/app/api/io/sequencing_request.rb b/app/api/io/sequencing_request.rb index 0b371c73c3..9e593476df 100644 --- a/app/api/io/sequencing_request.rb +++ b/app/api/io/sequencing_request.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for SequencingRequest -class Io::SequencingRequest < ::Io::Request +class Io::SequencingRequest < Io::Request set_model_for_input(::SequencingRequest) set_json_root(:sequencing_request) diff --git a/app/api/io/specific_tube_creation.rb b/app/api/io/specific_tube_creation.rb index 921a6bdd14..823d752165 100644 --- a/app/api/io/specific_tube_creation.rb +++ b/app/api/io/specific_tube_creation.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::SpecificTubeCreation} -class Io::SpecificTubeCreation < ::Core::Io::Base +class Io::SpecificTubeCreation < Core::Io::Base set_model_for_input(::SpecificTubeCreation) set_json_root(:specific_tube_creation) set_eager_loading(&:include_parent) diff --git a/app/api/io/state_change.rb b/app/api/io/state_change.rb index 0ec919b601..6a87601338 100644 --- a/app/api/io/state_change.rb +++ b/app/api/io/state_change.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::StateChange} -class Io::StateChange < ::Core::Io::Base +class Io::StateChange < Core::Io::Base set_model_for_input(::StateChange) set_json_root(:state_change) diff --git a/app/api/io/submission.rb b/app/api/io/submission.rb index 192f54a070..ed53cdd675 100644 --- a/app/api/io/submission.rb +++ b/app/api/io/submission.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::Submission} -class Io::Submission < ::Core::Io::Base +class Io::Submission < Core::Io::Base set_model_for_input(::Submission) set_json_root(:submission) set_eager_loading(&:include_orders) diff --git a/app/api/io/submission_pool.rb b/app/api/io/submission_pool.rb index c17b15af4e..eb590b6420 100644 --- a/app/api/io/submission_pool.rb +++ b/app/api/io/submission_pool.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::SubmissionPool} -class Io::SubmissionPool < ::Core::Io::Base +class Io::SubmissionPool < Core::Io::Base set_model_for_input(::SubmissionPool) set_json_root(:submission_pool) set_eager_loading { |model| model } diff --git a/app/api/io/submission_template.rb b/app/api/io/submission_template.rb index 4283efd572..83b484cc79 100644 --- a/app/api/io/submission_template.rb +++ b/app/api/io/submission_template.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::SubmissionTemplate} -class Io::SubmissionTemplate < ::Core::Io::Base +class Io::SubmissionTemplate < Core::Io::Base set_model_for_input(::SubmissionTemplate) set_json_root(:order_template) diff --git a/app/api/io/supplier.rb b/app/api/io/supplier.rb index 90a4fcd999..d5bb597705 100644 --- a/app/api/io/supplier.rb +++ b/app/api/io/supplier.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::Supplier} -class Io::Supplier < ::Core::Io::Base +class Io::Supplier < Core::Io::Base # This module adds the behaviour we require from the Supplier module. module ApiIoSupport def self.included(base) diff --git a/app/api/io/tag2_layout.rb b/app/api/io/tag2_layout.rb index 94aef8b720..7844719793 100644 --- a/app/api/io/tag2_layout.rb +++ b/app/api/io/tag2_layout.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::Tag2Layout} -class Io::Tag2Layout < ::Core::Io::Base +class Io::Tag2Layout < Core::Io::Base set_model_for_input(::Tag2Layout) set_json_root(:tag2_layout) set_eager_loading { |model| model.include_plate.include_tag } diff --git a/app/api/io/tag2_layout_template.rb b/app/api/io/tag2_layout_template.rb index ffced77f59..2a8beb309d 100644 --- a/app/api/io/tag2_layout_template.rb +++ b/app/api/io/tag2_layout_template.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::Tag2LayoutTemplate} -class Io::Tag2LayoutTemplate < ::Core::Io::Base +class Io::Tag2LayoutTemplate < Core::Io::Base set_model_for_input(::Tag2LayoutTemplate) set_json_root(:tag2_layout_template) set_eager_loading(&:include_tag) # TODO: uncomment and add any named_scopes that do includes you need diff --git a/app/api/io/tag_group.rb b/app/api/io/tag_group.rb index 99ba5c08fd..ce0133183f 100644 --- a/app/api/io/tag_group.rb +++ b/app/api/io/tag_group.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::TagGroup} -class Io::TagGroup < ::Core::Io::Base +class Io::TagGroup < Core::Io::Base set_model_for_input(::TagGroup) set_json_root(:tag_group) diff --git a/app/api/io/tag_layout.rb b/app/api/io/tag_layout.rb index c060d61f0a..46f0c80a1d 100644 --- a/app/api/io/tag_layout.rb +++ b/app/api/io/tag_layout.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::TagLayout} -class Io::TagLayout < ::Core::Io::Base +class Io::TagLayout < Core::Io::Base set_model_for_input(::TagLayout) set_json_root(:tag_layout) set_eager_loading { |model| model.include_plate.include_tag_group } diff --git a/app/api/io/tag_layout_template.rb b/app/api/io/tag_layout_template.rb index 412d481ee6..ac6b82bfd8 100644 --- a/app/api/io/tag_layout_template.rb +++ b/app/api/io/tag_layout_template.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::TagLayoutTemplate} -class Io::TagLayoutTemplate < ::Core::Io::Base +class Io::TagLayoutTemplate < Core::Io::Base set_model_for_input(::TagLayoutTemplate) set_json_root(:tag_layout_template) set_eager_loading { |model| model.include_tags.enabled_only } diff --git a/app/api/io/transfer.rb b/app/api/io/transfer.rb index b4cde7e26a..9175bf57f5 100644 --- a/app/api/io/transfer.rb +++ b/app/api/io/transfer.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::Transfer} -class Io::Transfer < ::Core::Io::Base +class Io::Transfer < Core::Io::Base set_model_for_input(::Transfer) set_json_root(:transfer) diff --git a/app/api/io/transfer/between_plates.rb b/app/api/io/transfer/between_plates.rb index 61cab85991..02b0b7df78 100644 --- a/app/api/io/transfer/between_plates.rb +++ b/app/api/io/transfer/between_plates.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Io::Transfer::BetweenPlates < ::Core::Io::Base # rubocop:todo Style/Documentation +class Io::Transfer::BetweenPlates < Core::Io::Base set_model_for_input(::Transfer::BetweenPlates) set_json_root(:transfer) set_eager_loading { |model| model.include_source.include_destination } diff --git a/app/api/io/transfer/between_plates_by_submission.rb b/app/api/io/transfer/between_plates_by_submission.rb index 374d4f558e..853c41e51e 100644 --- a/app/api/io/transfer/between_plates_by_submission.rb +++ b/app/api/io/transfer/between_plates_by_submission.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Io::Transfer::BetweenPlatesBySubmission < ::Core::Io::Base # rubocop:todo Style/Documentation +class Io::Transfer::BetweenPlatesBySubmission < Core::Io::Base set_model_for_input(::Transfer::BetweenPlatesBySubmission) set_json_root(:transfer) set_eager_loading { |model| model.include_source.include_destination } diff --git a/app/api/io/transfer/between_specific_tubes.rb b/app/api/io/transfer/between_specific_tubes.rb index 0c5063af9d..2c18e6d08c 100644 --- a/app/api/io/transfer/between_specific_tubes.rb +++ b/app/api/io/transfer/between_specific_tubes.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Io::Transfer::BetweenSpecificTubes < ::Core::Io::Base +class Io::Transfer::BetweenSpecificTubes < Core::Io::Base set_model_for_input(::Transfer::BetweenSpecificTubes) set_json_root(:transfer) diff --git a/app/api/io/transfer/between_tubes_by_submission.rb b/app/api/io/transfer/between_tubes_by_submission.rb index 914321ee97..5b80fe9755 100644 --- a/app/api/io/transfer/between_tubes_by_submission.rb +++ b/app/api/io/transfer/between_tubes_by_submission.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Io::Transfer::BetweenTubesBySubmission < ::Core::Io::Base +class Io::Transfer::BetweenTubesBySubmission < Core::Io::Base set_model_for_input(::Transfer::BetweenTubesBySubmission) set_json_root(:transfer) diff --git a/app/api/io/transfer/from_plate_to_specific_tubes.rb b/app/api/io/transfer/from_plate_to_specific_tubes.rb index 9d69cd17fc..9b52a0bead 100644 --- a/app/api/io/transfer/from_plate_to_specific_tubes.rb +++ b/app/api/io/transfer/from_plate_to_specific_tubes.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Io::Transfer::FromPlateToSpecificTubes < ::Core::Io::Base # rubocop:todo Style/Documentation +class Io::Transfer::FromPlateToSpecificTubes < Core::Io::Base set_model_for_input(::Transfer::FromPlateToSpecificTubes) set_json_root(:transfer) set_eager_loading { |model| model.include_source.include_transfers } diff --git a/app/api/io/transfer/from_plate_to_specific_tubes_by_pool.rb b/app/api/io/transfer/from_plate_to_specific_tubes_by_pool.rb index 9b555cdc18..232f6d3db7 100644 --- a/app/api/io/transfer/from_plate_to_specific_tubes_by_pool.rb +++ b/app/api/io/transfer/from_plate_to_specific_tubes_by_pool.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Io::Transfer::FromPlateToSpecificTubesByPool < ::Core::Io::Base # rubocop:todo Style/Documentation +class Io::Transfer::FromPlateToSpecificTubesByPool < Core::Io::Base set_model_for_input(::Transfer::FromPlateToSpecificTubesByPool) set_json_root(:transfer) set_eager_loading { |model| model.include_source.include_transfers } diff --git a/app/api/io/transfer/from_plate_to_tube.rb b/app/api/io/transfer/from_plate_to_tube.rb index d17f65fc9b..bf050fd9a2 100644 --- a/app/api/io/transfer/from_plate_to_tube.rb +++ b/app/api/io/transfer/from_plate_to_tube.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Io::Transfer::FromPlateToTube < ::Core::Io::Base +class Io::Transfer::FromPlateToTube < Core::Io::Base set_model_for_input(::Transfer::FromPlateToTube) set_json_root(:transfer) diff --git a/app/api/io/transfer/from_plate_to_tube_by_multiplex.rb b/app/api/io/transfer/from_plate_to_tube_by_multiplex.rb index b1329d6358..96b9745eba 100644 --- a/app/api/io/transfer/from_plate_to_tube_by_multiplex.rb +++ b/app/api/io/transfer/from_plate_to_tube_by_multiplex.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Io::Transfer::FromPlateToTubeByMultiplex < ::Core::Io::Base # rubocop:todo Style/Documentation +class Io::Transfer::FromPlateToTubeByMultiplex < Core::Io::Base set_model_for_input(::Transfer::FromPlateToTubeByMultiplex) set_json_root(:transfer) set_eager_loading { |model| model.include_source.include_transfers } diff --git a/app/api/io/transfer/from_plate_to_tube_by_submission.rb b/app/api/io/transfer/from_plate_to_tube_by_submission.rb index dd104ecafc..5566d17a30 100644 --- a/app/api/io/transfer/from_plate_to_tube_by_submission.rb +++ b/app/api/io/transfer/from_plate_to_tube_by_submission.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Io::Transfer::FromPlateToTubeBySubmission < ::Core::Io::Base # rubocop:todo Style/Documentation +class Io::Transfer::FromPlateToTubeBySubmission < Core::Io::Base set_model_for_input(::Transfer::FromPlateToTubeBySubmission) set_json_root(:transfer) set_eager_loading { |model| model.include_source.include_transfers } diff --git a/app/api/io/transfer_template.rb b/app/api/io/transfer_template.rb index f60f004e53..928eb632b9 100644 --- a/app/api/io/transfer_template.rb +++ b/app/api/io/transfer_template.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::TransferTemplate} -class Io::TransferTemplate < ::Core::Io::Base +class Io::TransferTemplate < Core::Io::Base set_model_for_input(::TransferTemplate) set_json_root(:transfer_template) diff --git a/app/api/io/tube_creation.rb b/app/api/io/tube_creation.rb index 38ca8ae58e..212caa4bdb 100644 --- a/app/api/io/tube_creation.rb +++ b/app/api/io/tube_creation.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::TubeCreation} -class Io::TubeCreation < ::Core::Io::Base +class Io::TubeCreation < Core::Io::Base set_model_for_input(::TubeCreation) set_json_root(:tube_creation) set_eager_loading(&:include_parent) diff --git a/app/api/io/tube_from_tube_creation.rb b/app/api/io/tube_from_tube_creation.rb index 0b717d8bc1..0272c0ba5a 100644 --- a/app/api/io/tube_from_tube_creation.rb +++ b/app/api/io/tube_from_tube_creation.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::TubeFromTubeCreation} -class Io::TubeFromTubeCreation < ::Core::Io::Base +class Io::TubeFromTubeCreation < Core::Io::Base set_model_for_input(::TubeFromTubeCreation) set_json_root(:tube_from_tube_creation) diff --git a/app/api/io/user.rb b/app/api/io/user.rb index 2cd2f479b7..fa226c7214 100644 --- a/app/api/io/user.rb +++ b/app/api/io/user.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::User} -class Io::User < ::Core::Io::Base +class Io::User < Core::Io::Base set_model_for_input(::User) set_json_root(:user) define_attribute_and_json_mapping( diff --git a/app/api/io/volume_update.rb b/app/api/io/volume_update.rb index 03aeb7a541..fd55af6ede 100644 --- a/app/api/io/volume_update.rb +++ b/app/api/io/volume_update.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::VolumeUpdate} -class Io::VolumeUpdate < ::Core::Io::Base +class Io::VolumeUpdate < Core::Io::Base set_model_for_input(::VolumeUpdate) set_json_root(:volume_update) diff --git a/app/api/io/well.rb b/app/api/io/well.rb index 2bf361ecad..ce8604691d 100644 --- a/app/api/io/well.rb +++ b/app/api/io/well.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::Well} -class Io::Well < ::Core::Io::Base +class Io::Well < Core::Io::Base set_model_for_input(::Well) set_json_root(:well) diff --git a/app/api/io/work_completion.rb b/app/api/io/work_completion.rb index d42e8922da..d210db4abf 100644 --- a/app/api/io/work_completion.rb +++ b/app/api/io/work_completion.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # Controls API V1 IO for {::WorkCompletion} -class Io::WorkCompletion < ::Core::Io::Base +class Io::WorkCompletion < Core::Io::Base set_model_for_input(::WorkCompletion) set_json_root(:work_completion) diff --git a/app/api/model_extensions/order.rb b/app/api/model_extensions/order.rb index e3121c6e1d..7996093538 100644 --- a/app/api/model_extensions/order.rb +++ b/app/api/model_extensions/order.rb @@ -6,7 +6,7 @@ class RequestOptionForValidation < OpenStruct # rubocop:todo Style/OpenStructUse delegate :errors, :include_unset_values?, to: :owner end - module Validations # rubocop:todo Style/Documentation + module Validations def self.included(base) base.class_eval do extend DelegateValidation @@ -93,7 +93,7 @@ def extended_validators # rubocop:enable Metrics/MethodLength - class NonNilHash # rubocop:todo Style/Documentation + class NonNilHash def initialize(key_style_operation = :symbolize_keys) @key_style_operation = key_style_operation @store = ActiveSupport::HashWithIndifferentAccess.new diff --git a/app/api/model_extensions/plate.rb b/app/api/model_extensions/plate.rb index 4cc7e44613..664858e542 100644 --- a/app/api/model_extensions/plate.rb +++ b/app/api/model_extensions/plate.rb @@ -2,7 +2,7 @@ # Included in {Plate} # The intent of this file was to provide methods specific to the V1 API module ModelExtensions::Plate - module NamedScopeHelpers # rubocop:todo Style/Documentation + module NamedScopeHelpers def include_plate_named_scope(plate_association) scope :"include_#{plate_association}", lambda { includes(plate_association.to_sym => ::ModelExtensions::Plate::PLATE_INCLUDES) } diff --git a/app/controllers/admin/bait_libraries/bait_library_types_controller.rb b/app/controllers/admin/bait_libraries/bait_library_types_controller.rb index deed161626..60be7f1e35 100644 --- a/app/controllers/admin/bait_libraries/bait_library_types_controller.rb +++ b/app/controllers/admin/bait_libraries/bait_library_types_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Admin::BaitLibraries::BaitLibraryTypesController < ApplicationController # rubocop:todo Style/Documentation +class Admin::BaitLibraries::BaitLibraryTypesController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/admin/bait_libraries_controller.rb b/app/controllers/admin/bait_libraries_controller.rb index c4534cab92..abf06efbb5 100644 --- a/app/controllers/admin/bait_libraries_controller.rb +++ b/app/controllers/admin/bait_libraries_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Admin::BaitLibrariesController < ApplicationController # rubocop:todo Style/Documentation +class Admin::BaitLibrariesController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/admin/custom_texts_controller.rb b/app/controllers/admin/custom_texts_controller.rb index aefd5d2c90..5654266fd8 100644 --- a/app/controllers/admin/custom_texts_controller.rb +++ b/app/controllers/admin/custom_texts_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Admin::CustomTextsController < ApplicationController # rubocop:todo Style/Documentation +class Admin::CustomTextsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/admin/faculty_sponsors_controller.rb b/app/controllers/admin/faculty_sponsors_controller.rb index 6c66bb0352..0a54a2b621 100644 --- a/app/controllers/admin/faculty_sponsors_controller.rb +++ b/app/controllers/admin/faculty_sponsors_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Admin::FacultySponsorsController < ApplicationController # rubocop:todo Style/Documentation +class Admin::FacultySponsorsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/admin/plate_purposes_controller.rb b/app/controllers/admin/plate_purposes_controller.rb index 584a02945b..93f4a6a71e 100644 --- a/app/controllers/admin/plate_purposes_controller.rb +++ b/app/controllers/admin/plate_purposes_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Admin::PlatePurposesController < ApplicationController # rubocop:todo Style/Documentation +class Admin::PlatePurposesController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/admin/primer_panels_controller.rb b/app/controllers/admin/primer_panels_controller.rb index 534de4b619..02893f62e4 100644 --- a/app/controllers/admin/primer_panels_controller.rb +++ b/app/controllers/admin/primer_panels_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Admin::PrimerPanelsController < ApplicationController # rubocop:todo Style/Documentation +class Admin::PrimerPanelsController < ApplicationController authorize_resource before_action :discover_primer_panel, only: %i[edit update] diff --git a/app/controllers/admin/programs_controller.rb b/app/controllers/admin/programs_controller.rb index 14e9c574c5..3c658a018c 100644 --- a/app/controllers/admin/programs_controller.rb +++ b/app/controllers/admin/programs_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Admin::ProgramsController < ApplicationController # rubocop:todo Style/Documentation +class Admin::ProgramsController < ApplicationController authorize_resource before_action :discover_program, only: %i[show edit update destroy] diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 1deb00ca30..f339109296 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true require 'event_factory' -class Admin::ProjectsController < ApplicationController # rubocop:todo Style/Documentation +class Admin::ProjectsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/admin/robot_properties_controller.rb b/app/controllers/admin/robot_properties_controller.rb index 04e20dcb19..b8356e31b8 100644 --- a/app/controllers/admin/robot_properties_controller.rb +++ b/app/controllers/admin/robot_properties_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Admin::RobotPropertiesController < ApplicationController # rubocop:todo Style/Documentation +class Admin::RobotPropertiesController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/admin/robots_controller.rb b/app/controllers/admin/robots_controller.rb index c2b467d92b..b1aaac04c2 100644 --- a/app/controllers/admin/robots_controller.rb +++ b/app/controllers/admin/robots_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Admin::RobotsController < ApplicationController # rubocop:todo Style/Documentation +class Admin::RobotsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/admin/roles/users_controller.rb b/app/controllers/admin/roles/users_controller.rb index 2bd86adf4f..bcd1751ba7 100644 --- a/app/controllers/admin/roles/users_controller.rb +++ b/app/controllers/admin/roles/users_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Admin::Roles::UsersController < ApplicationController # rubocop:todo Style/Documentation +class Admin::Roles::UsersController < ApplicationController def index @role_name = params[:role_id] @users = User.joins(:roles).where(roles: { name: params[:role_id] }).order(:login).distinct diff --git a/app/controllers/admin/roles_controller.rb b/app/controllers/admin/roles_controller.rb index 7256f10871..1d988efd3d 100644 --- a/app/controllers/admin/roles_controller.rb +++ b/app/controllers/admin/roles_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Admin::RolesController < ApplicationController # rubocop:todo Style/Documentation +class Admin::RolesController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/admin/studies_controller.rb b/app/controllers/admin/studies_controller.rb index 0c400ca4e4..c7ed458f2e 100644 --- a/app/controllers/admin/studies_controller.rb +++ b/app/controllers/admin/studies_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Admin::StudiesController < ApplicationController # rubocop:todo Style/Documentation +class Admin::StudiesController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! @@ -42,7 +42,7 @@ def filter # rubocop:todo Metrics/CyclomaticComplexity unless params[:filter].nil? if params[:filter][:by] == 'unallocated manager' - @studies = Study.all.select { |p| p.name.include?(params[:q]) && !(p.roles.map(&:name).include?('manager')) } + @studies = Study.select { |p| p.name.include?(params[:q]) && !(p.roles.map(&:name).include?('manager')) } end end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 0852ed731e..53f3c1f4c6 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Admin::UsersController < ApplicationController # rubocop:todo Style/Documentation +class Admin::UsersController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index d71f6a295a..3e4195002e 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class AdminController < ApplicationController # rubocop:todo Style/Documentation +class AdminController < ApplicationController authorize_resource :sequencescape, parent: true, parent_action: :administer def index; end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b30d5e5cee..811f6e84ef 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -5,7 +5,7 @@ # Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. -class ApplicationController < ActionController::Base # rubocop:todo Style/Documentation +class ApplicationController < ActionController::Base # {FlashTruncation} provides the #truncate_flash method for automatically trimming # large flash messages to prevent cookie overflow. include FlashTruncation diff --git a/app/controllers/asset_audits_controller.rb b/app/controllers/asset_audits_controller.rb index 19fd431ee3..f50feded55 100644 --- a/app/controllers/asset_audits_controller.rb +++ b/app/controllers/asset_audits_controller.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true -class AssetAuditsController < ApplicationController # rubocop:todo Style/Documentation +class AssetAuditsController < ApplicationController def index; end end diff --git a/app/controllers/assets/plate_layout.rb b/app/controllers/assets/plate_layout.rb index 1ac85dff08..c338befaa5 100644 --- a/app/controllers/assets/plate_layout.rb +++ b/app/controllers/assets/plate_layout.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true -class AssetsController < ApplicationController # rubocop:todo Style/Documentation +class AssetsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! - class PlateLayout # rubocop:todo Style/Documentation + class PlateLayout DEFAULT_WELL = { request: nil, asset: nil, error: nil }.freeze attr_reader :width, :height, :wells @@ -38,7 +38,7 @@ def well_at(row, column) end def empty_well_at?(row, column) - DEFAULT_WELL == well_at(row, column) + well_at(row, column) == DEFAULT_WELL end def good_well_at?(row, column) diff --git a/app/controllers/barcode_printers_controller.rb b/app/controllers/barcode_printers_controller.rb index 588163964d..8e3e0fb3cd 100644 --- a/app/controllers/barcode_printers_controller.rb +++ b/app/controllers/barcode_printers_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class BarcodePrintersController < ApplicationController # rubocop:todo Style/Documentation +class BarcodePrintersController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/batches/comments_controller.rb b/app/controllers/batches/comments_controller.rb index d7672bc6c1..29d544989c 100644 --- a/app/controllers/batches/comments_controller.rb +++ b/app/controllers/batches/comments_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Batches::CommentsController < ApplicationController # rubocop:todo Style/Documentation +class Batches::CommentsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/batches/requests_controller.rb b/app/controllers/batches/requests_controller.rb index 73bc2cc075..deb3dc30dd 100644 --- a/app/controllers/batches/requests_controller.rb +++ b/app/controllers/batches/requests_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Batches::RequestsController < ApplicationController # rubocop:todo Style/Documentation +class Batches::RequestsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/batches_controller.rb b/app/controllers/batches_controller.rb index 8b6570aa94..ceb9dfde75 100644 --- a/app/controllers/batches_controller.rb +++ b/app/controllers/batches_controller.rb @@ -40,7 +40,7 @@ def index # rubocop:todo Metrics/AbcSize, Metrics/MethodLength respond_to do |format| format.html format.xml { render xml: @batches.to_xml } - format.json { render json: @batches.to_json.gsub(/null/, '""') } + format.json { render json: @batches.to_json.gsub('null', '""') } end end @@ -406,7 +406,7 @@ def standard_create(requests) # rubocop:todo Metrics/CyclomaticComplexity # Fortunately we can detect the corresponding exception, and generate a friendly error message. # If this isn't the exception we're expecting, re-raise it. - raise e unless /request_id/.match?(e.message) + raise e unless e.message.include?('request_id') # Find the requests which caused the clash. batched_requests = BatchRequest.where(request_id: requests.map(&:id)).pluck(:request_id) diff --git a/app/controllers/bulk_submissions_controller.rb b/app/controllers/bulk_submissions_controller.rb index 034ce0d2f2..8b524c0630 100644 --- a/app/controllers/bulk_submissions_controller.rb +++ b/app/controllers/bulk_submissions_controller.rb @@ -3,7 +3,7 @@ require 'formtastic' -class BulkSubmissionsController < ApplicationController # rubocop:todo Style/Documentation +class BulkSubmissionsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 2a854e4717..68666dc5ad 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class DocumentsController < ApplicationController # rubocop:todo Style/Documentation +class DocumentsController < ApplicationController def show @document = Document.find(params[:id]) send_data @document.current_data, filename: @document.filename, type: @document.content_type, disposition: 'inline' diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 3f7f617948..0106317da5 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class EventsController < ApplicationController # rubocop:todo Style/Documentation +class EventsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/gels_controller.rb b/app/controllers/gels_controller.rb index 6bce21ff9f..c7eb5127ff 100644 --- a/app/controllers/gels_controller.rb +++ b/app/controllers/gels_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class GelsController < ApplicationController # rubocop:todo Style/Documentation +class GelsController < ApplicationController # JG 29/03/2019 # The GelQC process is no longer actively performed, although we should be careful # of hiding access to historical data. diff --git a/app/controllers/get_your_qc_completed_tubes_here_controller.rb b/app/controllers/get_your_qc_completed_tubes_here_controller.rb index d49893fde9..525680197d 100644 --- a/app/controllers/get_your_qc_completed_tubes_here_controller.rb +++ b/app/controllers/get_your_qc_completed_tubes_here_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class GetYourQcCompletedTubesHereController < ApplicationController # rubocop:todo Style/Documentation +class GetYourQcCompletedTubesHereController < ApplicationController before_action :login_required def new; end diff --git a/app/controllers/homes_controller.rb b/app/controllers/homes_controller.rb index 041d24c456..3c27ad382a 100644 --- a/app/controllers/homes_controller.rb +++ b/app/controllers/homes_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class HomesController < ApplicationController # rubocop:todo Style/Documentation +class HomesController < ApplicationController before_action :login_required def show # rubocop:todo Metrics/AbcSize diff --git a/app/controllers/lab_searches_controller.rb b/app/controllers/lab_searches_controller.rb index 18214a0fc5..d15395965a 100644 --- a/app/controllers/lab_searches_controller.rb +++ b/app/controllers/lab_searches_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class LabSearchesController < ApplicationController # rubocop:todo Style/Documentation +class LabSearchesController < ApplicationController include SearchBehaviour alias new search diff --git a/app/controllers/labwhere_receptions_controller.rb b/app/controllers/labwhere_receptions_controller.rb index 5d4ee072e1..03f1c5f6ae 100644 --- a/app/controllers/labwhere_receptions_controller.rb +++ b/app/controllers/labwhere_receptions_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class LabwhereReceptionsController < ApplicationController # rubocop:todo Style/Documentation +class LabwhereReceptionsController < ApplicationController before_action :login_required, except: %i[index create] def index diff --git a/app/controllers/npg_actions/assets_controller.rb b/app/controllers/npg_actions/assets_controller.rb index 00da007691..753b859e37 100644 --- a/app/controllers/npg_actions/assets_controller.rb +++ b/app/controllers/npg_actions/assets_controller.rb @@ -86,10 +86,10 @@ def qc_information end def rescue_error(exception) - render xml: "#{exception.message}", status: '404' + render xml: "#{exception.message}", status: :not_found end def rescue_error_bad_request(exception) - render xml: "#{exception.message}", status: '400' + render xml: "#{exception.message}", status: :bad_request end end diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index e7fcc2fbe3..55f87b1d06 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class OrdersController < ApplicationController # rubocop:todo Style/Documentation +class OrdersController < ApplicationController def update @order = Order.find(params[:id]) @order.add_comment(params[:comments], current_user) unless params[:comments].nil? diff --git a/app/controllers/plate_summaries_controller.rb b/app/controllers/plate_summaries_controller.rb index c732f05267..2bdacfef65 100644 --- a/app/controllers/plate_summaries_controller.rb +++ b/app/controllers/plate_summaries_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class PlateSummariesController < ApplicationController # rubocop:todo Style/Documentation +class PlateSummariesController < ApplicationController before_action :login_required def index diff --git a/app/controllers/plate_templates_controller.rb b/app/controllers/plate_templates_controller.rb index 18f27e362d..496cf3c3b6 100644 --- a/app/controllers/plate_templates_controller.rb +++ b/app/controllers/plate_templates_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class PlateTemplatesController < ApplicationController # rubocop:todo Style/Documentation +class PlateTemplatesController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/plates_controller.rb b/app/controllers/plates_controller.rb index 79759fe336..95c6499895 100644 --- a/app/controllers/plates_controller.rb +++ b/app/controllers/plates_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class PlatesController < ApplicationController # rubocop:todo Style/Documentation +class PlatesController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! @@ -42,13 +42,13 @@ def create # rubocop:todo Metrics/AbcSize Plate::CreatorParameters.new(params[:plates]) ) end - flash[:notice] = 'Created plates successfully' # rubocop:disable Rails/ActionControllerFlashBeforeRender + flash[:notice] = 'Created plates successfully' flash[:warning] = plate_creator.warnings if plate_creator.warnings.present? # rubocop:disable Rails/ActionControllerFlashBeforeRender format.html { render(new_plate_path) } end rescue StandardError => e respond_to do |format| - flash[:error] = e.message # rubocop:disable Rails/ActionControllerFlashBeforeRender + flash[:error] = e.message format.html { render(new_plate_path) } end end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 213711d156..d495a8f524 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true require 'event_factory' -class ProjectsController < ApplicationController # rubocop:todo Style/Documentation, Metrics/ClassLength +class ProjectsController < ApplicationController # rubocop:todo Metrics/ClassLength # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! @@ -54,7 +54,7 @@ def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength # TODO[5002667]: ... to here. - flash[:notice] = 'Your project has been created' # rubocop:disable Rails/ActionControllerFlashBeforeRender + flash[:notice] = 'Your project has been created' respond_to do |format| format.html { redirect_to project_path(@project) } format.xml { render xml: @project, status: :created, location: @project } diff --git a/app/controllers/qc_files_controller.rb b/app/controllers/qc_files_controller.rb index 495159f9f2..1d63ce9353 100644 --- a/app/controllers/qc_files_controller.rb +++ b/app/controllers/qc_files_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class QcFilesController < ApplicationController # rubocop:todo Style/Documentation +class QcFilesController < ApplicationController def show QcFile .find(params[:id]) diff --git a/app/controllers/qc_reports_controller.rb b/app/controllers/qc_reports_controller.rb index 603cb098b8..00be5cc7ea 100644 --- a/app/controllers/qc_reports_controller.rb +++ b/app/controllers/qc_reports_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class QcReportsController < ApplicationController # rubocop:todo Style/Documentation +class QcReportsController < ApplicationController before_action :login_required before_action :check_required, only: :create diff --git a/app/controllers/receptacles_controller.rb b/app/controllers/receptacles_controller.rb index 967182d675..1ac0479a00 100644 --- a/app/controllers/receptacles_controller.rb +++ b/app/controllers/receptacles_controller.rb @@ -161,7 +161,7 @@ def create_request # rubocop:todo Metrics/AbcSize submission.built! respond_to do |format| - flash[:notice] = 'Created request' # rubocop:disable Rails/ActionControllerFlashBeforeRender + flash[:notice] = 'Created request' format.html { redirect_to receptacle_path(@asset) } format.json { render json: submission.requests, status: :created } diff --git a/app/controllers/reference_genomes_controller.rb b/app/controllers/reference_genomes_controller.rb index beefae1e33..220b3457b4 100644 --- a/app/controllers/reference_genomes_controller.rb +++ b/app/controllers/reference_genomes_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class ReferenceGenomesController < ApplicationController # rubocop:todo Style/Documentation +class ReferenceGenomesController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/requests/comments_controller.rb b/app/controllers/requests/comments_controller.rb index c06682d5a8..e5bb4d3f37 100644 --- a/app/controllers/requests/comments_controller.rb +++ b/app/controllers/requests/comments_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Requests::CommentsController < ApplicationController # rubocop:todo Style/Documentation +class Requests::CommentsController < ApplicationController before_action :discover_request def index diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb index 99676144e6..350ab8a351 100644 --- a/app/controllers/requests_controller.rb +++ b/app/controllers/requests_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'event_factory' # rubocop:todo Metrics/ClassLength -class RequestsController < ApplicationController # rubocop:todo Style/Documentation +class RequestsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! @@ -79,7 +79,7 @@ def update # rubocop:todo Metrics/AbcSize begin if @request.update(parameters) - flash[:notice] = 'Request details have been updated' # rubocop:disable Rails/ActionControllerFlashBeforeRender + flash[:notice] = 'Request details have been updated' redirect_to request_path(@request) else flash[:error] = 'Request was not updated. No change specified ?' # rubocop:disable Rails/ActionControllerFlashBeforeRender @@ -88,7 +88,7 @@ def update # rubocop:todo Metrics/AbcSize rescue => e error_message = "An error has occurred, category:'#{e.class}'\ndescription:'#{e.message}'" EventFactory.request_update_note_to_manager(@request, current_user, error_message) - flash[:error] = 'Failed to update request. ' << error_message # rubocop:disable Rails/ActionControllerFlashBeforeRender + flash[:error] = 'Failed to update request. ' << error_message render action: 'edit', id: @request.id end end @@ -177,7 +177,7 @@ def change_decision flash[:notice] = 'Update. Below you find the new situation.' redirect_to filter_change_decision_request_path(params[:id]) rescue Request::ChangeDecision::InvalidDecision => e - flash[:error] = 'Failed! Please, read the list of problem below.' # rubocop:disable Rails/ActionControllerFlashBeforeRender + flash[:error] = 'Failed! Please, read the list of problem below.' @change_decision = e.object render(action: :filter_change_decision) end diff --git a/app/controllers/robot_verifications_controller.rb b/app/controllers/robot_verifications_controller.rb index c046335313..e98994d9ae 100644 --- a/app/controllers/robot_verifications_controller.rb +++ b/app/controllers/robot_verifications_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class RobotVerificationsController < ApplicationController # rubocop:todo Style/Documentation +class RobotVerificationsController < ApplicationController before_action :find_barcodes, only: :submission # Step 1: Renders a form asking for user barcode, batch barcode, robot barcode and destination plate barcode diff --git a/app/controllers/sample_manifest_upload_with_tag_sequences_controller.rb b/app/controllers/sample_manifest_upload_with_tag_sequences_controller.rb index a31a76a6fc..b1b4faa0af 100644 --- a/app/controllers/sample_manifest_upload_with_tag_sequences_controller.rb +++ b/app/controllers/sample_manifest_upload_with_tag_sequences_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class SampleManifestUploadWithTagSequencesController < ApplicationController # rubocop:todo Style/Documentation +class SampleManifestUploadWithTagSequencesController < ApplicationController before_action :login_required def new diff --git a/app/controllers/samples/comments_controller.rb b/app/controllers/samples/comments_controller.rb index 4d38df9808..b6fc7c446e 100644 --- a/app/controllers/samples/comments_controller.rb +++ b/app/controllers/samples/comments_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Samples::CommentsController < ApplicationController # rubocop:todo Style/Documentation +class Samples::CommentsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/samples/studies_controller.rb b/app/controllers/samples/studies_controller.rb index 845cffbbfa..6e20d20e0d 100644 --- a/app/controllers/samples/studies_controller.rb +++ b/app/controllers/samples/studies_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Samples::StudiesController < ApplicationController # rubocop:todo Style/Documentation +class Samples::StudiesController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/samples_controller.rb b/app/controllers/samples_controller.rb index 7c7b5d9128..2e21f2782e 100644 --- a/app/controllers/samples_controller.rb +++ b/app/controllers/samples_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # rubocop:todo Metrics/ClassLength -class SamplesController < ApplicationController # rubocop:todo Style/Documentation +class SamplesController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! @@ -34,7 +34,7 @@ def edit # rubocop:todo Metrics/AbcSize, Metrics/MethodLength authorize! :update, @sample if @sample.released? && cannot?(:update_released, @sample) - flash[:error] = 'Cannot edit publicly released sample' # rubocop:disable Rails/ActionControllerFlashBeforeRender + flash[:error] = 'Cannot edit publicly released sample' redirect_to sample_path(@sample) return end diff --git a/app/controllers/sdb/home_controller.rb b/app/controllers/sdb/home_controller.rb index d56f2d2618..ded7c57f04 100644 --- a/app/controllers/sdb/home_controller.rb +++ b/app/controllers/sdb/home_controller.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true -class Sdb::HomeController < Sdb::BaseController # rubocop:todo Style/Documentation +class Sdb::HomeController < Sdb::BaseController def index; end end diff --git a/app/controllers/sdb/sample_manifests_controller.rb b/app/controllers/sdb/sample_manifests_controller.rb index 0e6c2fac29..ce718177b1 100644 --- a/app/controllers/sdb/sample_manifests_controller.rb +++ b/app/controllers/sdb/sample_manifests_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Sdb::SampleManifestsController < Sdb::BaseController # rubocop:todo Style/Documentation +class Sdb::SampleManifestsController < Sdb::BaseController before_action :set_sample_manifest_id, only: %i[show generated print_labels] before_action :validate_type, only: %i[new create] diff --git a/app/controllers/sdb/suppliers_controller.rb b/app/controllers/sdb/suppliers_controller.rb index 75c20c7995..fe74ff52e8 100644 --- a/app/controllers/sdb/suppliers_controller.rb +++ b/app/controllers/sdb/suppliers_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Sdb::SuppliersController < Sdb::BaseController # rubocop:todo Style/Documentation +class Sdb::SuppliersController < Sdb::BaseController # Show all suppliers def index @suppliers = Supplier.all diff --git a/app/controllers/searches_controller.rb b/app/controllers/searches_controller.rb index 2b684262a5..94e8aeee81 100644 --- a/app/controllers/searches_controller.rb +++ b/app/controllers/searches_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class SearchesController < ApplicationController # rubocop:todo Style/Documentation +class SearchesController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index ca42439912..d1de330836 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require_relative '../../lib/deployment_environment' -class SessionsController < ApplicationController # rubocop:todo Style/Documentation +class SessionsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/stock_stampers_controller.rb b/app/controllers/stock_stampers_controller.rb index fde1358060..233ba5d328 100644 --- a/app/controllers/stock_stampers_controller.rb +++ b/app/controllers/stock_stampers_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class StockStampersController < ApplicationController # rubocop:todo Style/Documentation +class StockStampersController < ApplicationController def new @stock_stamper = StockStamper.new end diff --git a/app/controllers/studies/asset_groups_controller.rb b/app/controllers/studies/asset_groups_controller.rb index 0d281ee61f..8765aee307 100644 --- a/app/controllers/studies/asset_groups_controller.rb +++ b/app/controllers/studies/asset_groups_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # rubocop:todo Metrics/ClassLength -class Studies::AssetGroupsController < ApplicationController # rubocop:todo Style/Documentation +class Studies::AssetGroupsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! @@ -93,7 +93,7 @@ def search # rubocop:todo Metrics/AbcSize if query.blank? || (query.length < 2) # We should not blame the user, we should instead help. # - By returning the X most recent ones together with an explanation. - flash[:error] = 'Search too wide. Please make your query more specific.' # rubocop:disable Rails/ActionControllerFlashBeforeRender + flash[:error] = 'Search too wide. Please make your query more specific.' redirect_to study_asset_groups_path(@study) return else diff --git a/app/controllers/studies/comments_controller.rb b/app/controllers/studies/comments_controller.rb index 917410a205..499c492a17 100644 --- a/app/controllers/studies/comments_controller.rb +++ b/app/controllers/studies/comments_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Studies::CommentsController < ApplicationController # rubocop:todo Style/Documentation +class Studies::CommentsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/studies/documents_controller.rb b/app/controllers/studies/documents_controller.rb index 04842533c5..6fcb1f4f9e 100644 --- a/app/controllers/studies/documents_controller.rb +++ b/app/controllers/studies/documents_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Studies::DocumentsController < ApplicationController # rubocop:todo Style/Documentation +class Studies::DocumentsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/studies/events_controller.rb b/app/controllers/studies/events_controller.rb index 1bb239e2c3..3480c73769 100644 --- a/app/controllers/studies/events_controller.rb +++ b/app/controllers/studies/events_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Studies::EventsController < ApplicationController # rubocop:todo Style/Documentation +class Studies::EventsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/studies/samples_controller.rb b/app/controllers/studies/samples_controller.rb index 0971a31ff6..be8de75fca 100644 --- a/app/controllers/studies/samples_controller.rb +++ b/app/controllers/studies/samples_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Studies::SamplesController < ApplicationController # rubocop:todo Style/Documentation +class Studies::SamplesController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/studies_controller.rb b/app/controllers/studies_controller.rb index 29ce06b662..400b3717c8 100644 --- a/app/controllers/studies_controller.rb +++ b/app/controllers/studies_controller.rb @@ -2,7 +2,7 @@ require 'rexml/document' # rubocop:todo Metrics/ClassLength -class StudiesController < ApplicationController # rubocop:todo Style/Documentation +class StudiesController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! @@ -85,7 +85,7 @@ def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength User.find(params[:study_owner_id]).grant_owner(@study) if params[:study_owner_id].present? end - flash[:notice] = 'Your study has been created' # rubocop:disable Rails/ActionControllerFlashBeforeRender + flash[:notice] = 'Your study has been created' respond_to do |format| format.html { redirect_to study_path(@study) } format.xml { render xml: @study, status: :created, location: @study } diff --git a/app/controllers/study_reports_controller.rb b/app/controllers/study_reports_controller.rb index 63df06f708..bf7d15b54f 100644 --- a/app/controllers/study_reports_controller.rb +++ b/app/controllers/study_reports_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class StudyReportsController < ApplicationController # rubocop:todo Style/Documentation +class StudyReportsController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/user_queries_controller.rb b/app/controllers/user_queries_controller.rb index ea5bd8f9fc..5c163d75f9 100644 --- a/app/controllers/user_queries_controller.rb +++ b/app/controllers/user_queries_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class UserQueriesController < ApplicationController # rubocop:todo Style/Documentation +class UserQueriesController < ApplicationController def new @user_query = UserQuery.new(url: request.referer, user: current_user) end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b8cca667e5..dd1764c0cb 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class UsersController < ApplicationController # rubocop:todo Style/Documentation +class UsersController < ApplicationController # WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour. # It should be removed wherever possible and the correct Strong Parameter options applied in its place. before_action :evil_parameter_hack! diff --git a/app/controllers/uuids_controller.rb b/app/controllers/uuids_controller.rb index dc7b069ef3..2441bf08fa 100644 --- a/app/controllers/uuids_controller.rb +++ b/app/controllers/uuids_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class UuidsController < ApplicationController # rubocop:todo Style/Documentation +class UuidsController < ApplicationController def show uuid = Uuid.find_by!(external_id: params[:id]) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e527d0fb38..fb8ec1a1dd 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # rubocop:todo Metrics/ModuleLength -module ApplicationHelper # rubocop:todo Style/Documentation +module ApplicationHelper # Should return either the custom text or a blank string def custom_text(identifier, differential = nil) Rails @@ -310,3 +310,27 @@ def legacy_javascript_tag end end # rubocop:enable Metrics/ModuleLength + +# error_messages_for method was deprecated, however lots of the tests depend on the message format it +# was using. +# +def render_error_messages(object) + return if object.errors.count.zero? + contents = +'' + contents << error_message_header(object) + contents << error_messages_ul_html_safe(object) + content_tag(:div, contents.html_safe) +end + +def error_message_header(object) + count = object.errors.full_messages.count + model_name = object.class.to_s.tableize.tr('_', ' ').gsub(%r{/.*}, '').singularize + is_plural = count > 1 ? 's' : '' + header = "#{count} error#{is_plural} prohibited this #{model_name} from being saved" + content_tag(:h2, header) +end + +def error_messages_ul_html_safe(object) + messages = object.errors.full_messages.map { |msg| content_tag(:li, ERB::Util.html_escape(msg)) }.join.html_safe + content_tag(:ul, messages) +end diff --git a/app/helpers/assets_helper.rb b/app/helpers/assets_helper.rb index 3b4eb7b5ed..23c43893af 100644 --- a/app/helpers/assets_helper.rb +++ b/app/helpers/assets_helper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module AssetsHelper # rubocop:todo Style/Documentation +module AssetsHelper def well_identifier(plate_layout, row, column) plate_layout.cell_name_for_well_at(row, column) end diff --git a/app/helpers/barcode_printers_helper.rb b/app/helpers/barcode_printers_helper.rb index ef65fa2683..106287e4b4 100644 --- a/app/helpers/barcode_printers_helper.rb +++ b/app/helpers/barcode_printers_helper.rb @@ -1,3 +1,3 @@ # frozen_string_literal: true -module BarcodePrintersHelper # rubocop:todo Style/Documentation +module BarcodePrintersHelper end diff --git a/app/helpers/bootstrap_helper.rb b/app/helpers/bootstrap_helper.rb index a3533ceb16..94863fc364 100644 --- a/app/helpers/bootstrap_helper.rb +++ b/app/helpers/bootstrap_helper.rb @@ -22,7 +22,7 @@ def panel_no_body(type = :default, options = {}, &block) def bs_custom_panel(type, body_type, body_options, options, &block) title = options.delete(:title) append_class!(options, "ss-card card-style-#{type}") - tag.div(options) do + tag.div(**options) do concat tag.h3(title, class: 'card-header-custom') unless title.nil? concat content_tag(body_type, body_options, &block) end @@ -34,7 +34,7 @@ def bs_custom_panel(type, body_type, body_options, options, &block) def alert(type = :default, options = {}, &block) options[:role] ||= 'alert' append_class!(options, "alert alert-#{type}") - tag.div(options, &block) + tag.div(**options, &block) end # Summary composites a panel with a table to deliver @@ -145,7 +145,7 @@ def render_section(form, field_name, sections, field) def render_radio_section(_form, _field_name, sections, field) label = - tag.label(sections.label, sections.label_options) << tag.span(sections.edit_info, class: 'property_edit_info') + tag.label(sections.label, **sections.label_options) << tag.span(sections.edit_info, class: 'property_edit_info') help = sections.help tag.legend(sections.label, class: 'sr-only') << form_collection(label, field, help) end diff --git a/app/helpers/delayed_jobs_helper.rb b/app/helpers/delayed_jobs_helper.rb index 89313fa7f2..ede217e5c7 100644 --- a/app/helpers/delayed_jobs_helper.rb +++ b/app/helpers/delayed_jobs_helper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module DelayedJobsHelper # rubocop:todo Style/Documentation +module DelayedJobsHelper def job_type(job) case job.name when /StudyReport/ diff --git a/app/helpers/descriptor_javascript_helper.rb b/app/helpers/descriptor_javascript_helper.rb index 242ad89304..fa3e84cb23 100644 --- a/app/helpers/descriptor_javascript_helper.rb +++ b/app/helpers/descriptor_javascript_helper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module DescriptorJavascriptHelper # rubocop:todo Style/Documentation +module DescriptorJavascriptHelper def link_to_remove_asset(index, &block) link_to_with_onclick_only("removeAsset(#{index});return false;", &block) end diff --git a/app/helpers/field_infos_helper.rb b/app/helpers/field_infos_helper.rb index bd4b961dd0..2a273c8f37 100644 --- a/app/helpers/field_infos_helper.rb +++ b/app/helpers/field_infos_helper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module FieldInfosHelper # rubocop:todo Style/Documentation +module FieldInfosHelper def field_info_id(path, field) path = path.clone return field if path.empty? diff --git a/app/helpers/pipelines_helper.rb b/app/helpers/pipelines_helper.rb index 00ccba5636..6cddbdff08 100644 --- a/app/helpers/pipelines_helper.rb +++ b/app/helpers/pipelines_helper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module PipelinesHelper # rubocop:todo Style/Documentation +module PipelinesHelper def target_purpose_for(request) nrs = request.next_requests return nrs.first.request_type.acceptable_purposes.pluck(:name).join('|') unless nrs.empty? diff --git a/app/helpers/plates_helper.rb b/app/helpers/plates_helper.rb index 3283bb8d8e..24ba4fabca 100644 --- a/app/helpers/plates_helper.rb +++ b/app/helpers/plates_helper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module PlatesHelper # rubocop:todo Style/Documentation +module PlatesHelper class AliquotError < StandardError end diff --git a/app/helpers/prototype_replacement_helper.rb b/app/helpers/prototype_replacement_helper.rb index 86cc163ad6..1dca76a984 100644 --- a/app/helpers/prototype_replacement_helper.rb +++ b/app/helpers/prototype_replacement_helper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module PrototypeReplacementHelper # rubocop:todo Style/Documentation +module PrototypeReplacementHelper def remote_button(label, url, data, html_options = {}) form_tag url, remote: true, data: data, class: 'remote-form' do submit_tag(label, html_options) diff --git a/app/helpers/request_types_helper.rb b/app/helpers/request_types_helper.rb index cb796c914b..29f1bcf369 100644 --- a/app/helpers/request_types_helper.rb +++ b/app/helpers/request_types_helper.rb @@ -1,3 +1,3 @@ # frozen_string_literal: true -module RequestTypesHelper # rubocop:todo Style/Documentation +module RequestTypesHelper end diff --git a/app/helpers/samples_helper.rb b/app/helpers/samples_helper.rb index eae37e8d60..ea0423bea3 100644 --- a/app/helpers/samples_helper.rb +++ b/app/helpers/samples_helper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module SamplesHelper # rubocop:todo Style/Documentation +module SamplesHelper # Use this wherever you are editing a sample so that you get the sample 'common name' lookup # behaviour. Attach 'data-organism' attribute to the 'common name' and 'taxon ID' fields # to get them updated. diff --git a/app/helpers/sdb/sample_manifests_helper.rb b/app/helpers/sdb/sample_manifests_helper.rb index 092dca0eb2..d23da7b12c 100644 --- a/app/helpers/sdb/sample_manifests_helper.rb +++ b/app/helpers/sdb/sample_manifests_helper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Sdb::SampleManifestsHelper # rubocop:todo Style/Documentation +module Sdb::SampleManifestsHelper def count_labels { '1dtube' => 'Tubes required', diff --git a/app/helpers/studies_helper.rb b/app/helpers/studies_helper.rb index 6cffe2ebad..bc8f8e5f3a 100644 --- a/app/helpers/studies_helper.rb +++ b/app/helpers/studies_helper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module StudiesHelper # rubocop:todo Style/Documentation +module StudiesHelper def status_link_title(study) study.inactive? || study.pending? ? 'Open' : 'Close' end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index ba20641cec..91cfafeb74 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module UsersHelper # rubocop:todo Style/Documentation +module UsersHelper def logged_in_user?(user) yield if user == current_user end diff --git a/app/heron/factories/concerns/coordinates_support.rb b/app/heron/factories/concerns/coordinates_support.rb index 180ed92f65..c1cbdb2aa5 100644 --- a/app/heron/factories/concerns/coordinates_support.rb +++ b/app/heron/factories/concerns/coordinates_support.rb @@ -7,7 +7,7 @@ module Concerns # This module adds validation and processing utilities for this type of identifiers. # Eg: A01, A1, F12, etc... module CoordinatesSupport - LOCATION_REGEXP = /[A-Z][0-9]{0,1}[0-9]/.freeze + LOCATION_REGEXP = /[A-Z][0-9]{0,1}[0-9]/ def unpad_coordinate(coordinate) Map.strip_description(coordinate.to_s) diff --git a/app/middleware/api/endpoint_handler.rb b/app/middleware/api/endpoint_handler.rb index b4a13d5b98..6eaba12f6e 100644 --- a/app/middleware/api/endpoint_handler.rb +++ b/app/middleware/api/endpoint_handler.rb @@ -4,7 +4,7 @@ module Api # Sinatra application which provides routing for the V1 API # Automatically generates routes from the files listed under `app/api/endpoints` # used in {Api::RootService} which in turn gets mounted in `config/routes.rb` - class EndpointHandler < ::Core::Service # rubocop:todo Metrics/ClassLength + class EndpointHandler < ::Core::Service class << self def registered_mimetypes @registered_mimetypes || [] diff --git a/app/middleware/api/root_service.rb b/app/middleware/api/root_service.rb index 85a074195a..72092b08d9 100644 --- a/app/middleware/api/root_service.rb +++ b/app/middleware/api/root_service.rb @@ -16,7 +16,7 @@ class RootService < ::Core::Service use Api::EndpointHandler - module RootResponse # rubocop:todo Style/Documentation + module RootResponse # rubocop:todo Metrics/MethodLength def services(services) # rubocop:todo Metrics/AbcSize self.object = services diff --git a/app/models/accessionable/base.rb b/app/models/accessionable/base.rb index 406c57f2fa..b3ce09a2a9 100644 --- a/app/models/accessionable/base.rb +++ b/app/models/accessionable/base.rb @@ -76,7 +76,7 @@ def label_scope @label_scope ||= "metadata.#{self.class.name.split('::').last.downcase}.metadata" end - class Tag # rubocop:todo Style/Documentation + class Tag attr_reader :value # Value serialization for accessioning XML generation @@ -142,7 +142,6 @@ def applies_to?(name) class FieldCollectionDate < FieldSerializer # rubocop:disable Layout/LineLength REGEXP = %r{(^[12][0-9]{3}(-(0[1-9]|1[0-2])(-(0[1-9]|[12][0-9]|3[01])(T[0-9]{2}:[0-9]{2}(:[0-9]{2})?Z?([+-][0-9]{1,2})?)?)?)?(/[0-9]{4}(-[0-9]{2}(-[0-9]{2}(T[0-9]{2}:[0-9]{2}(:[0-9]{2})?Z?([+-][0-9]{1,2})?)?)?)?)?$)} - .freeze # rubocop:enable Layout/LineLength diff --git a/app/models/accessionable/sample.rb b/app/models/accessionable/sample.rb index ea79f7a410..4dd0deba25 100644 --- a/app/models/accessionable/sample.rb +++ b/app/models/accessionable/sample.rb @@ -2,7 +2,7 @@ # Handles the submission of {Sample} information to the ENA or EGA # It should have a 1 to 1 mapping with Sequencescape {Sample samples}. module Accessionable - class Sample < Base # rubocop:todo Style/Documentation + class Sample < Base ARRAY_EXPRESS_FIELDS = %w[ genotype phenotype @@ -116,14 +116,14 @@ def released? private - class ArrayExpressTag < Base::Tag # rubocop:todo Style/Documentation + class ArrayExpressTag < Base::Tag def label default_tag = "ArrayExpress-#{I18n.t("#{@scope}.#{@name}.label").tr(' ', '_').camelize}" I18n.t("#{@scope}.#{@name}.ena_label", default: default_tag) end end - class EgaTag < Base::Tag # rubocop:todo Style/Documentation + class EgaTag < Base::Tag def label default_tag = "EGA-#{I18n.t("#{@scope}.#{@name}.label").tr(' ', '_').camelize}" I18n.t("#{@scope}.#{@name}.ena_label", default: default_tag) diff --git a/app/models/accessionable/study.rb b/app/models/accessionable/study.rb index 5d8254e7f0..178c7e8ee1 100644 --- a/app/models/accessionable/study.rb +++ b/app/models/accessionable/study.rb @@ -6,7 +6,7 @@ # A study can either be open (ENA) or managed (EGA) which determines which {AccessionService} it # uses. module Accessionable - class Study < Base # rubocop:todo Style/Documentation + class Study < Base attr_reader :study_title, :description, :center_study_name, :study_abstract, :existing_study_type, :tags # rubocop:todo Metrics/MethodLength diff --git a/app/models/accessionable/submission.rb b/app/models/accessionable/submission.rb index 21558ba75f..d3b3defce8 100644 --- a/app/models/accessionable/submission.rb +++ b/app/models/accessionable/submission.rb @@ -78,7 +78,7 @@ def update_accession_number!(_user, accession_number) private - class Contact # rubocop:todo Style/Documentation + class Contact attr_reader :inform_on_error, :inform_on_status, :name def initialize(user) diff --git a/app/models/aliquot/aliquotable.rb b/app/models/aliquot/aliquotable.rb index acd102e448..a084537dac 100644 --- a/app/models/aliquot/aliquotable.rb +++ b/app/models/aliquot/aliquotable.rb @@ -21,7 +21,7 @@ def self.included(base) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength end end - module ClassMethods # rubocop:todo Style/Documentation + module ClassMethods def receptacle_alias(name, options = {}, &block) has_many(name, -> { distinct }, options.merge(through: :aliquots, source: :receptacle), &block) end diff --git a/app/models/aliquot/deprecated_behaviours.rb b/app/models/aliquot/deprecated_behaviours.rb index 96051dc916..cd692134a9 100644 --- a/app/models/aliquot/deprecated_behaviours.rb +++ b/app/models/aliquot/deprecated_behaviours.rb @@ -2,7 +2,7 @@ # The following module is included where we have deprecated behaviours that rely on sample or request. module Aliquot::DeprecatedBehaviours - module Request # rubocop:todo Style/Documentation + module Request def tag_number tag.try(:map_id) || '' end diff --git a/app/models/aliquot_indexer.rb b/app/models/aliquot_indexer.rb index a1df38ae0e..1f7fa7e21a 100644 --- a/app/models/aliquot_indexer.rb +++ b/app/models/aliquot_indexer.rb @@ -13,7 +13,7 @@ class AliquotIndexer attr_reader :lane, :aliquots - module AliquotScopes # rubocop:todo Style/Documentation + module AliquotScopes def self.included(base) base.class_eval do scope :sorted_for_indexing, -> { includes(%i[tag tag2]).reorder('tag2s_aliquots.map_id ASC, tags.map_id ASC') } diff --git a/app/models/api/aliquot_io.rb b/app/models/api/aliquot_io.rb index 10c3d0b9b9..e0bb78e42b 100644 --- a/app/models/api/aliquot_io.rb +++ b/app/models/api/aliquot_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {Aliquot} # Historically used to be v0.5 API class Api::AliquotIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::AliquotIO end diff --git a/app/models/api/asset_link_io.rb b/app/models/api/asset_link_io.rb index 743fd02716..f26cede54f 100644 --- a/app/models/api/asset_link_io.rb +++ b/app/models/api/asset_link_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {AssetLink} # Historically used to be v0.5 API class Api::AssetLinkIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::AssetLinkIO end diff --git a/app/models/api/batch_io.rb b/app/models/api/batch_io.rb index 54aa863b13..626175df06 100644 --- a/app/models/api/batch_io.rb +++ b/app/models/api/batch_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {Batch} # Historically used to be v0.5 API class Api::BatchIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::BatchIO end diff --git a/app/models/api/batch_request_io.rb b/app/models/api/batch_request_io.rb index 54c461e5d2..19d4d233e0 100644 --- a/app/models/api/batch_request_io.rb +++ b/app/models/api/batch_request_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {BatchRequest} # Historically used to be v0.5 API class Api::BatchRequestIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::BatchRequestIO end diff --git a/app/models/api/lane_io.rb b/app/models/api/lane_io.rb index e56245bc59..afd61913c9 100644 --- a/app/models/api/lane_io.rb +++ b/app/models/api/lane_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {Lane} # Historically used to be v0.5 API class Api::LaneIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::LaneIO end diff --git a/app/models/api/library_tube_io.rb b/app/models/api/library_tube_io.rb index 89eb265874..9f50bcf3b9 100644 --- a/app/models/api/library_tube_io.rb +++ b/app/models/api/library_tube_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {LibraryTube} # Historically used to be v0.5 API class Api::LibraryTubeIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::LibraryTubeIO end diff --git a/app/models/api/messages/flowcell_io.rb b/app/models/api/messages/flowcell_io.rb index f662dcde7b..e444db73d5 100644 --- a/app/models/api/messages/flowcell_io.rb +++ b/app/models/api/messages/flowcell_io.rb @@ -175,7 +175,7 @@ def project_cost_code_for_uwh # Included in Batch model module Extensions - module ClassMethods # rubocop:todo Style/Documentation + module ClassMethods end def self.included(base) diff --git a/app/models/api/messages/fluidigm_plate_io.rb b/app/models/api/messages/fluidigm_plate_io.rb index 1197c8f646..65a7f04bce 100644 --- a/app/models/api/messages/fluidigm_plate_io.rb +++ b/app/models/api/messages/fluidigm_plate_io.rb @@ -7,7 +7,7 @@ class Api::Messages::FluidigmPlateIO < Api::Base { wells: [:map, :uuid_object, { primary_aliquot: [:project, { sample: :uuid_object, study: :uuid_object }] }] } ] - module WellExtensions # rubocop:todo Style/Documentation + module WellExtensions def cost_code return nil if primary_aliquot.nil? diff --git a/app/models/api/messages/qc_result_io.rb b/app/models/api/messages/qc_result_io.rb index eb3a90a99c..71bfef37a8 100644 --- a/app/models/api/messages/qc_result_io.rb +++ b/app/models/api/messages/qc_result_io.rb @@ -2,29 +2,29 @@ # Generates a warehouse message describing a {QcResult} class Api::Messages::QcResultIO < Api::Base - module Extensions # rubocop:todo Style/Documentation + module Extensions def assay "#{assay_type} #{assay_version}" end end - module AliquotExtensions # rubocop:todo Style/Documentation + module AliquotExtensions def library_identifier library&.external_identifier end end - module AssetExtensions # rubocop:todo Style/Documentation + module AssetExtensions def labware_purpose; end end - module WellExtensions # rubocop:todo Style/Documentation + module WellExtensions def labware_purpose plate&.purpose&.name end end - module TubeExtensions # rubocop:todo Style/Documentation + module TubeExtensions def labware_purpose purpose&.name end diff --git a/app/models/api/multiplexed_library_tube_io.rb b/app/models/api/multiplexed_library_tube_io.rb index 3a4f71ab7c..6190f20ebe 100644 --- a/app/models/api/multiplexed_library_tube_io.rb +++ b/app/models/api/multiplexed_library_tube_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {MultiplexedLibraryTube} # Historically used to be v0.5 API class Api::MultiplexedLibraryTubeIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::MultiplexedLibraryTubeIO end diff --git a/app/models/api/pac_bio_library_tube_io.rb b/app/models/api/pac_bio_library_tube_io.rb index 64e634ae41..341bea63ea 100644 --- a/app/models/api/pac_bio_library_tube_io.rb +++ b/app/models/api/pac_bio_library_tube_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {PacBioLibraryTube} # Historically used to be v0.5 API class Api::PacBioLibraryTubeIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::PacBioLibraryTubeIO end diff --git a/app/models/api/plate_io.rb b/app/models/api/plate_io.rb index 259b4013da..2e78013c8e 100644 --- a/app/models/api/plate_io.rb +++ b/app/models/api/plate_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {Plate} # Historically used to be v0.5 API class Api::PlateIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::PlateIO end diff --git a/app/models/api/plate_purpose_io.rb b/app/models/api/plate_purpose_io.rb index d726b21331..1862a51a66 100644 --- a/app/models/api/plate_purpose_io.rb +++ b/app/models/api/plate_purpose_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {PlatePurpose} # Historically used to be v0.5 API class Api::PlatePurposeIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::PlatePurposeIO end diff --git a/app/models/api/project_io.rb b/app/models/api/project_io.rb index abb092989c..eb73f3caec 100644 --- a/app/models/api/project_io.rb +++ b/app/models/api/project_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {Project} # Historically used to be v0.5 API class Api::ProjectIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::ProjectIO end diff --git a/app/models/api/pulldown_multiplexed_library_tube_io.rb b/app/models/api/pulldown_multiplexed_library_tube_io.rb index d91fb36642..3f0d581ece 100644 --- a/app/models/api/pulldown_multiplexed_library_tube_io.rb +++ b/app/models/api/pulldown_multiplexed_library_tube_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {PulldownMultiplexedLibraryTube} # Historically used to be v0.5 API class Api::PulldownMultiplexedLibraryTubeIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::PulldownMultiplexedLibraryTubeIO end diff --git a/app/models/api/reference_genome_io.rb b/app/models/api/reference_genome_io.rb index 69db8f33b0..661e50656a 100644 --- a/app/models/api/reference_genome_io.rb +++ b/app/models/api/reference_genome_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {ReferenceGenome} # Historically used to be v0.5 API class Api::ReferenceGenomeIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::ReferenceGenomeIO end diff --git a/app/models/api/request_io.rb b/app/models/api/request_io.rb index 1ef8c14d2b..fe37701a9d 100644 --- a/app/models/api/request_io.rb +++ b/app/models/api/request_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {Request} # Historically used to be v0.5 API class Api::RequestIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::RequestIO end diff --git a/app/models/api/sample_io.rb b/app/models/api/sample_io.rb index 3564f8b0fa..f2ec7f4193 100644 --- a/app/models/api/sample_io.rb +++ b/app/models/api/sample_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {Sample} # Historically used to be v0.5 API class Api::SampleIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::SampleIO end diff --git a/app/models/api/sample_tube_io.rb b/app/models/api/sample_tube_io.rb index 7435c15f10..b3f6d4aefb 100644 --- a/app/models/api/sample_tube_io.rb +++ b/app/models/api/sample_tube_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {SampleTube} # Historically used to be v0.5 API class Api::SampleTubeIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::SampleTubeIO end diff --git a/app/models/api/study_io.rb b/app/models/api/study_io.rb index 7cd22aea11..093f8fc172 100644 --- a/app/models/api/study_io.rb +++ b/app/models/api/study_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {Study} # Historically used to be v0.5 API class Api::StudyIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::StudyIO end diff --git a/app/models/api/study_sample_io.rb b/app/models/api/study_sample_io.rb index abea7e52d8..7d1c572380 100644 --- a/app/models/api/study_sample_io.rb +++ b/app/models/api/study_sample_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {StudySample} # Historically used to be v0.5 API class Api::StudySampleIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::StudySampleIO end diff --git a/app/models/api/tag_io.rb b/app/models/api/tag_io.rb index bd281ec116..e636908789 100644 --- a/app/models/api/tag_io.rb +++ b/app/models/api/tag_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {Tag} # Historically used to be v0.5 API class Api::TagIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::TagIO end diff --git a/app/models/api/well_io.rb b/app/models/api/well_io.rb index a2ef2f53a1..d4e80259c4 100644 --- a/app/models/api/well_io.rb +++ b/app/models/api/well_io.rb @@ -2,8 +2,8 @@ # Despite name controls rendering of warehouse messages for {Well} # Historically used to be v0.5 API class Api::WellIO < Api::Base - module Extensions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module Extensions + module ClassMethods def render_class Api::WellIO end diff --git a/app/models/asset/ownership.rb b/app/models/asset/ownership.rb index bd232d43d8..6c15230c6b 100644 --- a/app/models/asset/ownership.rb +++ b/app/models/asset/ownership.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module Asset::Ownership - module ChangesOwner # rubocop:todo Style/Documentation + module ChangesOwner # Included in events which change ownership of plates def self.included(base) base.class_eval do @@ -15,20 +15,20 @@ def assign_owner end private :assign_owner - module ClassMethods # rubocop:todo Style/Documentation + module ClassMethods def set_target_for_owner(target) alias_method(:target_for_ownership, target) end end end - module Unowned # rubocop:todo Style/Documentation + module Unowned def change_owner_to(owner, source_event) # Do nothing end end - module Owned # rubocop:todo Style/Documentation + module Owned # Currently only plates can be owned. def self.included(base) diff --git a/app/models/asset/stock.rb b/app/models/asset/stock.rb index 335a5676c3..faab24e10f 100644 --- a/app/models/asset/stock.rb +++ b/app/models/asset/stock.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Asset::Stock # rubocop:todo Style/Documentation +module Asset::Stock # Extending this module will allow an asset to have a stock asset and be able to # create it. module CanCreateStockAsset diff --git a/app/models/asset_creation.rb b/app/models/asset_creation.rb index 92e87d98b8..05f7954966 100644 --- a/app/models/asset_creation.rb +++ b/app/models/asset_creation.rb @@ -3,7 +3,7 @@ # pieces of {Asset labware}. In addition provides an audit trail to record who # created the Asset. class AssetCreation < ApplicationRecord - class ParentAssociation < ApplicationRecord # rubocop:todo Style/Documentation + class ParentAssociation < ApplicationRecord self.table_name = ('asset_creation_parents') belongs_to :asset_creation belongs_to :parent, class_name: 'Labware' diff --git a/app/models/asset_link.rb b/app/models/asset_link.rb index db53dc53ba..4bd3a13bb3 100644 --- a/app/models/asset_link.rb +++ b/app/models/asset_link.rb @@ -33,7 +33,7 @@ class AssetLink < ApplicationRecord def destroy!; end - module Associations # rubocop:todo Style/Documentation + module Associations def self.included(base) base.class_eval do extend ClassMethods @@ -47,7 +47,7 @@ def self.included(base) base.extend(ClassMethods) end - module ClassMethods # rubocop:todo Style/Documentation + module ClassMethods def has_one_as_child(name, scope) # rubocop:todo Metrics/MethodLength plural_name = name.to_s.pluralize.to_sym has_many(plural_name, scope, through: :links_as_child, source: :ancestor) diff --git a/app/models/attributable/association.rb b/app/models/attributable/association.rb index cc8e80ae96..475ba4d744 100644 --- a/app/models/attributable/association.rb +++ b/app/models/attributable/association.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Attributable - class Association # rubocop:todo Style/Documentation - module Target # rubocop:todo Style/Documentation + class Association + module Target def self.extended(base) base.class_eval do include InstanceMethods @@ -17,7 +17,7 @@ def default nil end - module InstanceMethods # rubocop:todo Style/Documentation + module InstanceMethods def for_select_dropdown [name, id] end diff --git a/app/models/attributable/attribute.rb b/app/models/attributable/attribute.rb index fee36832f7..58e0805956 100644 --- a/app/models/attributable/attribute.rb +++ b/app/models/attributable/attribute.rb @@ -27,7 +27,7 @@ def from(record) def default_from(origin = nil) return nil if origin.nil? - return origin.validator_for(name).default if validator? + origin.validator_for(name).default if validator? end def validator? @@ -164,7 +164,7 @@ def kind def selection_from_metadata(validator_source) return nil if validator_source.blank? - return validator_source.validator_for(name).valid_options.to_a if validator? + validator_source.validator_for(name).valid_options.to_a if validator? end def selection_options(validator_source) diff --git a/app/models/bait_library.rb b/app/models/bait_library.rb index 4e5088925f..08f7bef649 100644 --- a/app/models/bait_library.rb +++ b/app/models/bait_library.rb @@ -7,7 +7,7 @@ class BaitLibrary < ApplicationRecord include SharedBehaviour::Named - module Associations # rubocop:todo Style/Documentation + module Associations def self.included(base) base.class_eval { belongs_to :bait_library } end diff --git a/app/models/bait_library_layout.rb b/app/models/bait_library_layout.rb index d2049bd371..05f71c15b8 100644 --- a/app/models/bait_library_layout.rb +++ b/app/models/bait_library_layout.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class BaitLibraryLayout < ApplicationRecord # rubocop:todo Style/Documentation +class BaitLibraryLayout < ApplicationRecord include Uuid::Uuidable include ModelExtensions::BaitLibraryLayout diff --git a/app/models/batch/pipeline_behaviour.rb b/app/models/batch/pipeline_behaviour.rb index 8e1a47f269..698439a4c2 100644 --- a/app/models/batch/pipeline_behaviour.rb +++ b/app/models/batch/pipeline_behaviour.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Batch::PipelineBehaviour # rubocop:todo Style/Documentation +module Batch::PipelineBehaviour def self.included(base) base.class_eval do # The associations with the pipeline diff --git a/app/models/batch/request_behaviour.rb b/app/models/batch/request_behaviour.rb index 4268f7fd29..e1ce2152a1 100644 --- a/app/models/batch/request_behaviour.rb +++ b/app/models/batch/request_behaviour.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Batch::RequestBehaviour # rubocop:todo Style/Documentation +module Batch::RequestBehaviour def self.included(base) # rubocop:todo Metrics/MethodLength base.class_eval do has_one :batch_request, inverse_of: :request, dependent: :destroy diff --git a/app/models/batch/request_fail_and_remover.rb b/app/models/batch/request_fail_and_remover.rb index ee80a926eb..ea56fd5e71 100644 --- a/app/models/batch/request_fail_and_remover.rb +++ b/app/models/batch/request_fail_and_remover.rb @@ -95,7 +95,7 @@ def clashing_requests end def requests_selected? - return if requested_remove.present? || requested_fail.present? + return false if requested_remove.present? || requested_fail.present? errors.add(:base, 'Please select an item to fail or remove') end diff --git a/app/models/batch/state_machine_behaviour.rb b/app/models/batch/state_machine_behaviour.rb index 8f56eafbd7..c37e35caa9 100644 --- a/app/models/batch/state_machine_behaviour.rb +++ b/app/models/batch/state_machine_behaviour.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true require 'aasm' -module Batch::StateMachineBehaviour # rubocop:todo Style/Documentation +module Batch::StateMachineBehaviour def self.included(base) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength base.class_eval do include AASM diff --git a/app/models/broadcast_event/asset_audit.rb b/app/models/broadcast_event/asset_audit.rb index 8809a3afa8..421e44fe89 100644 --- a/app/models/broadcast_event/asset_audit.rb +++ b/app/models/broadcast_event/asset_audit.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class BroadcastEvent::AssetAudit < BroadcastEvent # rubocop:todo Style/Documentation +class BroadcastEvent::AssetAudit < BroadcastEvent seed_class AssetAudit def event_type diff --git a/app/models/broadcast_event/labware_received.rb b/app/models/broadcast_event/labware_received.rb index 8b0c7bf254..d1a5a81769 100644 --- a/app/models/broadcast_event/labware_received.rb +++ b/app/models/broadcast_event/labware_received.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class BroadcastEvent::LabwareReceived < BroadcastEvent # rubocop:todo Style/Documentation +class BroadcastEvent::LabwareReceived < BroadcastEvent set_event_type 'labware.received' seed_class Asset diff --git a/app/models/broadcast_event/library_start.rb b/app/models/broadcast_event/library_start.rb index 453956a2a5..cca15d1c33 100644 --- a/app/models/broadcast_event/library_start.rb +++ b/app/models/broadcast_event/library_start.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class BroadcastEvent::LibraryStart < BroadcastEvent # rubocop:todo Style/Documentation +class BroadcastEvent::LibraryStart < BroadcastEvent set_event_type 'library_start' # Properties takes :order_id diff --git a/app/models/broadcast_event/metadata_helpers.rb b/app/models/broadcast_event/metadata_helpers.rb index c142fab936..9361fce654 100644 --- a/app/models/broadcast_event/metadata_helpers.rb +++ b/app/models/broadcast_event/metadata_helpers.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module BroadcastEvent::MetadataHelpers - class SimpleMetadataFinder # rubocop:todo Style/Documentation + class SimpleMetadataFinder attr_reader :name, :method def initialize(name, method) @@ -13,7 +13,7 @@ def for(seed, _event) end end - class BlockMetadataFinder # rubocop:todo Style/Documentation + class BlockMetadataFinder attr_reader :name, :block def initialize(name, &block) @@ -26,7 +26,7 @@ def for(seed, event) end end - module MetadatableClassMethods # rubocop:todo Style/Documentation + module MetadatableClassMethods def has_metadata(key, method = nil, &block) return metadata_finders << SimpleMetadataFinder.new(key, method) unless method.nil? return metadata_finders << BlockMetadataFinder.new(key, &block) unless block.nil? diff --git a/app/models/broadcast_event/order_made.rb b/app/models/broadcast_event/order_made.rb index 86b4d36e8a..cfe70e4176 100644 --- a/app/models/broadcast_event/order_made.rb +++ b/app/models/broadcast_event/order_made.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class BroadcastEvent::OrderMade < BroadcastEvent # rubocop:todo Style/Documentation +class BroadcastEvent::OrderMade < BroadcastEvent set_event_type 'order_made' # Properties takes :order_id diff --git a/app/models/broadcast_event/render_helpers.rb b/app/models/broadcast_event/render_helpers.rb index c7ed2a5b7b..621cd18522 100644 --- a/app/models/broadcast_event/render_helpers.rb +++ b/app/models/broadcast_event/render_helpers.rb @@ -14,7 +14,7 @@ def self.to_hash(event) end end - module RenderableClassMethods # rubocop:todo Style/Documentation + module RenderableClassMethods def render_class Render end diff --git a/app/models/broadcast_event/sample_manifest_updated.rb b/app/models/broadcast_event/sample_manifest_updated.rb index f4cb39731b..6e4f044199 100644 --- a/app/models/broadcast_event/sample_manifest_updated.rb +++ b/app/models/broadcast_event/sample_manifest_updated.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class BroadcastEvent::SampleManifestUpdated < BroadcastEvent # rubocop:todo Style/Documentation +class BroadcastEvent::SampleManifestUpdated < BroadcastEvent set_event_type 'sample_manifest.updated' # Properties takes :updated_samples_ids diff --git a/app/models/broadcast_event/sequencing_start.rb b/app/models/broadcast_event/sequencing_start.rb index 4f8fc11907..2b5248b73e 100644 --- a/app/models/broadcast_event/sequencing_start.rb +++ b/app/models/broadcast_event/sequencing_start.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class BroadcastEvent::SequencingStart < BroadcastEvent # rubocop:todo Style/Documentation +class BroadcastEvent::SequencingStart < BroadcastEvent set_event_type 'sequencing_start' seed_class Batch diff --git a/app/models/broadcast_event/subject_helpers.rb b/app/models/broadcast_event/subject_helpers.rb index 8ff9f15958..f86459841c 100644 --- a/app/models/broadcast_event/subject_helpers.rb +++ b/app/models/broadcast_event/subject_helpers.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module BroadcastEvent::SubjectHelpers - class Subject # rubocop:todo Style/Documentation + class Subject attr_reader :target, :role_type def initialize(name, target) @@ -23,7 +23,7 @@ def broadcastable? delegate :friendly_name, :uuid, :subject_type, to: :target, allow_nil: true end - module SimpleTargetLookup # rubocop:todo Style/Documentation + module SimpleTargetLookup def initialize(name, method) @name = name @method = method @@ -38,7 +38,7 @@ def self.included(base) end end - module BlockTargetLookup # rubocop:todo Style/Documentation + module BlockTargetLookup def initialize(name, &block) @name = name @block = block @@ -53,19 +53,19 @@ def self.included(base) end end - module SingleTarget # rubocop:todo Style/Documentation + module SingleTarget def for(seed, event) Subject.new(name, target_for(seed, event)) end end - module MultiTarget # rubocop:todo Style/Documentation + module MultiTarget def for(seed, event) target_for(seed, event).map { |t| Subject.new(name, t) } end end - class SeedSubjectAssociation # rubocop:todo Style/Documentation + class SeedSubjectAssociation attr_reader :name def initialize(name) @@ -97,7 +97,7 @@ class BlockManySubjectAssociation include MultiTarget end - module SubjectableClassMethods # rubocop:todo Style/Documentation + module SubjectableClassMethods # The class expected to seed the messenger def seed_class(seed_class) @seed_class = seed_class @@ -130,7 +130,7 @@ def subject_associations end end - module Subjectable # rubocop:todo Style/Documentation + module Subjectable def self.included(base) base.class.extend SubjectableClassMethods end diff --git a/app/models/budget_division.rb b/app/models/budget_division.rb index 8d2e858be1..c66761e412 100644 --- a/app/models/budget_division.rb +++ b/app/models/budget_division.rb @@ -13,7 +13,7 @@ def self.unallocated validates :name, presence: true validates :name, uniqueness: { message: 'of budget division already present in database', case_sensitive: false } - module Associations # rubocop:todo Style/Documentation + module Associations def self.included(base) base.belongs_to :budget_division, optional: false end diff --git a/app/models/cherrypick/task/pick_by_micro_litre.rb b/app/models/cherrypick/task/pick_by_micro_litre.rb index c1664d9606..1c1555c1c1 100644 --- a/app/models/cherrypick/task/pick_by_micro_litre.rb +++ b/app/models/cherrypick/task/pick_by_micro_litre.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Cherrypick::Task::PickByMicroLitre # rubocop:todo Style/Documentation +module Cherrypick::Task::PickByMicroLitre def valid_params_for_micro_litre_pick?(options) valid_float_param?(options[:volume_required]) end diff --git a/app/models/cherrypick/task/pick_by_nano_grams.rb b/app/models/cherrypick/task/pick_by_nano_grams.rb index 3c027da883..b13cd6a116 100644 --- a/app/models/cherrypick/task/pick_by_nano_grams.rb +++ b/app/models/cherrypick/task/pick_by_nano_grams.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Cherrypick::Task::PickByNanoGrams # rubocop:todo Style/Documentation +module Cherrypick::Task::PickByNanoGrams def valid_params_for_nano_grams_pick?(options) [options[:minimum_volume], options[:maximum_volume], options[:total_nano_grams]].all?( &method(:valid_float_param?) diff --git a/app/models/cherrypick/task/pick_by_nano_grams_per_micro_litre.rb b/app/models/cherrypick/task/pick_by_nano_grams_per_micro_litre.rb index e9e10bde2a..444f9ddb59 100644 --- a/app/models/cherrypick/task/pick_by_nano_grams_per_micro_litre.rb +++ b/app/models/cherrypick/task/pick_by_nano_grams_per_micro_litre.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Cherrypick::Task::PickByNanoGramsPerMicroLitre # rubocop:todo Style/Documentation +module Cherrypick::Task::PickByNanoGramsPerMicroLitre def valid_params_for_nano_grams_per_micro_litre_pick?(options) [options[:volume_required], options[:concentration_required]].all?(&method(:valid_float_param?)) end diff --git a/app/models/cherrypick/task/pick_helpers.rb b/app/models/cherrypick/task/pick_helpers.rb index d9a3bfc479..a1ff1891f4 100644 --- a/app/models/cherrypick/task/pick_helpers.rb +++ b/app/models/cherrypick/task/pick_helpers.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Cherrypick::Task::PickHelpers # rubocop:todo Style/Documentation +module Cherrypick::Task::PickHelpers def self.included(base) base.class_eval do include Cherrypick::Task::PickByNanoGramsPerMicroLitre diff --git a/app/models/cherrypick/volume_by_micro_litre.rb b/app/models/cherrypick/volume_by_micro_litre.rb index 55ff3abe08..73c90a67d8 100644 --- a/app/models/cherrypick/volume_by_micro_litre.rb +++ b/app/models/cherrypick/volume_by_micro_litre.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Cherrypick::VolumeByMicroLitre # rubocop:todo Style/Documentation +module Cherrypick::VolumeByMicroLitre # rubocop:todo Metrics/AbcSize def volume_to_cherrypick_by_micro_litre(volume_required, robot_minimum_picking_volume = 0.0) robot_minimum_picking_volume ||= 0.0 diff --git a/app/models/cherrypick/volume_by_nano_grams.rb b/app/models/cherrypick/volume_by_nano_grams.rb index 9521f0d72c..3085d31f91 100644 --- a/app/models/cherrypick/volume_by_nano_grams.rb +++ b/app/models/cherrypick/volume_by_nano_grams.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Cherrypick::VolumeByNanoGrams # rubocop:todo Style/Documentation +module Cherrypick::VolumeByNanoGrams # rubocop:todo Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity def check_inputs_to_volume_to_cherrypick_by_nano_grams!(minimum_volume, maximum_volume, target_ng, source_well) raise 'Source well not found' if source_well.nil? diff --git a/app/models/custom_metadatum.rb b/app/models/custom_metadatum.rb index 94ad18011e..df2841ae99 100644 --- a/app/models/custom_metadatum.rb +++ b/app/models/custom_metadatum.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class CustomMetadatum < ApplicationRecord # rubocop:todo Style/Documentation +class CustomMetadatum < ApplicationRecord belongs_to :custom_metadatum_collection validates :value, presence: true diff --git a/app/models/custom_metadatum_collection.rb b/app/models/custom_metadatum_collection.rb index f077b7fc82..6b33de76d2 100644 --- a/app/models/custom_metadatum_collection.rb +++ b/app/models/custom_metadatum_collection.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class CustomMetadatumCollection < ApplicationRecord # rubocop:todo Style/Documentation +class CustomMetadatumCollection < ApplicationRecord include Uuid::Uuidable belongs_to :user diff --git a/app/models/data_release.rb b/app/models/data_release.rb index 14c4f8bfb4..242c9e8f56 100644 --- a/app/models/data_release.rb +++ b/app/models/data_release.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module DataRelease # rubocop:todo Style/Documentation +module DataRelease # TODO[xxx]: All of this probably falls into the Study::Metadata class def valid_data_release_properties? diff --git a/app/models/data_release_study_type.rb b/app/models/data_release_study_type.rb index 22457d3e73..3cbae22c24 100644 --- a/app/models/data_release_study_type.rb +++ b/app/models/data_release_study_type.rb @@ -49,7 +49,7 @@ def self.default find_by(is_default: true) end - module Associations # rubocop:todo Style/Documentation + module Associations def self.included(base) base.validates_presence_of :data_release_study_type_id base.belongs_to :data_release_study_type diff --git a/app/models/db_file.rb b/app/models/db_file.rb index fd7784aa99..7480275318 100644 --- a/app/models/db_file.rb +++ b/app/models/db_file.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class DbFile < ApplicationRecord # rubocop:todo Style/Documentation +class DbFile < ApplicationRecord # This is the model for database storage # Polymorphic so that many models can use this class to store binary data @@ -10,7 +10,7 @@ class DbFile < ApplicationRecord # rubocop:todo Style/Documentation # This module will set up all required associations and allow mounting "polymorphic uploaders" module Uploader def self.extended(base) - base.has_many :db_files, as: :owner, dependent: :destroy # rubocop:todo Rails/HasManyOrHasOneDependent + base.has_many :db_files, as: :owner, dependent: :destroy end # Mount an uploader on the specified 'data' column diff --git a/app/models/delegate_validation.rb b/app/models/delegate_validation.rb index 4fda01baee..5a59a453b3 100644 --- a/app/models/delegate_validation.rb +++ b/app/models/delegate_validation.rb @@ -25,10 +25,10 @@ def delegate_validation(*args) # rubocop:todo Metrics/AbcSize # rubocop:enable Metrics/MethodLength - class Validator # rubocop:todo Style/Documentation + class Validator include Validateable - class DelegateError < ActiveModel::Errors # rubocop:todo Style/Documentation + class DelegateError < ActiveModel::Errors def initialize(base, target) @base = base @messages = target.errors.messages diff --git a/app/models/descriptor.rb b/app/models/descriptor.rb index 76555a7e16..f12a53295c 100644 --- a/app/models/descriptor.rb +++ b/app/models/descriptor.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Descriptor < ApplicationRecord # rubocop:todo Style/Documentation +class Descriptor < ApplicationRecord belongs_to :task serialize :selection diff --git a/app/models/document.rb b/app/models/document.rb index 4534711d01..9ac677a444 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true require 'carrierwave' -class Document < ApplicationRecord # rubocop:todo Style/Documentation +class Document < ApplicationRecord extend DbFile::Uploader - module Associations # rubocop:todo Style/Documentation + module Associations # Adds accessors for named fields and attaches documents to them def has_uploaded_document(field, differentiator: field.to_s) # rubocop:todo Metrics/MethodLength diff --git a/app/models/ega_accession_service.rb b/app/models/ega_accession_service.rb index 1b21268bcd..8df3ef544e 100644 --- a/app/models/ega_accession_service.rb +++ b/app/models/ega_accession_service.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class EgaAccessionService < AccessionService # rubocop:todo Style/Documentation +class EgaAccessionService < AccessionService self.priority = 2 self.operational = true diff --git a/app/models/ena_accession_service.rb b/app/models/ena_accession_service.rb index 3b564773e5..d02faf13a9 100644 --- a/app/models/ena_accession_service.rb +++ b/app/models/ena_accession_service.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class EnaAccessionService < AccessionService # rubocop:todo Style/Documentation +class EnaAccessionService < AccessionService self.priority = 1 self.operational = true diff --git a/app/models/event.rb b/app/models/event.rb index 5d0d1d4b48..d74b13f1bf 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Event < ApplicationRecord # rubocop:todo Style/Documentation +class Event < ApplicationRecord include Uuid::Uuidable self.per_page = 500 diff --git a/app/models/event/asset_set_qc_state_event.rb b/app/models/event/asset_set_qc_state_event.rb index 5886aca535..39557c0e1f 100644 --- a/app/models/event/asset_set_qc_state_event.rb +++ b/app/models/event/asset_set_qc_state_event.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Event::AssetSetQcStateEvent < Event # rubocop:todo Style/Documentation +class Event::AssetSetQcStateEvent < Event class << self def create_updated!(asset, reason) create!(eventful: asset, family: 'update', content: reason, message: reason) diff --git a/app/models/event/plate_creation_event.rb b/app/models/event/plate_creation_event.rb index 0be4afed97..3dd28174ff 100644 --- a/app/models/event/plate_creation_event.rb +++ b/app/models/event/plate_creation_event.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Event::PlateCreationEvent < Event # rubocop:todo Style/Documentation +class Event::PlateCreationEvent < Event def self.create_for_asset!(asset, plate_purpose, child_plate, user) create!( eventful: asset, diff --git a/app/models/event/plate_events.rb b/app/models/event/plate_events.rb index 9d65211663..3a9e14d9cb 100644 --- a/app/models/event/plate_events.rb +++ b/app/models/event/plate_events.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Event::PlateEvents # rubocop:todo Style/Documentation +module Event::PlateEvents def gel_qc_date event_date('gel_analysed') end diff --git a/app/models/event/request_descriptor_update_event.rb b/app/models/event/request_descriptor_update_event.rb index 75177741fa..e4428e4cdc 100644 --- a/app/models/event/request_descriptor_update_event.rb +++ b/app/models/event/request_descriptor_update_event.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Event::RequestDescriptorUpdateEvent # rubocop:todo Style/Documentation +module Event::RequestDescriptorUpdateEvent def self.included(base) base.after_create( :update_metadata_for_request, diff --git a/app/models/event/sample_logistics_qc_event.rb b/app/models/event/sample_logistics_qc_event.rb index 8075c0a693..be42944271 100644 --- a/app/models/event/sample_logistics_qc_event.rb +++ b/app/models/event/sample_logistics_qc_event.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Event::SampleLogisticsQcEvent < Event # rubocop:todo Style/Documentation +class Event::SampleLogisticsQcEvent < Event def self.create_gel_qc_for_asset!(asset, result, user) case asset when Well diff --git a/app/models/event/sample_manifest_event.rb b/app/models/event/sample_manifest_event.rb index c43f67ba12..a4be994a55 100644 --- a/app/models/event/sample_manifest_event.rb +++ b/app/models/event/sample_manifest_event.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Event::SampleManifestEvent < Event # rubocop:todo Style/Documentation +class Event::SampleManifestEvent < Event def self.created_sample!(sample, user) create!( eventful: sample, diff --git a/app/models/event/scanned_into_lab_event.rb b/app/models/event/scanned_into_lab_event.rb index 1579dc1eb9..d37c26e5ed 100644 --- a/app/models/event/scanned_into_lab_event.rb +++ b/app/models/event/scanned_into_lab_event.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Event::ScannedIntoLabEvent < Event # rubocop:todo Style/Documentation +class Event::ScannedIntoLabEvent < Event after_create :set_qc_state_pending, if: :qc_state_not_final? alias asset eventful diff --git a/app/models/event_sender.rb b/app/models/event_sender.rb index 173821c33a..1ff68d4d28 100644 --- a/app/models/event_sender.rb +++ b/app/models/event_sender.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class EventSender # rubocop:todo Style/Documentation +class EventSender def self.send_fail_event(request, reason, comment, batch_id) send_state_event('fail', request, reason, comment, batch_id) end diff --git a/app/models/extended_validator.rb b/app/models/extended_validator.rb index 85a580a0ad..2192b3f6a2 100644 --- a/app/models/extended_validator.rb +++ b/app/models/extended_validator.rb @@ -7,8 +7,8 @@ # behaviour => the module that will be included in the validator, must respond to validate(submission) # options => serialized hash for configuration -class ExtendedValidator < ApplicationRecord # rubocop:todo Style/Documentation - class RequestTypeExtendedValidator < ApplicationRecord # rubocop:todo Style/Documentation +class ExtendedValidator < ApplicationRecord + class RequestTypeExtendedValidator < ApplicationRecord self.table_name = ('request_types_extended_validators') belongs_to :extended_validator diff --git a/app/models/extended_validator/species_validator.rb b/app/models/extended_validator/species_validator.rb index 6c862832c1..40ede8c849 100644 --- a/app/models/extended_validator/species_validator.rb +++ b/app/models/extended_validator/species_validator.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module ExtendedValidator::SpeciesValidator # rubocop:todo Style/Documentation +module ExtendedValidator::SpeciesValidator def validate_order(order) bad_samples = order.all_samples.select { |s| s.sample_metadata.sample_taxon_id != options[:taxon_id] } return true if bad_samples.empty? diff --git a/app/models/external_release_event.rb b/app/models/external_release_event.rb index b1e3110dbd..22d3c2865b 100644 --- a/app/models/external_release_event.rb +++ b/app/models/external_release_event.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true require 'eventful_mailer' -class ExternalReleaseEvent < Event # rubocop:todo Style/Documentation +class ExternalReleaseEvent < Event after_create :physically_send_email, if: :send_email attr_accessor :send_email diff --git a/app/models/extraction_attribute.rb b/app/models/extraction_attribute.rb index c45941e318..aee7f2ed08 100644 --- a/app/models/extraction_attribute.rb +++ b/app/models/extraction_attribute.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class ExtractionAttribute < ApplicationRecord # rubocop:todo Style/Documentation +class ExtractionAttribute < ApplicationRecord include Uuid::Uuidable validates :created_by, presence: true diff --git a/app/models/faculty_sponsor.rb b/app/models/faculty_sponsor.rb index 33d8767772..ee0e7f2b0c 100644 --- a/app/models/faculty_sponsor.rb +++ b/app/models/faculty_sponsor.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class FacultySponsor < ApplicationRecord # rubocop:todo Style/Documentation +class FacultySponsor < ApplicationRecord include SharedBehaviour::Named extend Attributable::Association::Target @@ -19,7 +19,7 @@ def count_studies studies.count end - module Associations # rubocop:todo Style/Documentation + module Associations def self.included(base) base.validates_presence_of :faculty_sponsor base.belongs_to :faculty_sponsor diff --git a/app/models/failure.rb b/app/models/failure.rb index 39bd1d70af..281c21d7ad 100644 --- a/app/models/failure.rb +++ b/app/models/failure.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Failure < ApplicationRecord # rubocop:todo Style/Documentation +class Failure < ApplicationRecord belongs_to :failable, polymorphic: true after_create :notify_remote diff --git a/app/models/fluidigm_file.rb b/app/models/fluidigm_file.rb index 1a55a8c1da..cdedfdffe0 100644 --- a/app/models/fluidigm_file.rb +++ b/app/models/fluidigm_file.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -class FluidigmFile # rubocop:todo Style/Documentation - module Finder # rubocop:todo Style/Documentation - class Directory # rubocop:todo Style/Documentation +class FluidigmFile + module Finder + class Directory def initialize(barcode) @barcode = barcode end @@ -31,7 +31,7 @@ def self.find(barcode) class InvalidFile < StandardError end - class Assay # rubocop:todo Style/Documentation + class Assay attr_reader :name, :result @@valid_markers = %w[XX XY YY] @@ -55,7 +55,7 @@ def pass? end end - class FluidigmWell # rubocop:todo Style/Documentation + class FluidigmWell attr_reader :description def initialize(description) diff --git a/app/models/fluidigm_template_task.rb b/app/models/fluidigm_template_task.rb index 62f39c6a78..6acc7c85d5 100644 --- a/app/models/fluidigm_template_task.rb +++ b/app/models/fluidigm_template_task.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class FluidigmTemplateTask < PlateTemplateTask # rubocop:todo Style/Documentation +class FluidigmTemplateTask < PlateTemplateTask def partial 'fluidigm_template_batches' end diff --git a/app/models/health.rb b/app/models/health.rb index 30a2e4fedc..da13cbf64c 100644 --- a/app/models/health.rb +++ b/app/models/health.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Health # rubocop:todo Style/Documentation +class Health attr_reader :status, :message, :details def initialize diff --git a/app/models/illumina_c/requests.rb b/app/models/illumina_c/requests.rb index 5b4af03087..520f954c8a 100644 --- a/app/models/illumina_c/requests.rb +++ b/app/models/illumina_c/requests.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module IlluminaC::Requests - class LibraryRequest < Request::LibraryCreation # rubocop:todo Style/Documentation + class LibraryRequest < Request::LibraryCreation def role "#{request_metadata.library_type} #{super}" end diff --git a/app/models/labwhere_reception.rb b/app/models/labwhere_reception.rb index 0caa43c0cb..cae94ef26f 100644 --- a/app/models/labwhere_reception.rb +++ b/app/models/labwhere_reception.rb @@ -84,8 +84,8 @@ def assets end def missing_barcodes - machine_barcodes = assets.map(&:machine_barcode).to_set - human_barcodes = assets.map(&:human_barcode).to_set + machine_barcodes = assets.to_set(&:machine_barcode) + human_barcodes = assets.to_set(&:human_barcode) asset_barcodes.delete_if { |barcode| human_barcodes.include?(barcode) || machine_barcodes.include?(barcode) } end end diff --git a/app/models/lib_pool_norm_tube_generator.rb b/app/models/lib_pool_norm_tube_generator.rb index 0a77faba87..83dfb442db 100644 --- a/app/models/lib_pool_norm_tube_generator.rb +++ b/app/models/lib_pool_norm_tube_generator.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class LibPoolNormTubeGenerator # rubocop:todo Style/Documentation +class LibPoolNormTubeGenerator include ActiveModel::Validations attr_accessor :plate diff --git a/app/models/library_tube.rb b/app/models/library_tube.rb index acafbcc758..13b0b87a7a 100644 --- a/app/models/library_tube.rb +++ b/app/models/library_tube.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require_dependency 'tube/purpose' -class LibraryTube < Tube # rubocop:todo Style/Documentation +class LibraryTube < Tube include Api::LibraryTubeIO::Extensions include ModelExtensions::LibraryTube include Asset::SharedLibraryTubeBehaviour diff --git a/app/models/location_report.rb b/app/models/location_report.rb index 7b27a1ed15..a4b44d90e4 100644 --- a/app/models/location_report.rb +++ b/app/models/location_report.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # rubocop:todo Metrics/ClassLength -class LocationReport < ApplicationRecord # rubocop:todo Style/Documentation +class LocationReport < ApplicationRecord # includes / extends extend DbFile::Uploader diff --git a/app/models/lot.rb b/app/models/lot.rb index 5c0581cb5a..fc4309151a 100644 --- a/app/models/lot.rb +++ b/app/models/lot.rb @@ -3,8 +3,8 @@ # A lot represents a received batch of consumables (eg. tag plates) # that can be assumed to share some level of QC. -class Lot < ApplicationRecord # rubocop:todo Style/Documentation - module Template # rubocop:todo Style/Documentation +class Lot < ApplicationRecord + module Template def self.included(base) base.class_eval { belongs_to :lot } end diff --git a/app/models/map.rb b/app/models/map.rb index 89b8025885..307f35a542 100644 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -127,7 +127,7 @@ def alternate_position(well_position, size, *dimensions) end end - module Sequential # rubocop:todo Style/Documentation + module Sequential def self.location_from_row_and_column(row, column, width, size) digit_count = Math.log10(size + 1).ceil "S%0#{digit_count}d" % [((row) * width) + column] diff --git a/app/models/messenger_creator.rb b/app/models/messenger_creator.rb index a3d2d3f7f7..2c279fb5c2 100644 --- a/app/models/messenger_creator.rb +++ b/app/models/messenger_creator.rb @@ -5,7 +5,7 @@ # 1. Cherrypick batch release # They specify both a template (under Api::Messages) and a root class MessengerCreator < ApplicationRecord - class SelfFinder # rubocop:todo Style/Documentation + class SelfFinder def initialize(base) @base = base end @@ -15,7 +15,7 @@ def each_target end end - class WellFinder # rubocop:todo Style/Documentation + class WellFinder def initialize(base) @base = base end diff --git a/app/models/metadata.rb b/app/models/metadata.rb index e89a34eb1f..aa925c3289 100644 --- a/app/models/metadata.rb +++ b/app/models/metadata.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require_dependency 'attributable' -module Metadata # rubocop:todo Style/Documentation +module Metadata # @!macro [attach] has_metadata # @!parse class Metadata < Metadata::Base; end def has_metadata(options = {}, &block) @@ -30,7 +30,7 @@ def build_association(as_class, options) # rubocop:todo Metrics/MethodLength inverse_of: :owner, foreign_key: "#{as_name}_id" } - has_one association_name, default_options.merge(options) # rubocop:todo Rails/HasManyOrHasOneDependent + has_one association_name, **default_options.merge(options) # rubocop:todo Rails/HasManyOrHasOneDependent accepts_nested_attributes_for(association_name, update_only: true) unless respond_to?(:"include_#{association_name}") @@ -73,7 +73,7 @@ def include_tag(tag, options = Hash.new) tags << AccessionedTag.new(tag, options[:as], options[:services], options[:downcase]) end - class AccessionedTag # rubocop:todo Style/Documentation + class AccessionedTag attr_reader :tag, :name, :downcase def initialize(tag, as = nil, services = [], downcase = false) @@ -110,7 +110,7 @@ def construct_metadata_class(table_name, as_class, &block) const_set(:Metadata, metadata) end - class Base < ApplicationRecord # rubocop:todo Style/Documentation + class Base < ApplicationRecord # All derived classes have their own table. We're just here to help with some behaviour self.abstract_class = true diff --git a/app/models/metadata/builder_base.rb b/app/models/metadata/builder_base.rb index 7a7f9fc20b..bc91d984ea 100644 --- a/app/models/metadata/builder_base.rb +++ b/app/models/metadata/builder_base.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Metadata::BuilderBase < ActionView::Helpers::FormBuilder # rubocop:todo Style/Documentation +class Metadata::BuilderBase < ActionView::Helpers::FormBuilder attr_writer :locals def initialize(*args, &block) diff --git a/app/models/metadata/form_builder.rb b/app/models/metadata/form_builder.rb index 16fb38a9c4..c2a36e4bdc 100644 --- a/app/models/metadata/form_builder.rb +++ b/app/models/metadata/form_builder.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Metadata::FormBuilder < Metadata::BuilderBase # rubocop:todo Style/Documentation +class Metadata::FormBuilder < Metadata::BuilderBase def initialize(*args, &block) super view_for(:field, 'shared/metadata/edit_field') @@ -152,6 +152,6 @@ def property_field(type, field, options = {}) div_options = { id: field.to_s } div_options[:class] = 'field_with_errors' if @object.errors[field].present? - tag.fieldset(content, div_options) + tag.fieldset(content, **div_options) end end diff --git a/app/models/metadata/view_builder.rb b/app/models/metadata/view_builder.rb index f62d1f2e09..e9b5861ff8 100644 --- a/app/models/metadata/view_builder.rb +++ b/app/models/metadata/view_builder.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Metadata::ViewBuilder < Metadata::BuilderBase # rubocop:todo Style/Documentation +class Metadata::ViewBuilder < Metadata::BuilderBase def initialize(*args, &block) super view_for(:plain_value, 'shared/metadata/plain_field') diff --git a/app/models/mi_seq_sequencing_request.rb b/app/models/mi_seq_sequencing_request.rb index 785ed844f4..c5df816e22 100644 --- a/app/models/mi_seq_sequencing_request.rb +++ b/app/models/mi_seq_sequencing_request.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true -class MiSeqSequencingRequest < SequencingRequest # rubocop:todo Style/Documentation +class MiSeqSequencingRequest < SequencingRequest self.flowcell_identifier = 'Cartridge barcode' end diff --git a/app/models/multiplexed_library_tube.rb b/app/models/multiplexed_library_tube.rb index 0edff94ebe..ef76e44510 100644 --- a/app/models/multiplexed_library_tube.rb +++ b/app/models/multiplexed_library_tube.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require_dependency 'tube/purpose' -class MultiplexedLibraryTube < Tube # rubocop:todo Style/Documentation +class MultiplexedLibraryTube < Tube include ModelExtensions::MultiplexedLibraryTube include Api::MultiplexedLibraryTubeIO::Extensions include Asset::SharedLibraryTubeBehaviour diff --git a/app/models/no_accession_service.rb b/app/models/no_accession_service.rb index ff1690cb9f..46ec51b1fb 100644 --- a/app/models/no_accession_service.rb +++ b/app/models/no_accession_service.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class NoAccessionService < AccessionService # rubocop:todo Style/Documentation +class NoAccessionService < AccessionService self.no_study_accession_needed = true def initialize(study) diff --git a/app/models/null_custom_metadatum_collection.rb b/app/models/null_custom_metadatum_collection.rb index c0410a0b0d..dd4a62b043 100644 --- a/app/models/null_custom_metadatum_collection.rb +++ b/app/models/null_custom_metadatum_collection.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class NullCustomMetadatumCollection # rubocop:todo Style/Documentation +class NullCustomMetadatumCollection def metadata {} end diff --git a/app/models/pac_bio/worksheet.rb b/app/models/pac_bio/worksheet.rb index 19bbfb39ae..1f159222a5 100644 --- a/app/models/pac_bio/worksheet.rb +++ b/app/models/pac_bio/worksheet.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class PacBio::Worksheet # rubocop:todo Style/Documentation +class PacBio::Worksheet def create_csv_from_batch(batch) csv_string = CSV.generate(row_sep: "\r\n") do |csv| diff --git a/app/models/pac_bio_sample_prep_request.rb b/app/models/pac_bio_sample_prep_request.rb index bfc50c3ef2..b8d50d4971 100644 --- a/app/models/pac_bio_sample_prep_request.rb +++ b/app/models/pac_bio_sample_prep_request.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class PacBioSamplePrepRequest < CustomerRequest # rubocop:todo Style/Documentation +class PacBioSamplePrepRequest < CustomerRequest delegate :pac_bio_library_tube_metadata, to: :target_tube, allow_nil: true delegate :movie_length, to: :pac_bio_library_tube_metadata, allow_nil: true diff --git a/app/models/pac_bio_sequencing_request.rb b/app/models/pac_bio_sequencing_request.rb index ae526706d7..35c2a5a93d 100644 --- a/app/models/pac_bio_sequencing_request.rb +++ b/app/models/pac_bio_sequencing_request.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class PacBioSequencingRequest < CustomerRequest # rubocop:todo Style/Documentation +class PacBioSequencingRequest < CustomerRequest self.sequencing = true delegate :pac_bio_library_tube_metadata, to: :source_tube, allow_nil: true diff --git a/app/models/parsers.rb b/app/models/parsers.rb index 55d6f3432f..0c9ba40335 100644 --- a/app/models/parsers.rb +++ b/app/models/parsers.rb @@ -2,7 +2,7 @@ require 'csv' require 'linefeed_fix' -module Parsers # rubocop:todo Style/Documentation +module Parsers ENCODINGS = %w[Windows-1252 iso-8859-1 utf-8 utf-16].freeze PARSERS = [QuantParser, BioanalysisCsvParser, PlateReaderParser, CardinalPbmcCountParser].freeze @@ -15,7 +15,7 @@ def self.parser_for(filename, content_type, content) cleaned_content = LinefeedFix.scrub!(content.dup) csv = parse_with_fallback_encodings(cleaned_content) parser_class = PARSERS.detect { |parser| parser.parses?(csv) } - parser_class ? parser_class.new(csv) : nil + parser_class&.new(csv) end def self.parse_with_fallback_encodings(content) diff --git a/app/models/parsers/bioanalysis_csv_parser.rb b/app/models/parsers/bioanalysis_csv_parser.rb index 543827ca27..7c96c0143a 100644 --- a/app/models/parsers/bioanalysis_csv_parser.rb +++ b/app/models/parsers/bioanalysis_csv_parser.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Parsers::BioanalysisCsvParser # rubocop:todo Style/Documentation, Metrics/ClassLength +class Parsers::BioanalysisCsvParser # rubocop:todo Metrics/ClassLength class InvalidFile < StandardError end diff --git a/app/models/parsers/plate_reader_parser.rb b/app/models/parsers/plate_reader_parser.rb index f6cff0ab45..8fa3cbe741 100644 --- a/app/models/parsers/plate_reader_parser.rb +++ b/app/models/parsers/plate_reader_parser.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Parsers::PlateReaderParser # rubocop:todo Style/Documentation +class Parsers::PlateReaderParser class InvalidFile < StandardError end diff --git a/app/models/parsers/quant_parser.rb b/app/models/parsers/quant_parser.rb index 33bd38307d..c09627659c 100644 --- a/app/models/parsers/quant_parser.rb +++ b/app/models/parsers/quant_parser.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Parsers::QuantParser # rubocop:todo Style/Documentation +class Parsers::QuantParser class InvalidFile < StandardError end @@ -21,7 +21,7 @@ class InvalidFile < StandardError # (45.2) => 45.2 # sausages => nil # 34 ng/ul => 35 - VALUE_REGEX = /\A\({0,1}(?\d+\.{0,1}\d*)/.freeze + VALUE_REGEX = /\A\({0,1}(?\d+\.{0,1}\d*)/ class_attribute :assay_type, :assay_version diff --git a/app/models/pipeline/batch_validation.rb b/app/models/pipeline/batch_validation.rb index f750b1fd6a..9b2b83cfce 100644 --- a/app/models/pipeline/batch_validation.rb +++ b/app/models/pipeline/batch_validation.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Pipeline::BatchValidation # rubocop:todo Style/Documentation +module Pipeline::BatchValidation def validation_of_batch(batch) # Using throw and catch enables us to skip over the request validation without actually # having to know whether it was needed or not. diff --git a/app/models/pipeline/inbox_extensions.rb b/app/models/pipeline/inbox_extensions.rb index 0571ca22f1..b43dbede06 100644 --- a/app/models/pipeline/inbox_extensions.rb +++ b/app/models/pipeline/inbox_extensions.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Pipeline::InboxExtensions # rubocop:todo Style/Documentation +module Pipeline::InboxExtensions # Used by the Pipeline class to retrieve the list of requests that are coming into the pipeline. def inputs(show_held_requests = false) ready_in_storage.send(show_held_requests ? :full_inbox : :pipeline_pending) diff --git a/app/models/pipeline/requests_in_storage.rb b/app/models/pipeline/requests_in_storage.rb index e5276417d4..dc7146a8b1 100644 --- a/app/models/pipeline/requests_in_storage.rb +++ b/app/models/pipeline/requests_in_storage.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Pipeline::RequestsInStorage # rubocop:todo Style/Documentation +module Pipeline::RequestsInStorage def ready_in_storage send((proxy_association.owner.group_by_parent ? :asset_on_labware : :all)) end diff --git a/app/models/plate/creator_parameters.rb b/app/models/plate/creator_parameters.rb index e302666fd5..17c48bb544 100644 --- a/app/models/plate/creator_parameters.rb +++ b/app/models/plate/creator_parameters.rb @@ -2,7 +2,7 @@ require 'bigdecimal' require 'bigdecimal/util' -class Plate::CreatorParameters # rubocop:todo Style/Documentation +class Plate::CreatorParameters def initialize(params_plate_creator) @params = params_plate_creator end diff --git a/app/models/plate/fluidigm_behaviour.rb b/app/models/plate/fluidigm_behaviour.rb index a9327380da..078d74c76d 100644 --- a/app/models/plate/fluidigm_behaviour.rb +++ b/app/models/plate/fluidigm_behaviour.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Plate::FluidigmBehaviour # rubocop:todo Style/Documentation +module Plate::FluidigmBehaviour class FluidigmError < StandardError end diff --git a/app/models/plate_creation.rb b/app/models/plate_creation.rb index 04f44a7189..84cd06da7e 100644 --- a/app/models/plate_creation.rb +++ b/app/models/plate_creation.rb @@ -13,7 +13,7 @@ def record_creation_of_children end private :record_creation_of_children - module Children # rubocop:todo Style/Documentation + module Children def self.included(base) base.class_eval do include_plate_named_scope :child @@ -40,7 +40,7 @@ def create_children! end include Children - module CreationChild # rubocop:todo Style/Documentation + module CreationChild def self.included(base) base.class_eval { has_many :plate_creations, foreign_key: :child_id } end diff --git a/app/models/plate_transfer_task.rb b/app/models/plate_transfer_task.rb index 0e83a1cc51..f0980f83e4 100644 --- a/app/models/plate_transfer_task.rb +++ b/app/models/plate_transfer_task.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class PlateTransferTask < Task # rubocop:todo Style/Documentation +class PlateTransferTask < Task belongs_to :purpose def render_task(workflows_controller, params, _user) diff --git a/app/models/plate_type.rb b/app/models/plate_type.rb index 7a85b5fffe..8918dea46f 100644 --- a/app/models/plate_type.rb +++ b/app/models/plate_type.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class PlateType < ApplicationRecord # rubocop:todo Style/Documentation +class PlateType < ApplicationRecord validates :name, :maximum_volume, presence: true class << self diff --git a/app/models/plate_volume.rb b/app/models/plate_volume.rb index 81d6a38eca..4fc693620f 100644 --- a/app/models/plate_volume.rb +++ b/app/models/plate_volume.rb @@ -1,14 +1,14 @@ # frozen_string_literal: true require 'carrierwave' -class PlateVolume < ApplicationRecord # rubocop:todo Style/Documentation +class PlateVolume < ApplicationRecord ASSAY_TYPE = 'Volume Check' ASSAY_VERSION = '1.0' extend DbFile::Uploader has_uploaded :uploaded, serialization_column: 'uploaded_file_name' - before_save :calculate_barcode_from_filename + before_validation :calculate_barcode_from_filename after_save :update_well_volumes # Is an update required given the timestamp specified diff --git a/app/models/pre_capture_pool.rb b/app/models/pre_capture_pool.rb index 06823cd954..56f486bf4a 100644 --- a/app/models/pre_capture_pool.rb +++ b/app/models/pre_capture_pool.rb @@ -27,7 +27,7 @@ class PooledRequest < ApplicationRecord has_many :pooled_requests, dependent: :destroy, inverse_of: :pre_capture_pool has_many :requests, through: :pooled_requests - class Builder # rubocop:todo Style/Documentation + class Builder attr_reader :submission def initialize(submission) diff --git a/app/models/presenters/grouped_pipeline_inbox_presenter.rb b/app/models/presenters/grouped_pipeline_inbox_presenter.rb index bf9732189f..5a5c0294bb 100644 --- a/app/models/presenters/grouped_pipeline_inbox_presenter.rb +++ b/app/models/presenters/grouped_pipeline_inbox_presenter.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module Presenters - class GroupedPipelineInboxPresenter # rubocop:todo Style/Documentation + class GroupedPipelineInboxPresenter class << self def fields @fields ||= [] @@ -104,7 +104,7 @@ def show_stock? end end - class GroupLinePresenter # rubocop:todo Style/Documentation + class GroupLinePresenter include PipelinesHelper attr_reader :group, :request, :index, :pipeline, :inbox diff --git a/app/models/presenters/qc_report_presenter.rb b/app/models/presenters/qc_report_presenter.rb index 554540ffb9..fc9bec3d74 100644 --- a/app/models/presenters/qc_report_presenter.rb +++ b/app/models/presenters/qc_report_presenter.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Presenters::QcReportPresenter # rubocop:todo Style/Documentation +class Presenters::QcReportPresenter REPORT_IDENTITY = 'Sequencescape QC Report' VERSION = '1.0.0' HEADER_FIELDS = { diff --git a/app/models/product.rb b/app/models/product.rb index 07c7d8d127..17c11aea23 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Product < ApplicationRecord # rubocop:todo Style/Documentation +class Product < ApplicationRecord include SharedBehaviour::Indestructable include SharedBehaviour::Deprecatable diff --git a/app/models/product_catalogue.rb b/app/models/product_catalogue.rb index b3398676da..24f11ceb18 100644 --- a/app/models/product_catalogue.rb +++ b/app/models/product_catalogue.rb @@ -5,7 +5,7 @@ # Ideally we want to deprecate submission templates in favour of # products. -class ProductCatalogue < ApplicationRecord # rubocop:todo Style/Documentation +class ProductCatalogue < ApplicationRecord # Specify the behaviour classes that may be used to select a product # The behaviours take the catalogue and submission parameters and # return a product diff --git a/app/models/product_catalogue/library_driven.rb b/app/models/product_catalogue/library_driven.rb index 8ef426a30f..2e926f474f 100644 --- a/app/models/product_catalogue/library_driven.rb +++ b/app/models/product_catalogue/library_driven.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class ProductCatalogue::LibraryDriven # rubocop:todo Style/Documentation +class ProductCatalogue::LibraryDriven attr_reader :product def initialize(catalogue, submission_attributes) diff --git a/app/models/product_catalogue/manual.rb b/app/models/product_catalogue/manual.rb index 5892d72bd1..890d3ef0e9 100644 --- a/app/models/product_catalogue/manual.rb +++ b/app/models/product_catalogue/manual.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class ProductCatalogue::Manual # rubocop:todo Style/Documentation +class ProductCatalogue::Manual attr_reader :product def initialize(catalogue, submission_attributes) diff --git a/app/models/product_catalogue/single_product.rb b/app/models/product_catalogue/single_product.rb index 3d4b6b5cc1..591e851e0f 100644 --- a/app/models/product_catalogue/single_product.rb +++ b/app/models/product_catalogue/single_product.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class ProductCatalogue::SingleProduct # rubocop:todo Style/Documentation +class ProductCatalogue::SingleProduct attr_reader :product def initialize(catalogue, _submission_attributes) diff --git a/app/models/product_criteria.rb b/app/models/product_criteria.rb index 35b18d92fa..e97d571414 100644 --- a/app/models/product_criteria.rb +++ b/app/models/product_criteria.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class ProductCriteria < ApplicationRecord # rubocop:todo Style/Documentation +class ProductCriteria < ApplicationRecord STAGE_STOCK = 'stock' # By default rails will try and name the table 'product_criterias' diff --git a/app/models/product_criteria/basic.rb b/app/models/product_criteria/basic.rb index f33a9f0ad4..b0d05e6b97 100644 --- a/app/models/product_criteria/basic.rb +++ b/app/models/product_criteria/basic.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # rubocop:todo Metrics/ClassLength -class ProductCriteria::Basic # rubocop:todo Style/Documentation +class ProductCriteria::Basic SUPPORTED_WELL_ATTRIBUTES = %i[ gel_pass concentration diff --git a/app/models/program.rb b/app/models/program.rb index 02500998e3..402280389f 100644 --- a/app/models/program.rb +++ b/app/models/program.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Program < ApplicationRecord # rubocop:todo Style/Documentation +class Program < ApplicationRecord extend Attributable::Association::Target default_scope -> { order(:name) } @@ -14,7 +14,7 @@ class Program < ApplicationRecord # rubocop:todo Style/Documentation has_many :study_metadata, class_name: 'Study::Metadata' has_many :studies, through: :study_metadata - module Associations # rubocop:todo Style/Documentation + module Associations def self.included(base) base.validates_presence_of :program_id base.belongs_to :program diff --git a/app/models/project.rb b/app/models/project.rb index 2e864a53ed..9247182039 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'aasm' -class Project < ApplicationRecord # rubocop:todo Style/Documentation +class Project < ApplicationRecord # It has to be here, as there are has_many through: :orders associations in modules has_many :orders include Api::ProjectIO::Extensions diff --git a/app/models/project_manager.rb b/app/models/project_manager.rb index 574afc13dd..004f54fc53 100644 --- a/app/models/project_manager.rb +++ b/app/models/project_manager.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class ProjectManager < ApplicationRecord # rubocop:todo Style/Documentation +class ProjectManager < ApplicationRecord extend Attributable::Association::Target def self.unallocated @@ -11,7 +11,7 @@ def self.unallocated validates :name, presence: true validates :name, uniqueness: { message: 'of project manager already present in database', case_sensitive: false } - module Associations # rubocop:todo Style/Documentation + module Associations def self.included(base) base.belongs_to :project_manager, optional: false end diff --git a/app/models/pulldown/requests.rb b/app/models/pulldown/requests.rb index d6312c5aa5..4d8264e41b 100644 --- a/app/models/pulldown/requests.rb +++ b/app/models/pulldown/requests.rb @@ -1,3 +1,3 @@ # frozen_string_literal: true -module Pulldown::Requests # rubocop:todo Style/Documentation +module Pulldown::Requests end diff --git a/app/models/pulldown_multiplexed_library_creation_request.rb b/app/models/pulldown_multiplexed_library_creation_request.rb index 5df53a000d..590baac4ef 100644 --- a/app/models/pulldown_multiplexed_library_creation_request.rb +++ b/app/models/pulldown_multiplexed_library_creation_request.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class PulldownMultiplexedLibraryCreationRequest < CustomerRequest # rubocop:todo Style/Documentation +class PulldownMultiplexedLibraryCreationRequest < CustomerRequest # override default behavior to not copy the aliquots def on_started; end end diff --git a/app/models/purpose/relationship.rb b/app/models/purpose/relationship.rb index 39e4dc5d5d..15f0de6fe1 100644 --- a/app/models/purpose/relationship.rb +++ b/app/models/purpose/relationship.rb @@ -8,7 +8,7 @@ # @author [jg16] # class Purpose::Relationship < ApplicationRecord - module Associations # rubocop:todo Style/Documentation + module Associations def self.included(base) base.class_eval do has_many :child_relationships, class_name: 'Purpose::Relationship', foreign_key: :parent_id, dependent: :destroy diff --git a/app/models/qc_decision.rb b/app/models/qc_decision.rb index 44d2143cad..4d92f639ac 100644 --- a/app/models/qc_decision.rb +++ b/app/models/qc_decision.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -class QcDecision < ApplicationRecord # rubocop:todo Style/Documentation +class QcDecision < ApplicationRecord include Uuid::Uuidable - class QcDecisionQcable < ApplicationRecord # rubocop:todo Style/Documentation + class QcDecisionQcable < ApplicationRecord self.table_name = ('qc_decision_qcables') belongs_to :qcable diff --git a/app/models/qc_file.rb b/app/models/qc_file.rb index 353d43b6a8..1a68de750c 100644 --- a/app/models/qc_file.rb +++ b/app/models/qc_file.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true -class QcFile < ApplicationRecord # rubocop:todo Style/Documentation +class QcFile < ApplicationRecord extend DbFile::Uploader include Uuid::Uuidable - module Associations # rubocop:todo Style/Documentation + module Associations # Adds accessors for named fields and attaches documents to them def has_qc_files # rubocop:todo Metrics/MethodLength @@ -32,6 +32,10 @@ def update_qc_values_with_parser(_parser) # CarrierWave uploader - gets the uploaded_data file, but saves the identifier to the "filename" column has_uploaded :uploaded_data, serialization_column: 'filename' + + #mount_uploader :uploaded_data, PolymorphicUploader, mount_on: :filename + #mount_uploader :uploaded_data, PolymorphicUploader, mount_on: 'filename' + validates :uploaded_data, presence: :true # Method provided for backwards compatibility @@ -42,6 +46,7 @@ def current_data def retrieve_file uploaded_data.cache!(uploaded_data.file) yield(uploaded_data) + # We can't actually delete the cache file here, as the send_file # operation happens asynchronously. Instead we can use: # PolymorphicUploader.clean_cached_files! diff --git a/app/models/qc_metric.rb b/app/models/qc_metric.rb index 9066f4ed87..db2b6783f3 100644 --- a/app/models/qc_metric.rb +++ b/app/models/qc_metric.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class QcMetric < ApplicationRecord # rubocop:todo Style/Documentation +class QcMetric < ApplicationRecord extend QcMetric::QcState InvalidValue = Class.new(StandardError) diff --git a/app/models/qc_metric/qc_state.rb b/app/models/qc_metric/qc_state.rb index 11dc1bda01..f2cf90c545 100644 --- a/app/models/qc_metric/qc_state.rb +++ b/app/models/qc_metric/qc_state.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module QcMetric::QcState # rubocop:todo Style/Documentation +module QcMetric::QcState State = Struct.new(:name, :automatic, :passed, :proceedable) def new_state(name, options = {}) diff --git a/app/models/qc_report.rb b/app/models/qc_report.rb index 80a2c8f4e8..eb131d8823 100644 --- a/app/models/qc_report.rb +++ b/app/models/qc_report.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true -class QcReport < ApplicationRecord # rubocop:todo Style/Documentation +class QcReport < ApplicationRecord # :id => The primary key for internal use only # :report_identifier => A unique identifier exposed to customers # :state => Tracks report processing and return include AASM - module StateMachine # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module StateMachine + module ClassMethods def available_states QcReport.aasm.states.map { |state| state.name.to_s } end @@ -73,7 +73,7 @@ def available? # rubocop:enable Metrics/MethodLength end - module ReportBehaviour # rubocop:todo Style/Documentation + module ReportBehaviour # Generates the report. # Generally speaking this gets triggered automatically, and is handled by the delayed job. # Briefly, an after_create event creates a delayed job to call generate! on the report. diff --git a/app/models/qc_report/file.rb b/app/models/qc_report/file.rb index 1c6fff6189..93d9b0f739 100644 --- a/app/models/qc_report/file.rb +++ b/app/models/qc_report/file.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # rubocop:todo Metrics/ClassLength -class QcReport::File # rubocop:todo Style/Documentation +class QcReport::File ACCEPTED_MIMETYPE = 'text/csv' ACCEPTED_EXTENSTION = 'csv' FILE_VERSION_KEY = 'Sequencescape QC Report' diff --git a/app/models/qcable.rb b/app/models/qcable.rb index 41aa188de5..2bf59f88dd 100644 --- a/app/models/qcable.rb +++ b/app/models/qcable.rb @@ -7,7 +7,7 @@ require 'aasm' -class Qcable < ApplicationRecord # rubocop:todo Style/Documentation +class Qcable < ApplicationRecord include Uuid::Uuidable include AASM include AASM::Extensions diff --git a/app/models/qcable/statemachine.rb b/app/models/qcable/statemachine.rb index d41614b0f9..18a015d21d 100644 --- a/app/models/qcable/statemachine.rb +++ b/app/models/qcable/statemachine.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Qcable::Statemachine # rubocop:todo Style/Documentation +module Qcable::Statemachine def self.included(base) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength base.class_eval do ## State machine diff --git a/app/models/qcable_creator.rb b/app/models/qcable_creator.rb index 013a4e66ca..24deab41b0 100644 --- a/app/models/qcable_creator.rb +++ b/app/models/qcable_creator.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class QcableCreator < ApplicationRecord # rubocop:todo Style/Documentation +class QcableCreator < ApplicationRecord include Uuid::Uuidable belongs_to :user diff --git a/app/models/re_request_submission.rb b/app/models/re_request_submission.rb index 1229ff7939..9010724a71 100644 --- a/app/models/re_request_submission.rb +++ b/app/models/re_request_submission.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class ReRequestSubmission < Order # rubocop:todo Style/Documentation +class ReRequestSubmission < Order include Submission::LinearRequestGraph include Submission::Crossable diff --git a/app/models/receptacle/downstream_aliquots_removal.rb b/app/models/receptacle/downstream_aliquots_removal.rb index ce9ec3821b..c622230b48 100644 --- a/app/models/receptacle/downstream_aliquots_removal.rb +++ b/app/models/receptacle/downstream_aliquots_removal.rb @@ -12,7 +12,7 @@ module Mixin # @return [Boolean] true if we allow to remove downstream aliquots, false otherwise def allow_to_remove_downstream_aliquots? creation_batches = PrivateMethods.creation_batches_for_requests(self) - creation_batches.nil? || creation_batches.flatten.uniq.length.zero? + creation_batches.nil? || creation_batches.flatten.uniq.empty? end end diff --git a/app/models/reference_genome.rb b/app/models/reference_genome.rb index a2b3e6d5f5..b9e203bfd1 100644 --- a/app/models/reference_genome.rb +++ b/app/models/reference_genome.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class ReferenceGenome < ApplicationRecord # rubocop:todo Style/Documentation +class ReferenceGenome < ApplicationRecord extend Attributable::Association::Target include Api::ReferenceGenomeIO::Extensions include Uuid::Uuidable @@ -15,7 +15,7 @@ class ReferenceGenome < ApplicationRecord # rubocop:todo Style/Documentation } broadcast_with_warren - module Associations # rubocop:todo Style/Documentation + module Associations def self.included(base) base.validates_presence_of :reference_genome_id base.validates_numericality_of :reference_genome_id, greater_than: 0, message: 'appears to be invalid' diff --git a/app/models/report_fail.rb b/app/models/report_fail.rb index 435f0bba74..38466a5be5 100644 --- a/app/models/report_fail.rb +++ b/app/models/report_fail.rb @@ -50,8 +50,8 @@ def failed_labware end def missing_barcodes - machine_barcodes = failed_labware.map(&:machine_barcode).to_set - human_barcodes = failed_labware.map(&:human_barcode).to_set + machine_barcodes = failed_labware.to_set(&:machine_barcode) + human_barcodes = failed_labware.to_set(&:human_barcode) failed_labware_barcodes.delete_if do |barcode| human_barcodes.include?(barcode) || machine_barcodes.include?(barcode) end diff --git a/app/models/request/accessioning_required.rb b/app/models/request/accessioning_required.rb index 93dffd9964..101332c16d 100644 --- a/app/models/request/accessioning_required.rb +++ b/app/models/request/accessioning_required.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Request::AccessioningRequired # rubocop:todo Style/Documentation +module Request::AccessioningRequired def accessioning_required? true end diff --git a/app/models/request/change_decision.rb b/app/models/request/change_decision.rb index bf1ba7a10f..2ad3a401ce 100644 --- a/app/models/request/change_decision.rb +++ b/app/models/request/change_decision.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -class Request::ChangeDecision # rubocop:todo Style/Documentation +class Request::ChangeDecision include ::Validateable - class ChangeDecisionError < ::StandardError # rubocop:todo Style/Documentation + class ChangeDecisionError < ::StandardError attr_reader :object def initialize(object) diff --git a/app/models/request/customer_responsibility.rb b/app/models/request/customer_responsibility.rb index bf34b88177..78b97f3fad 100644 --- a/app/models/request/customer_responsibility.rb +++ b/app/models/request/customer_responsibility.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Request::CustomerResponsibility # rubocop:todo Style/Documentation +module Request::CustomerResponsibility def self.included(base) base::Metadata.class_eval do custom_attribute(:customer_accepts_responsibility, boolean: true) diff --git a/app/models/request/grouping_helpers.rb b/app/models/request/grouping_helpers.rb index 22946cf08b..ef296a087c 100644 --- a/app/models/request/grouping_helpers.rb +++ b/app/models/request/grouping_helpers.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Request::GroupingHelpers # rubocop:todo Style/Documentation +module Request::GroupingHelpers def group_requests_by_submission_id(requests) # NOTE: Not using group_by(&:submission_id) to maintain the order of the submissions from the order of the requests requests diff --git a/app/models/request/library_creation.rb b/app/models/request/library_creation.rb index 6b586e2baa..98e4103006 100644 --- a/app/models/request/library_creation.rb +++ b/app/models/request/library_creation.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Request::LibraryCreation < CustomerRequest # rubocop:todo Style/Documentation +class Request::LibraryCreation < CustomerRequest self.library_creation = true # Override the behaviour of Request so that we do not copy the aliquots from our source asset diff --git a/app/models/request/library_manufacture.rb b/app/models/request/library_manufacture.rb index 557640522b..b658ec038b 100644 --- a/app/models/request/library_manufacture.rb +++ b/app/models/request/library_manufacture.rb @@ -21,7 +21,7 @@ def self.included(base) # rubocop:todo Metrics/MethodLength ) end - module ClassMethods # rubocop:todo Style/Documentation + module ClassMethods def delegate_validator self::RequestOptionsValidator end diff --git a/app/models/request/multiplexing.rb b/app/models/request/multiplexing.rb index 8109a61ad9..bf506355fe 100644 --- a/app/models/request/multiplexing.rb +++ b/app/models/request/multiplexing.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Request::Multiplexing < CustomerRequest # rubocop:todo Style/Documentation +class Request::Multiplexing < CustomerRequest # If we re request we need to make sure we look in the new # source wells for our repool after_create :flag_asset_as_stock_well, if: :asset diff --git a/app/models/request/statemachine.rb b/app/models/request/statemachine.rb index 2d412bb96d..fee3498a1b 100644 --- a/app/models/request/statemachine.rb +++ b/app/models/request/statemachine.rb @@ -4,7 +4,7 @@ require 'aasm' # rubocop:todo Metrics/ModuleLength -module Request::Statemachine # rubocop:todo Style/Documentation +module Request::Statemachine extend ActiveSupport::Concern COMPLETED_STATE = %w[passed failed].freeze OPENED_STATE = %w[pending blocked started].freeze diff --git a/app/models/request/statistics.rb b/app/models/request/statistics.rb index 2c9d941fc0..52d8f950a7 100644 --- a/app/models/request/statistics.rb +++ b/app/models/request/statistics.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Request::Statistics # rubocop:todo Style/Documentation - class Counter # rubocop:todo Style/Documentation +module Request::Statistics + class Counter def initialize(statistics = {}) @statistics = Hash.new(0).merge(statistics) end @@ -49,7 +49,7 @@ def sorted_states end end - class Summary # rubocop:todo Style/Documentation + class Summary def initialize @counters = Hash.new { |h, k| h[k] = Counter.new } end diff --git a/app/models/request/traction.rb b/app/models/request/traction.rb index 0c144e85a1..5c3aff2d52 100644 --- a/app/models/request/traction.rb +++ b/app/models/request/traction.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require_dependency 'request' class Request - module Traction # rubocop:todo Style/Documentation + module Traction # Namespace for external traction request classes end end diff --git a/app/models/request/traction/grid_ion.rb b/app/models/request/traction/grid_ion.rb index 702743a7a6..4c18c7f239 100644 --- a/app/models/request/traction/grid_ion.rb +++ b/app/models/request/traction/grid_ion.rb @@ -3,7 +3,7 @@ class Request module Traction - class GridIon < CustomerRequest # rubocop:todo Style/Documentation + class GridIon < CustomerRequest self.sequencing = true after_create :register_work_orders diff --git a/app/models/request_event.rb b/app/models/request_event.rb index 3aabc082eb..4c68205682 100644 --- a/app/models/request_event.rb +++ b/app/models/request_event.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class RequestEvent < ApplicationRecord # rubocop:todo Style/Documentation +class RequestEvent < ApplicationRecord belongs_to :request, inverse_of: :request_events validates :request, :to_state, :current_from, :event_name, presence: true diff --git a/app/models/request_factory.rb b/app/models/request_factory.rb index 7f426a0021..f8283e616e 100644 --- a/app/models/request_factory.rb +++ b/app/models/request_factory.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class RequestFactory # rubocop:todo Style/Documentation +class RequestFactory def self.copy_request(request) ActiveRecord::Base.transaction do request diff --git a/app/models/request_type.rb b/app/models/request_type.rb index 103ce101a3..e81108dfc7 100644 --- a/app/models/request_type.rb +++ b/app/models/request_type.rb @@ -20,7 +20,7 @@ class RequestType < ApplicationRecord # rubocop:todo Metrics/ClassLength class DeprecatedError < RuntimeError end - class RequestTypePlatePurpose < ApplicationRecord # rubocop:todo Style/Documentation + class RequestTypePlatePurpose < ApplicationRecord self.table_name = ('request_type_plate_purposes') belongs_to :request_type diff --git a/app/models/request_type/pooling_method.rb b/app/models/request_type/pooling_method.rb index d8654d96c7..7f47fb1ac0 100644 --- a/app/models/request_type/pooling_method.rb +++ b/app/models/request_type/pooling_method.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class RequestType::PoolingMethod < ApplicationRecord # rubocop:todo Style/Documentation +class RequestType::PoolingMethod < ApplicationRecord has_many :request_types validates :pooling_behaviour, presence: true serialize :pooling_options diff --git a/app/models/request_type/validation.rb b/app/models/request_type/validation.rb index 31d107df90..cc1c8a22e4 100644 --- a/app/models/request_type/validation.rb +++ b/app/models/request_type/validation.rb @@ -31,7 +31,7 @@ def request_type_validator create_validator(request_type).tap { |sub_class| sub_class.request_type = request_type } end - class RequestTypeValidator < DelegateValidation::Validator # rubocop:todo Style/Documentation + class RequestTypeValidator < DelegateValidation::Validator class_attribute :request_type, instance_writer: false request_type = nil diff --git a/app/models/request_type/validator.rb b/app/models/request_type/validator.rb index ae32834f8e..bd89169fdd 100644 --- a/app/models/request_type/validator.rb +++ b/app/models/request_type/validator.rb @@ -6,7 +6,7 @@ # valid_options => A serialized object that responds to include? Returning true if the option is present # It should also return an array of valid options in response to to_a class RequestType::Validator < ApplicationRecord - class LibraryTypeValidator # rubocop:todo Style/Documentation + class LibraryTypeValidator attr_reader :request_type_id def initialize(request_type_id) @@ -74,8 +74,8 @@ def initialize(array, default) @array = array end - def method_missing(method, *args, &block) - @array.send(method, *args, &block) + def method_missing(method, ...) + @array.send(method, ...) end def include?(option) diff --git a/app/models/robot.rb b/app/models/robot.rb index 34cd9c82e3..9fae34ee4c 100644 --- a/app/models/robot.rb +++ b/app/models/robot.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Robot < ApplicationRecord # rubocop:todo Style/Documentation +class Robot < ApplicationRecord include Uuid::Uuidable include ModelExtensions::Robot diff --git a/app/models/robot/generator/behaviours/hamilton_default.rb b/app/models/robot/generator/behaviours/hamilton_default.rb index cecfc35490..287d91393b 100644 --- a/app/models/robot/generator/behaviours/hamilton_default.rb +++ b/app/models/robot/generator/behaviours/hamilton_default.rb @@ -20,7 +20,7 @@ def mapping(data_object = picking_data) output_file_contents = [column_headers] output_file_contents << source_mappings(data_object) - output_file_contents.join("\n").gsub(/\n\n/, "\n") + output_file_contents.join("\n").gsub("\n\n", "\n") end private diff --git a/app/models/robot/generator/behaviours/tecan_default.rb b/app/models/robot/generator/behaviours/tecan_default.rb index 9ca31bbc05..0779906990 100644 --- a/app/models/robot/generator/behaviours/tecan_default.rb +++ b/app/models/robot/generator/behaviours/tecan_default.rb @@ -14,7 +14,7 @@ def mapping(data_object: picking_data) output_file_contents << dyn_mappings(data_object) output_file_contents << footer - output_file_contents.join("\n").gsub(/\n\n/, "\n") + output_file_contents.join("\n").gsub("\n\n", "\n") end def sort_order diff --git a/app/models/robot_property.rb b/app/models/robot_property.rb index b4061032cb..ddfc9c8523 100644 --- a/app/models/robot_property.rb +++ b/app/models/robot_property.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class RobotProperty < ApplicationRecord # rubocop:todo Style/Documentation +class RobotProperty < ApplicationRecord belongs_to :robot scope :beds, -> { where(name: nil) } diff --git a/app/models/sample_manifest.rb b/app/models/sample_manifest.rb index 79dbea1acd..1254a30f9c 100644 --- a/app/models/sample_manifest.rb +++ b/app/models/sample_manifest.rb @@ -39,7 +39,7 @@ class SampleManifest < ApplicationRecord # rubocop:todo Metrics/ClassLength # This limit sets a very comfortable safety margin. SAMPLES_PER_EVENT = 3000 - module Associations # rubocop:todo Style/Documentation + module Associations def self.included(base) base.has_many(:sample_manifests) end diff --git a/app/models/sample_manifest/barcode_printer_behaviour.rb b/app/models/sample_manifest/barcode_printer_behaviour.rb index 1e46825620..732bf764e3 100644 --- a/app/models/sample_manifest/barcode_printer_behaviour.rb +++ b/app/models/sample_manifest/barcode_printer_behaviour.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module SampleManifest::BarcodePrinterBehaviour # rubocop:todo Style/Documentation +module SampleManifest::BarcodePrinterBehaviour ASSET_TYPE_TO_PRINTER_TYPE = { '1dtube' => [BarcodePrinterType1DTube], 'plate' => [BarcodePrinterType96Plate, BarcodePrinterType384DoublePlate] diff --git a/app/models/sample_manifest/core_behaviour.rb b/app/models/sample_manifest/core_behaviour.rb index fcf656d84e..385b11006f 100644 --- a/app/models/sample_manifest/core_behaviour.rb +++ b/app/models/sample_manifest/core_behaviour.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module SampleManifest::CoreBehaviour # rubocop:todo Style/Documentation +module SampleManifest::CoreBehaviour BEHAVIOURS = %w[1dtube plate multiplexed_library library library_plate tube_rack].freeze # Include in cores which exhibit the default behaviour @@ -11,7 +11,7 @@ def specialized_fields(*_args) end end - module Shared # rubocop:todo Style/Documentation + module Shared def self.included(base) base.class_eval do delegate :create_sample, to: :@manifest diff --git a/app/models/sample_manifest/multiplexed_library_behaviour.rb b/app/models/sample_manifest/multiplexed_library_behaviour.rb index 33c92e87eb..3929604807 100644 --- a/app/models/sample_manifest/multiplexed_library_behaviour.rb +++ b/app/models/sample_manifest/multiplexed_library_behaviour.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module SampleManifest::MultiplexedLibraryBehaviour - class Core < SampleManifest::SharedTubeBehaviour::Base # rubocop:todo Style/Documentation + class Core < SampleManifest::SharedTubeBehaviour::Base include SampleManifest::CoreBehaviour::LibraryAssets # for #multiplexed_library_tube diff --git a/app/models/sample_manifest/plate_behaviour.rb b/app/models/sample_manifest/plate_behaviour.rb index f225e8a5bd..f5ab83b901 100644 --- a/app/models/sample_manifest/plate_behaviour.rb +++ b/app/models/sample_manifest/plate_behaviour.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module SampleManifest::PlateBehaviour - class Base # rubocop:todo Style/Documentation + class Base include SampleManifest::CoreBehaviour::Shared include SampleManifest::CoreBehaviour::NoSpecializedValidation diff --git a/app/models/sample_manifest/sample_tube_behaviour.rb b/app/models/sample_manifest/sample_tube_behaviour.rb index f044c10850..1ab84b0a9e 100644 --- a/app/models/sample_manifest/sample_tube_behaviour.rb +++ b/app/models/sample_manifest/sample_tube_behaviour.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module SampleManifest::SampleTubeBehaviour - class Core < SampleManifest::SharedTubeBehaviour::Base # rubocop:todo Style/Documentation + class Core < SampleManifest::SharedTubeBehaviour::Base include SampleManifest::CoreBehaviour::NoSpecializedValidation include SampleManifest::CoreBehaviour::StockAssets diff --git a/app/models/sample_manifest/shared_tube_behaviour.rb b/app/models/sample_manifest/shared_tube_behaviour.rb index eb3bd160a9..1285e9a541 100644 --- a/app/models/sample_manifest/shared_tube_behaviour.rb +++ b/app/models/sample_manifest/shared_tube_behaviour.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module SampleManifest::SharedTubeBehaviour - class Base # rubocop:todo Style/Documentation + class Base include SampleManifest::CoreBehaviour::Shared def updated_by!(user, samples) diff --git a/app/models/sample_manifest/state_machine.rb b/app/models/sample_manifest/state_machine.rb index eafc4ef82a..c5b476d799 100644 --- a/app/models/sample_manifest/state_machine.rb +++ b/app/models/sample_manifest/state_machine.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'aasm' -module SampleManifest::StateMachine # rubocop:todo Style/Documentation +module SampleManifest::StateMachine def self.extended(base) base.class_eval do include AASM diff --git a/app/models/sample_manifest/unspecified_behaviour.rb b/app/models/sample_manifest/unspecified_behaviour.rb index d0769d1fce..366f153945 100644 --- a/app/models/sample_manifest/unspecified_behaviour.rb +++ b/app/models/sample_manifest/unspecified_behaviour.rb @@ -2,7 +2,7 @@ # Simple core module to handle options when no type has been specified # Not valid for actually building manifests, just for rendering forms module SampleManifest::UnspecifiedBehaviour - class Core # rubocop:todo Style/Documentation + class Core def initialize(_manifest) # Do nothing end diff --git a/app/models/sample_tube.rb b/app/models/sample_tube.rb index fdd0688bb0..d1fdaab590 100644 --- a/app/models/sample_tube.rb +++ b/app/models/sample_tube.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class SampleTube < Tube # rubocop:todo Style/Documentation +class SampleTube < Tube include Api::SampleTubeIO::Extensions include ModelExtensions::SampleTube include StandardNamedScopes diff --git a/app/models/sanger_sample_id.rb b/app/models/sanger_sample_id.rb index ae81ad6ea2..8527364fc2 100644 --- a/app/models/sanger_sample_id.rb +++ b/app/models/sanger_sample_id.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class SangerSampleId < ApplicationRecord # rubocop:todo Style/Documentation - class Factory # rubocop:todo Style/Documentation +class SangerSampleId < ApplicationRecord + class Factory def self.instance @instance ||= new end diff --git a/app/models/search/find_asset_by_barcode.rb b/app/models/search/find_asset_by_barcode.rb index 1fd4e03159..7df1481199 100644 --- a/app/models/search/find_asset_by_barcode.rb +++ b/app/models/search/find_asset_by_barcode.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Search::FindAssetByBarcode < Search # rubocop:todo Style/Documentation +class Search::FindAssetByBarcode < Search def scope(criteria) Labware.with_barcode(criteria['barcode']) end diff --git a/app/models/search/find_lot_by_lot_number.rb b/app/models/search/find_lot_by_lot_number.rb index 5e31eb9873..5a024a61d5 100644 --- a/app/models/search/find_lot_by_lot_number.rb +++ b/app/models/search/find_lot_by_lot_number.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Search::FindLotByLotNumber < Search # rubocop:todo Style/Documentation +class Search::FindLotByLotNumber < Search def scope(criteria) Lot.with_lot_number(criteria['lot_number']) end diff --git a/app/models/search/find_model_by_name.rb b/app/models/search/find_model_by_name.rb index 22fbdc61a0..3db3c0b349 100644 --- a/app/models/search/find_model_by_name.rb +++ b/app/models/search/find_model_by_name.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Search::FindModelByName < Search # rubocop:todo Style/Documentation +class Search::FindModelByName < Search validates :target_model_name, presence: true def model diff --git a/app/models/search/find_plates_for_user.rb b/app/models/search/find_plates_for_user.rb index d43a8ff9b9..8b98e15a8c 100644 --- a/app/models/search/find_plates_for_user.rb +++ b/app/models/search/find_plates_for_user.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Search::FindPlatesForUser < Search # rubocop:todo Style/Documentation +class Search::FindPlatesForUser < Search def scope(user_criteria) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength # We find all plates that do not have transfers where they are the source. Once a plate has been transferred # (or marked for transfer) the destination plate becomes the end of the chain. diff --git a/app/models/search/find_qcable_by_barcode.rb b/app/models/search/find_qcable_by_barcode.rb index dd4f75b384..8ea4d64988 100644 --- a/app/models/search/find_qcable_by_barcode.rb +++ b/app/models/search/find_qcable_by_barcode.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Search::FindQcableByBarcode < Search # rubocop:todo Style/Documentation +class Search::FindQcableByBarcode < Search def scope(criteria) Qcable.with_barcode(criteria['barcode']) end diff --git a/app/models/search/find_robot_by_barcode.rb b/app/models/search/find_robot_by_barcode.rb index af607b1ac0..505d4b2518 100644 --- a/app/models/search/find_robot_by_barcode.rb +++ b/app/models/search/find_robot_by_barcode.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Search::FindRobotByBarcode < Search # rubocop:todo Style/Documentation +class Search::FindRobotByBarcode < Search def scope(criteria) Robot.with_barcode(criteria['barcode']) end diff --git a/app/models/search/find_source_assets_by_destination_asset_barcode.rb b/app/models/search/find_source_assets_by_destination_asset_barcode.rb index ec31169c3a..1a445a5953 100644 --- a/app/models/search/find_source_assets_by_destination_asset_barcode.rb +++ b/app/models/search/find_source_assets_by_destination_asset_barcode.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Search::FindSourceAssetsByDestinationAssetBarcode < Search # rubocop:todo Style/Documentation +class Search::FindSourceAssetsByDestinationAssetBarcode < Search def scope(criteria) Labware.source_assets_from_machine_barcode(criteria['barcode']) end diff --git a/app/models/search/find_tubes.rb b/app/models/search/find_tubes.rb index c03cc5bfb6..d97fdba68f 100644 --- a/app/models/search/find_tubes.rb +++ b/app/models/search/find_tubes.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Search::FindTubes < Search # rubocop:todo Style/Documentation +class Search::FindTubes < Search def scope(user_criteria) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength criteria = default_parameters.stringify_keys.merge(user_criteria) diff --git a/app/models/search/find_user_by_login.rb b/app/models/search/find_user_by_login.rb index 85130ebb74..03e372c95a 100644 --- a/app/models/search/find_user_by_login.rb +++ b/app/models/search/find_user_by_login.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Search::FindUserByLogin < Search # rubocop:todo Style/Documentation +class Search::FindUserByLogin < Search def scope(criteria) User.with_login(criteria['login']) end diff --git a/app/models/search/find_user_by_swipecard_code.rb b/app/models/search/find_user_by_swipecard_code.rb index 15f7e42659..a5d4b4f84e 100644 --- a/app/models/search/find_user_by_swipecard_code.rb +++ b/app/models/search/find_user_by_swipecard_code.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Search::FindUserBySwipecardCode < Search # rubocop:todo Style/Documentation +class Search::FindUserBySwipecardCode < Search def scope(criteria) User.with_swipecard_code(criteria['swipecard_code']) end diff --git a/app/models/search_behaviour.rb b/app/models/search_behaviour.rb index ceec211118..f7ce8e0b0c 100644 --- a/app/models/search_behaviour.rb +++ b/app/models/search_behaviour.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module SearchBehaviour # rubocop:todo Style/Documentation +module SearchBehaviour MINIMUM_QUERY_LENGTH = 3 def self.included(base) diff --git a/app/models/sequencing_request.rb b/app/models/sequencing_request.rb index a880e178cd..eefb932628 100644 --- a/app/models/sequencing_request.rb +++ b/app/models/sequencing_request.rb @@ -1,7 +1,7 @@ # encoding: utf-8 # frozen_string_literal: true -class SequencingRequest < CustomerRequest # rubocop:todo Style/Documentation +class SequencingRequest < CustomerRequest extend Request::AccessioningRequired include Api::Messages::FlowcellIO::LaneExtensions diff --git a/app/models/shared_behaviour/deprecatable.rb b/app/models/shared_behaviour/deprecatable.rb index 2ca189712e..94c05eec0e 100644 --- a/app/models/shared_behaviour/deprecatable.rb +++ b/app/models/shared_behaviour/deprecatable.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module SharedBehaviour::Deprecatable # rubocop:todo Style/Documentation +module SharedBehaviour::Deprecatable def self.included(base) base.class_eval { scope :active, -> { where(deprecated_at: nil) } } end diff --git a/app/models/shared_behaviour/immutable.rb b/app/models/shared_behaviour/immutable.rb index 3b9d2e3494..33b058b895 100644 --- a/app/models/shared_behaviour/immutable.rb +++ b/app/models/shared_behaviour/immutable.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module SharedBehaviour::Immutable # rubocop:todo Style/Documentation +module SharedBehaviour::Immutable MUTABLE = %w[deprecated_at updated_at].freeze def self.included(base) diff --git a/app/models/shared_behaviour/indestructable.rb b/app/models/shared_behaviour/indestructable.rb index f30ce22645..7062d0e312 100644 --- a/app/models/shared_behaviour/indestructable.rb +++ b/app/models/shared_behaviour/indestructable.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module SharedBehaviour::Indestructable # rubocop:todo Style/Documentation +module SharedBehaviour::Indestructable def self.included(base) base.class_eval { before_destroy :prevent_destruction } end diff --git a/app/models/shared_behaviour/named.rb b/app/models/shared_behaviour/named.rb index 24d803c0b2..4a34e68da8 100644 --- a/app/models/shared_behaviour/named.rb +++ b/app/models/shared_behaviour/named.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module SharedBehaviour::Named # rubocop:todo Style/Documentation +module SharedBehaviour::Named def self.included(base) base.class_eval do scope :with_name, ->(*names) { where(name: names.flatten) } diff --git a/app/models/single_request_submission.rb b/app/models/single_request_submission.rb index 442450cafb..2dad6d1cc5 100644 --- a/app/models/single_request_submission.rb +++ b/app/models/single_request_submission.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class SingleRequestSubmission < Order # rubocop:todo Style/Documentation +class SingleRequestSubmission < Order def request_type_id=(request_type_id) request_type_ids_list = [[request_type_id]] end diff --git a/app/models/spiked_buffer.rb b/app/models/spiked_buffer.rb index 40d307c416..44aeccac67 100644 --- a/app/models/spiked_buffer.rb +++ b/app/models/spiked_buffer.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class SpikedBuffer < LibraryTube # rubocop:todo Style/Documentation +class SpikedBuffer < LibraryTube # The index of a spiked buffer is the first parent library tube. Note that this does not cover cases where # the sti_type is a derivative of LibraryTube, which is actually fine because SpikedBuffer is a LibraryTube # and we definitely don't want that in the list. diff --git a/app/models/stamp.rb b/app/models/stamp.rb index 4955923e4e..eccf327d73 100644 --- a/app/models/stamp.rb +++ b/app/models/stamp.rb @@ -3,11 +3,11 @@ # A stamp is a means of transfering material from a lot # into a qcable. -class Stamp < ApplicationRecord # rubocop:todo Style/Documentation +class Stamp < ApplicationRecord include Uuid::Uuidable include ModelExtensions::Stamp - class StampQcable < ApplicationRecord # rubocop:todo Style/Documentation + class StampQcable < ApplicationRecord self.table_name = ('stamp_qcables') belongs_to :stamp, inverse_of: :stamp_qcables diff --git a/app/models/standard_named_scopes.rb b/app/models/standard_named_scopes.rb index 5f5180e4c7..262757767b 100644 --- a/app/models/standard_named_scopes.rb +++ b/app/models/standard_named_scopes.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module StandardNamedScopes # rubocop:todo Style/Documentation +module StandardNamedScopes SORT_FIELDS = %i[created updated].freeze SORT_ORDERS = { first: 'DESC', last: 'ASC' }.freeze diff --git a/app/models/stock_multiplexed_library_tube.rb b/app/models/stock_multiplexed_library_tube.rb index 50c949aa1d..b0830c5846 100644 --- a/app/models/stock_multiplexed_library_tube.rb +++ b/app/models/stock_multiplexed_library_tube.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class StockMultiplexedLibraryTube < Tube # rubocop:todo Style/Documentation +class StockMultiplexedLibraryTube < Tube include Asset::Stock def stock_wells diff --git a/app/models/stock_stamper.rb b/app/models/stock_stamper.rb index 854ff4095a..ae2fb5e657 100644 --- a/app/models/stock_stamper.rb +++ b/app/models/stock_stamper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class StockStamper # rubocop:todo Style/Documentation +class StockStamper include ActiveModel::Model attr_accessor :user_barcode, diff --git a/app/models/study/metadata.rb b/app/models/study/metadata.rb index 8ff0dd5855..adada7ebf3 100644 --- a/app/models/study/metadata.rb +++ b/app/models/study/metadata.rb @@ -11,7 +11,7 @@ # Study itself will also ensure that this file gets loaded, to make sure the metadata class contains these methods class Study - class Metadata # rubocop:todo Style/Documentation + class Metadata delegate :enforce_data_release, to: :study def remove_x_and_autosomes? diff --git a/app/models/study_report.rb b/app/models/study_report.rb index 474d1f1739..8fbd163aed 100644 --- a/app/models/study_report.rb +++ b/app/models/study_report.rb @@ -46,7 +46,7 @@ def perform Tempfile.open("#{study.dehumanise_abbreviated_name}_progress_report.csv") do |tempfile| Study .find(study_id) - .progress_report_on_all_assets { |fields| tempfile.puts(CSV.generate_line(fields, csv_options)) } + .progress_report_on_all_assets { |fields| tempfile.puts(CSV.generate_line(fields, **csv_options)) } tempfile.open # Reopen the temporary file update!(report: tempfile) end diff --git a/app/models/study_report/asset_details.rb b/app/models/study_report/asset_details.rb index a3c24a16d9..d4182b2c76 100644 --- a/app/models/study_report/asset_details.rb +++ b/app/models/study_report/asset_details.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module StudyReport::AssetDetails # rubocop:todo Style/Documentation +module StudyReport::AssetDetails def qc_report # rubocop:todo Metrics/AbcSize, Metrics/MethodLength qc_data = { supplier_volume: 0 } diff --git a/app/models/study_report/study_details.rb b/app/models/study_report/study_details.rb index faa89367c5..7842092f0d 100644 --- a/app/models/study_report/study_details.rb +++ b/app/models/study_report/study_details.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # rubocop:todo Metrics/ModuleLength -module StudyReport::StudyDetails # rubocop:todo Style/Documentation +module StudyReport::StudyDetails BATCH_SIZE = 1000 # This will pull out all well ids from stock plates in the study diff --git a/app/models/study_report/well_details.rb b/app/models/study_report/well_details.rb index 914ec223ae..5c6890868d 100644 --- a/app/models/study_report/well_details.rb +++ b/app/models/study_report/well_details.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module StudyReport::WellDetails # rubocop:todo Style/Documentation +module StudyReport::WellDetails def self.included(base) base.class_eval do scope :for_study_report, diff --git a/app/models/study_type.rb b/app/models/study_type.rb index f9b0cba7a2..52c3f97eb1 100644 --- a/app/models/study_type.rb +++ b/app/models/study_type.rb @@ -43,7 +43,7 @@ def self.include?(studytype_name) false end - module Associations # rubocop:todo Style/Documentation + module Associations def self.included(base) base.validates_presence_of :study_type_id base.belongs_to :study_type diff --git a/app/models/submission.rb b/app/models/submission.rb index 129ee8e6ff..9e06d92371 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -85,7 +85,7 @@ def self.render_class # Once submissions progress beyond building, destruction is a risky action and should be prevented. def prevent_destruction_unless_building? - return if destroyable? + return false if destroyable? errors.add(:base, "can only be destroyed when in the 'building' stage. Later submissions should be cancelled.") throw :abort diff --git a/app/models/submission/accession_behaviour.rb b/app/models/submission/accession_behaviour.rb index ec217c0887..b3845f9b15 100644 --- a/app/models/submission/accession_behaviour.rb +++ b/app/models/submission/accession_behaviour.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Submission::AccessionBehaviour # rubocop:todo Style/Documentation +module Submission::AccessionBehaviour def self.included(base) base.class_eval do validate :check_data_release_and_accession_for_submission, if: :can_check_data_release_and_accession? diff --git a/app/models/submission/asset_group_behaviour.rb b/app/models/submission/asset_group_behaviour.rb index 9c03eb243e..2b6e9fb1b3 100644 --- a/app/models/submission/asset_group_behaviour.rb +++ b/app/models/submission/asset_group_behaviour.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Submission::AssetGroupBehaviour # rubocop:todo Style/Documentation +module Submission::AssetGroupBehaviour def self.included(base) base.class_eval do belongs_to :asset_group diff --git a/app/models/submission/asset_submission_finder.rb b/app/models/submission/asset_submission_finder.rb index 421163f2a7..89c0ee5a45 100644 --- a/app/models/submission/asset_submission_finder.rb +++ b/app/models/submission/asset_submission_finder.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Submission::AssetSubmissionFinder # rubocop:todo Style/Documentation +module Submission::AssetSubmissionFinder def is_plate?(details) details['barcode'].present? && details['plate well'].present? end diff --git a/app/models/submission/crossable.rb b/app/models/submission/crossable.rb index 57ab1552b7..c7ada7de14 100644 --- a/app/models/submission/crossable.rb +++ b/app/models/submission/crossable.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Submission::Crossable # rubocop:todo Style/Documentation +module Submission::Crossable def cross_study_allowed assets.any? { |a| a.studies.distinct.many? } end diff --git a/app/models/submission/delayed_job_behaviour.rb b/app/models/submission/delayed_job_behaviour.rb index 074ab72559..e55a165b6e 100644 --- a/app/models/submission/delayed_job_behaviour.rb +++ b/app/models/submission/delayed_job_behaviour.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Submission::DelayedJobBehaviour # rubocop:todo Style/Documentation +module Submission::DelayedJobBehaviour def default_priority configatron.delayed_job.fetch(:submission_process_priority, 0) end diff --git a/app/models/submission/flexible_request_graph.rb b/app/models/submission/flexible_request_graph.rb index 5d61bf075c..a2106ca74f 100644 --- a/app/models/submission/flexible_request_graph.rb +++ b/app/models/submission/flexible_request_graph.rb @@ -11,7 +11,7 @@ module Submission::FlexibleRequestGraph class RequestChainError < RuntimeError end - class RequestChain # rubocop:todo Style/Documentation + class RequestChain attr_reader :order, :source_assets_qc_metrics, :preplexed, :built, :multiplexed alias built? built alias multiplexed? multiplexed @@ -161,7 +161,7 @@ def create_target_asset(source_asset = nil) end end - class MultiplexedLink # rubocop:todo Style/Documentation + class MultiplexedLink include ChainLink def initialize(request_type, multiplier, assets, chain) @@ -204,7 +204,7 @@ def downstream_requests end end - class UnplexedLink # rubocop:todo Style/Documentation + class UnplexedLink include ChainLink def initialize(request_type, multiplier, assets, chain) @@ -227,7 +227,7 @@ def source_assets_doublet_with_index end end - module OrderMethods # rubocop:todo Style/Documentation + module OrderMethods def build_request_graph!(multiplexing_assets = nil) ActiveRecord::Base.transaction do chain = RequestChain.new(self, assets, multiplexing_assets) diff --git a/app/models/submission/order_presenter.rb b/app/models/submission/order_presenter.rb index ccffe44d80..093b030bf6 100644 --- a/app/models/submission/order_presenter.rb +++ b/app/models/submission/order_presenter.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class OrderPresenter # rubocop:todo Style/Documentation +class OrderPresenter attr_accessor :study_id, :project_name, :plate_purpose_id, @@ -17,7 +17,7 @@ def id @target_order.id end - def method_missing(method, *args, &block) - @target_order.send(method, *args, &block) + def method_missing(method, ...) + @target_order.send(method, ...) end end diff --git a/app/models/submission/presenter_skeleton.rb b/app/models/submission/presenter_skeleton.rb index 4662efbf40..264548f759 100644 --- a/app/models/submission/presenter_skeleton.rb +++ b/app/models/submission/presenter_skeleton.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Submission::PresenterSkeleton # rubocop:todo Style/Documentation +class Submission::PresenterSkeleton class_attribute :attributes, instance_writer: false self.attributes = Array.new diff --git a/app/models/submission/priorities.rb b/app/models/submission/priorities.rb index 62e2b9e22f..437c40bde0 100644 --- a/app/models/submission/priorities.rb +++ b/app/models/submission/priorities.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Submission::Priorities # rubocop:todo Style/Documentation +module Submission::Priorities def self.priorities %w[None Low Medium High] end diff --git a/app/models/submission/project_validation.rb b/app/models/submission/project_validation.rb index 7fc2970b62..cf45681a21 100644 --- a/app/models/submission/project_validation.rb +++ b/app/models/submission/project_validation.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Submission::ProjectValidation # rubocop:todo Style/Documentation +module Submission::ProjectValidation def self.included(base) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength base.class_eval do # We probably want to move this validation diff --git a/app/models/submission/request_options_behaviour.rb b/app/models/submission/request_options_behaviour.rb index 073aa0e20d..5b2b455a18 100644 --- a/app/models/submission/request_options_behaviour.rb +++ b/app/models/submission/request_options_behaviour.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Submission::RequestOptionsBehaviour # rubocop:todo Style/Documentation +module Submission::RequestOptionsBehaviour # Ensures the hash gets loaded with indifferent access. # Note: We can't just specify the class, as otherwise legacy # hashes throw an exception @@ -41,7 +41,7 @@ def check_multipliers_are_valid # rubocop:todo Metrics/CyclomaticComplexity # TODO[xxx]: should probably error if they've specified a request type that isn't being used errors.add(:request_options, 'negative multiplier supplied') if multipliers.values.map(&:to_i).any?(&:negative?) errors.add(:request_options, 'zero multiplier supplied') if multipliers.values.map(&:to_i).any?(&:zero?) - return false unless errors.empty? + false unless errors.empty? end # rubocop:enable Metrics/AbcSize, Metrics/PerceivedComplexity diff --git a/app/models/submission/state_machine.rb b/app/models/submission/state_machine.rb index 2570f2bc2f..42f7bb5bac 100644 --- a/app/models/submission/state_machine.rb +++ b/app/models/submission/state_machine.rb @@ -29,7 +29,7 @@ def editable? end end - module InstanceMethods # rubocop:todo Style/Documentation + module InstanceMethods def valid_for_leaving_building_state raise ActiveRecord::RecordInvalid, self unless valid? end diff --git a/app/models/submission/submission_presenter.rb b/app/models/submission/submission_presenter.rb index 5fd9a17ff2..c441182905 100644 --- a/app/models/submission/submission_presenter.rb +++ b/app/models/submission/submission_presenter.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Submission::SubmissionPresenter < Submission::PresenterSkeleton # rubocop:todo Style/Documentation +class Submission::SubmissionPresenter < Submission::PresenterSkeleton self.attributes = [:id] def submission diff --git a/app/models/submission_pool.rb b/app/models/submission_pool.rb index 07cdd5dda8..f823d4c937 100644 --- a/app/models/submission_pool.rb +++ b/app/models/submission_pool.rb @@ -2,7 +2,7 @@ # SubmissionPools are designed to view submissions in the context of a particular asset class SubmissionPool < ApplicationRecord module Association - module Plate # rubocop:todo Style/Documentation + module Plate def self.included(base) base.class_eval do has_many :submission_pools, -> { distinct }, through: :well_requests_as_target diff --git a/app/models/swipecardable.rb b/app/models/swipecardable.rb index 08f337ce5a..a6e8158eb6 100644 --- a/app/models/swipecardable.rb +++ b/app/models/swipecardable.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Swipecardable # rubocop:todo Style/Documentation +module Swipecardable def swipecard_code=(code) self.encrypted_swipecard_code = User.encrypt_swipecard_code(code) end diff --git a/app/models/tag.rb b/app/models/tag.rb index f883e4463d..c505f2ec15 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -7,7 +7,7 @@ # Tag is stored on aliquot, and an individual aliquot can have two tags # identified as tag and tag2, these may also be known as i7 and i5 respectively. class Tag < ApplicationRecord - module Associations # rubocop:todo Style/Documentation + module Associations def untag! aliquots.first.try(:update!, tag: nil) end diff --git a/app/models/tag_group.rb b/app/models/tag_group.rb index 2fae1f0319..9203bb8d4e 100644 --- a/app/models/tag_group.rb +++ b/app/models/tag_group.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class TagGroup < ApplicationRecord # rubocop:todo Style/Documentation +class TagGroup < ApplicationRecord CHROMIUM_ADAPTER_TYPE = 'Chromium' include Uuid::Uuidable diff --git a/app/models/tag_group/form_object.rb b/app/models/tag_group/form_object.rb index 60076d5f7a..b1a5272737 100644 --- a/app/models/tag_group/form_object.rb +++ b/app/models/tag_group/form_object.rb @@ -54,7 +54,7 @@ def check_entered_oligos # rubocop:todo Metrics/AbcSize invalid_oligos_list << cur_oligo end end - unless invalid_oligos_list.size.zero? + unless invalid_oligos_list.empty? errors.add(:base, I18n.t('tag_groups.errors.invalid_oligos_found') + invalid_oligos_list.join(',')) end errors.add(:base, I18n.t('tag_groups.errors.no_valid_oligos_found')) if valid_oligos_hash.empty? diff --git a/app/models/tag_layout/as_group_by_plate.rb b/app/models/tag_layout/as_group_by_plate.rb index 9ef553c141..82622c787a 100644 --- a/app/models/tag_layout/as_group_by_plate.rb +++ b/app/models/tag_layout/as_group_by_plate.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # Assigns multiple tags to each well. -class TagLayout::AsGroupByPlate < TagLayout::Walker # rubocop:todo Style/Documentation +class TagLayout::AsGroupByPlate < TagLayout::Walker DEFAULT_TAGS_PER_WELL = 4 self.walking_by = 'as group by plate' diff --git a/app/models/tag_layout/walk_manual_wells_by_pools.rb b/app/models/tag_layout/walk_manual_wells_by_pools.rb index bb5fdd7257..0e900b45e6 100644 --- a/app/models/tag_layout/walk_manual_wells_by_pools.rb +++ b/app/models/tag_layout/walk_manual_wells_by_pools.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class TagLayout::WalkManualWellsByPools < TagLayout::Walker # rubocop:todo Style/Documentation +class TagLayout::WalkManualWellsByPools < TagLayout::Walker self.walking_by = 'wells in pools' def walk_wells diff --git a/app/models/tag_layout/walk_manual_wells_of_plate.rb b/app/models/tag_layout/walk_manual_wells_of_plate.rb index 2ff766ff40..c386cb715a 100644 --- a/app/models/tag_layout/walk_manual_wells_of_plate.rb +++ b/app/models/tag_layout/walk_manual_wells_of_plate.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class TagLayout::WalkManualWellsOfPlate < TagLayout::Walker # rubocop:todo Style/Documentation +class TagLayout::WalkManualWellsOfPlate < TagLayout::Walker self.walking_by = 'wells of plate' def walk_wells diff --git a/app/models/tag_layout/walk_wells_by_pools.rb b/app/models/tag_layout/walk_wells_by_pools.rb index 478af1251d..e69213ed3c 100644 --- a/app/models/tag_layout/walk_wells_by_pools.rb +++ b/app/models/tag_layout/walk_wells_by_pools.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class TagLayout::WalkWellsByPools < TagLayout::Walker # rubocop:todo Style/Documentation +class TagLayout::WalkWellsByPools < TagLayout::Walker self.walking_by = 'wells in pools' # rubocop:todo Metrics/PerceivedComplexity, Metrics/MethodLength, Metrics/AbcSize diff --git a/app/models/tag_layout/walk_wells_of_plate.rb b/app/models/tag_layout/walk_wells_of_plate.rb index ccf2fe7e4e..d16a23ef12 100644 --- a/app/models/tag_layout/walk_wells_of_plate.rb +++ b/app/models/tag_layout/walk_wells_of_plate.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class TagLayout::WalkWellsOfPlate < TagLayout::Walker # rubocop:todo Style/Documentation +class TagLayout::WalkWellsOfPlate < TagLayout::Walker self.walking_by = 'wells of plate' def walk_wells diff --git a/app/models/tag_substitution.rb b/app/models/tag_substitution.rb index a3d91f177e..19ecfef63a 100644 --- a/app/models/tag_substitution.rb +++ b/app/models/tag_substitution.rb @@ -106,7 +106,7 @@ def save # rubocop:todo Metrics/MethodLength true rescue ActiveRecord::RecordNotUnique => e # We'll specifically handle tag clashes here so that we can produce more informative messages - raise e unless /aliquot_tag_tag2_and_tag_depth_are_unique_within_receptacle/.match?(e.message) + raise e unless e.message.include?('aliquot_tag_tag2_and_tag_depth_are_unique_within_receptacle') errors.add(:base, 'A tag clash was detected while performing the substitutions. No changes have been made.') false diff --git a/app/models/tasks/plate_transfer_handler.rb b/app/models/tasks/plate_transfer_handler.rb index 79bf21587d..43178f603e 100644 --- a/app/models/tasks/plate_transfer_handler.rb +++ b/app/models/tasks/plate_transfer_handler.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Tasks::PlateTransferHandler # rubocop:todo Style/Documentation +module Tasks::PlateTransferHandler class InvalidBatch < StandardError end diff --git a/app/models/tasks/set_descriptors_handler.rb b/app/models/tasks/set_descriptors_handler.rb index 0c62811a43..c4446d183c 100644 --- a/app/models/tasks/set_descriptors_handler.rb +++ b/app/models/tasks/set_descriptors_handler.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Tasks::SetDescriptorsHandler # rubocop:todo Style/Documentation +module Tasks::SetDescriptorsHandler # The Setter handles the processing of each task, and actually performs the # actions. class Handler < Tasks::BaseHandler diff --git a/app/models/transfer/between_plate_and_tubes.rb b/app/models/transfer/between_plate_and_tubes.rb index 83bacbdf36..72755690ed 100644 --- a/app/models/transfer/between_plate_and_tubes.rb +++ b/app/models/transfer/between_plate_and_tubes.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -class Transfer::BetweenPlateAndTubes < Transfer # rubocop:todo Style/Documentation +class Transfer::BetweenPlateAndTubes < Transfer DESTINATION_INCLUDES = { destination: %i[uuid_object barcodes] }.freeze - class WellToTube < ApplicationRecord # rubocop:todo Style/Documentation + class WellToTube < ApplicationRecord self.table_name = ('well_to_tube_transfers') belongs_to :transfer, class_name: 'Transfer::BetweenPlateAndTubes' diff --git a/app/models/transfer/between_specific_tubes.rb b/app/models/transfer/between_specific_tubes.rb index ded5108241..87cd4d9b74 100644 --- a/app/models/transfer/between_specific_tubes.rb +++ b/app/models/transfer/between_specific_tubes.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Transfer::BetweenSpecificTubes < Transfer # rubocop:todo Style/Documentation +class Transfer::BetweenSpecificTubes < Transfer include TransfersToKnownDestination belongs_to :source, class_name: 'Tube' diff --git a/app/models/transfer/between_tubes_by_submission.rb b/app/models/transfer/between_tubes_by_submission.rb index 07b81d9a53..a062a78de0 100644 --- a/app/models/transfer/between_tubes_by_submission.rb +++ b/app/models/transfer/between_tubes_by_submission.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Transfer::BetweenTubesBySubmission < Transfer # rubocop:todo Style/Documentation +class Transfer::BetweenTubesBySubmission < Transfer include TransfersToKnownDestination before_validation :ensure_destination_setup diff --git a/app/models/transfer/from_plate_to_specific_tubes.rb b/app/models/transfer/from_plate_to_specific_tubes.rb index 947b5b2056..3cd7ab1466 100644 --- a/app/models/transfer/from_plate_to_specific_tubes.rb +++ b/app/models/transfer/from_plate_to_specific_tubes.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Transfer::FromPlateToSpecificTubes < Transfer::BetweenPlateAndTubes # rubocop:todo Style/Documentation +class Transfer::FromPlateToSpecificTubes < Transfer::BetweenPlateAndTubes # NOTE: This class appears to have been unused since July 2014. # We still have persistent models in the database, so need to make # sure records are updated when we strip this out. However, as diff --git a/app/models/transfer/from_plate_to_specific_tubes_by_pool.rb b/app/models/transfer/from_plate_to_specific_tubes_by_pool.rb index a32b54b924..110a88ab4a 100644 --- a/app/models/transfer/from_plate_to_specific_tubes_by_pool.rb +++ b/app/models/transfer/from_plate_to_specific_tubes_by_pool.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class Transfer::FromPlateToSpecificTubesByPool < Transfer::BetweenPlateAndTubes # rubocop:todo Style/Documentation +class Transfer::FromPlateToSpecificTubesByPool < Transfer::BetweenPlateAndTubes # Not used since 2017-07-24 10:32:21 attr_reader :targets diff --git a/app/models/transfer_request.rb b/app/models/transfer_request.rb index 62b9ce55e9..6766221231 100644 --- a/app/models/transfer_request.rb +++ b/app/models/transfer_request.rb @@ -225,7 +225,7 @@ def perform_transfer_of_contents target_asset.aliquots << aliquots_for_transfer rescue ActiveRecord::RecordNotUnique => e # We'll specifically handle tag clashes here so that we can produce more informative messages - raise e unless /aliquot_tag_tag2_and_tag_depth_are_unique_within_receptacle/.match?(e.message) + raise e unless e.message.include?('aliquot_tag_tag2_and_tag_depth_are_unique_within_receptacle') message = "#{asset.display_name} contains aliquots which can't be transferred due to tag clash" errors.add(:asset, message) diff --git a/app/models/tube/purpose.rb b/app/models/tube/purpose.rb index 786eb92551..6bc0134d1d 100644 --- a/app/models/tube/purpose.rb +++ b/app/models/tube/purpose.rb @@ -3,7 +3,7 @@ # {Tube} is playing within the lab, and my modify its behaviour. # This is not an abstract class, and can be used directly. # @see Purpose -class Tube::Purpose < ::Purpose +class Tube::Purpose < Purpose self.default_prefix = 'NT' self.state_changer = StateChanger::StockTube diff --git a/app/models/tube_creation.rb b/app/models/tube_creation.rb index 29a4f1f675..21b1fa62c9 100644 --- a/app/models/tube_creation.rb +++ b/app/models/tube_creation.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # Create one tube per pool for the provided parent class TubeCreation < AssetCreation - class ChildTube < ApplicationRecord # rubocop:todo Style/Documentation + class ChildTube < ApplicationRecord self.table_name = ('tube_creation_children') belongs_to :tube_creation belongs_to :tube diff --git a/app/models/tube_rack/purpose.rb b/app/models/tube_rack/purpose.rb index 3c08f4d7bf..01ecbc3228 100644 --- a/app/models/tube_rack/purpose.rb +++ b/app/models/tube_rack/purpose.rb @@ -2,7 +2,7 @@ # The purpose of a tube rack is to hold tubes. # Created to hold the size of the tube rack for use when generating manifests. -class TubeRack::Purpose < ::Purpose +class TubeRack::Purpose < Purpose self.default_prefix = 'TR' has_many :sample_manifests, inverse_of: :tube_rack_purpose, dependent: :restrict_with_exception diff --git a/app/models/ui_helper/summary.rb b/app/models/ui_helper/summary.rb index 757c14cc7a..54340af4a8 100644 --- a/app/models/ui_helper/summary.rb +++ b/app/models/ui_helper/summary.rb @@ -4,7 +4,7 @@ require 'will_paginate/array' module UiHelper - class Summary # rubocop:todo Style/Documentation + class Summary attr_accessor :summary_items, :current_page def initialize(options = {}) diff --git a/app/models/ui_helper/summary_item.rb b/app/models/ui_helper/summary_item.rb index 4af3437322..884ec52c00 100644 --- a/app/models/ui_helper/summary_item.rb +++ b/app/models/ui_helper/summary_item.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module UiHelper - class SummaryItem # rubocop:todo Style/Documentation + class SummaryItem attr_accessor :message, :object, :timestamp, :external_link, :external_message def initialize(options = {}) diff --git a/app/models/user/authentication.rb b/app/models/user/authentication.rb index 618df07772..2c156b1363 100644 --- a/app/models/user/authentication.rb +++ b/app/models/user/authentication.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module User::Authentication # rubocop:todo Style/Documentation +module User::Authentication def self.included(base) base.class_eval do extend ClassMethods @@ -33,7 +33,7 @@ def update_profile_via_ldap # rubocop:todo Metrics/AbcSize end private :update_profile_via_ldap - module ClassMethods # rubocop:todo Style/Documentation + module ClassMethods # Authenticates a user by their login name and unencrypted password. Returns the user or nil. def authenticate(login, password) case configatron.authentication @@ -50,7 +50,7 @@ def authenticate(login, password) end end - module Ldap # rubocop:todo Style/Documentation + module Ldap def authenticate_with_ldap(login, password) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength # TODO: - Extract LDAP specifics to configuration username = "uid=#{login},ou=people,dc=sanger,dc=ac,dc=uk" @@ -93,7 +93,7 @@ def register_or_update_via_ldap(login) end end - module Local # rubocop:todo Style/Documentation + module Local def authenticate_by_local(login, password) u = find_by(login: login) # need to get the salt u && u.authenticated?(password) ? u : nil diff --git a/app/models/uuid.rb b/app/models/uuid.rb index 7c1a1ee7cb..ec29927114 100644 --- a/app/models/uuid.rb +++ b/app/models/uuid.rb @@ -5,7 +5,7 @@ class Uuid < ApplicationRecord # Allows tests to dictate the next UUID generted for a given class class_attribute :store_for_tests - module Uuidable # rubocop:todo Style/Documentation + module Uuidable def self.included(base) base.class_eval do # Lazy uuid generation disables uuid generation on record creation. For the most part this is @@ -60,7 +60,7 @@ def uuid end end - ValidRegexp = /\A[\da-f]{8}(-[\da-f]{4}){3}-[\da-f]{12}\z/.freeze + ValidRegexp = /\A[\da-f]{8}(-[\da-f]{4}){3}-[\da-f]{12}\z/ validates :external_id, format: { with: ValidRegexp } # It is more efficient to check the individual parts of the resource association than it is to check the diff --git a/app/models/well.rb b/app/models/well.rb index d6aa261452..ae1f3937f1 100644 --- a/app/models/well.rb +++ b/app/models/well.rb @@ -15,7 +15,7 @@ class Well < Receptacle # rubocop:todo Metrics/ClassLength include Api::Messages::FluidigmPlateIO::WellExtensions include Api::Messages::QcResultIO::WellExtensions - class Link < ApplicationRecord # rubocop:todo Style/Documentation + class Link < ApplicationRecord # Caution! We are using delete_all and import to manage well links. # Any callbacks you add here will not be called in those circumstances. self.table_name = 'well_links' diff --git a/app/sample_manifest_excel/sample_manifest_excel/upload/converters.rb b/app/sample_manifest_excel/sample_manifest_excel/upload/converters.rb index 40207eafa8..528c350af1 100644 --- a/app/sample_manifest_excel/sample_manifest_excel/upload/converters.rb +++ b/app/sample_manifest_excel/sample_manifest_excel/upload/converters.rb @@ -2,9 +2,9 @@ module SampleManifestExcel module Upload - module Converters # rubocop:todo Style/Documentation + module Converters BLANK_CHARS = '[ \u00A0]' - BLANK_CHARS_REGEXP = /^(#{Converters::BLANK_CHARS}*)(.*?)(#{Converters::BLANK_CHARS}*)$/.freeze + BLANK_CHARS_REGEXP = /^(#{Converters::BLANK_CHARS}*)(.*?)(#{Converters::BLANK_CHARS}*)$/ def strip_all_blanks(obj) obj.respond_to?(:match) ? obj.match(BLANK_CHARS_REGEXP)[2] : obj diff --git a/app/sample_manifest_excel/sample_manifest_excel/upload/row.rb b/app/sample_manifest_excel/sample_manifest_excel/upload/row.rb index 96dff54a51..75e61c0f3f 100644 --- a/app/sample_manifest_excel/sample_manifest_excel/upload/row.rb +++ b/app/sample_manifest_excel/sample_manifest_excel/upload/row.rb @@ -183,7 +183,7 @@ def manifest_asset end def sanger_sample_id_exists? - return if manifest_asset.present? + return false if manifest_asset.present? errors.add(:base, "#{row_title} Cannot find sample manifest for Sanger ID: #{sanger_sample_id}") end diff --git a/app/sequencescape_excel/sequencescape_excel/configuration.rb b/app/sequencescape_excel/sequencescape_excel/configuration.rb index 4c32f71255..12d6463cef 100644 --- a/app/sequencescape_excel/sequencescape_excel/configuration.rb +++ b/app/sequencescape_excel/sequencescape_excel/configuration.rb @@ -78,6 +78,8 @@ def ==(other) all == other.all end + delegate :count, to: :all + private def column_sets diff --git a/app/sequencescape_excel/sequencescape_excel/specialised_field/tag2_index.rb b/app/sequencescape_excel/sequencescape_excel/specialised_field/tag2_index.rb index 994372ffa8..3e49555388 100644 --- a/app/sequencescape_excel/sequencescape_excel/specialised_field/tag2_index.rb +++ b/app/sequencescape_excel/sequencescape_excel/specialised_field/tag2_index.rb @@ -29,8 +29,7 @@ def tag ::Tag .where.not(tag_group_id: nil) .where.not(map_id: nil) - .where(tag_group_id: sf_tag2_group.tag2_group_id, map_id: value) - .take + .find_by(tag_group_id: sf_tag2_group.tag2_group_id, map_id: value) end # check the index exists within the group exists here, check the group/index combination later diff --git a/app/sequencescape_excel/sequencescape_excel/specialised_field/tag_index.rb b/app/sequencescape_excel/sequencescape_excel/specialised_field/tag_index.rb index 1ef6949d2b..4f4a7d010e 100644 --- a/app/sequencescape_excel/sequencescape_excel/specialised_field/tag_index.rb +++ b/app/sequencescape_excel/sequencescape_excel/specialised_field/tag_index.rb @@ -29,8 +29,7 @@ def tag ::Tag .where.not(tag_group_id: nil) .where.not(map_id: nil) - .where(tag_group_id: sf_tag_group.tag_group_id, map_id: value) - .take + .find_by(tag_group_id: sf_tag_group.tag_group_id, map_id: value) end # check the index exists within the group exists here, check the group/index combination later diff --git a/app/sequencescape_excel/sequencescape_excel/validation.rb b/app/sequencescape_excel/sequencescape_excel/validation.rb index fe78a50130..346526ddd8 100644 --- a/app/sequencescape_excel/sequencescape_excel/validation.rb +++ b/app/sequencescape_excel/sequencescape_excel/validation.rb @@ -28,7 +28,7 @@ def update(attributes = {}) @reference = attributes[:reference] @range = attributes[:range] - @worksheet_validation = attributes[:worksheet].add_data_validation(attributes[:reference], sanitized_options) + @worksheet_validation = attributes[:worksheet].add_data_validation(attributes[:reference], **sanitized_options) end ## diff --git a/app/uploaders/polymorphic_uploader.rb b/app/uploaders/polymorphic_uploader.rb index 6aaa8d7fdb..6f067a5c55 100644 --- a/app/uploaders/polymorphic_uploader.rb +++ b/app/uploaders/polymorphic_uploader.rb @@ -17,7 +17,7 @@ def retrieve!(identifier) CarrierWave::Storage::DirectDatabase::File.new(uploader, self, uploader.store_path(identifier)) end - class File # rubocop:todo Style/Documentation + class File def initialize(uploader, base, path) @uploader = uploader @path = path @@ -76,7 +76,7 @@ def destroy_file end end -class PolymorphicUploader < CarrierWave::Uploader::Base # rubocop:todo Style/Documentation +class PolymorphicUploader < CarrierWave::Uploader::Base def initialize(*args, &block) super end @@ -107,8 +107,6 @@ def remember_cache_id(_new_file) def delete_tmp_dir(_new_file) # make sure we don't delete other things accidentally by checking the name pattern - if @cache_id_was.present? && @cache_id_was =~ /\A\d{8}-\d{4}-\d+-\d{4}\z/ - FileUtils.rm_rf(File.join(cache_dir, @cache_id_was)) - end + FileUtils.rm_rf(File.join(cache_dir, @cache_id_was)) if @cache_id_was.present? && @cache_id_was =~ /\A[\d-]*\z/ end end diff --git a/app/validators/latin1_validator.rb b/app/validators/latin1_validator.rb index 1f61b32e14..0fbe9e71c1 100644 --- a/app/validators/latin1_validator.rb +++ b/app/validators/latin1_validator.rb @@ -12,7 +12,7 @@ def validate_each(record, attribute, value) return true if value.blank? value.encode('cp1252') - return true if value.encode('cp1252').valid_encoding? + true if value.encode('cp1252').valid_encoding? rescue Encoding::UndefinedConversionError => e record.errors[attribute] << # rubocop:todo Rails/DeprecatedActiveModelErrorsMethods ( diff --git a/app/views/admin/bait_libraries/bait_library_suppliers/edit.html.erb b/app/views/admin/bait_libraries/bait_library_suppliers/edit.html.erb index 8e6eee3ac2..2299f793be 100644 --- a/app/views/admin/bait_libraries/bait_library_suppliers/edit.html.erb +++ b/app/views/admin/bait_libraries/bait_library_suppliers/edit.html.erb @@ -2,7 +2,7 @@ <%= page_title 'Bait Library Supplier', 'Edit' %> <%= form_for([:admin,@bait_library_supplier]) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@bait_library_supplier) %> <%= render partial: "edit_form", locals: {f: f } %>

diff --git a/app/views/admin/bait_libraries/bait_library_suppliers/new.html.erb b/app/views/admin/bait_libraries/bait_library_suppliers/new.html.erb index bd1c520a13..e74919c5fe 100644 --- a/app/views/admin/bait_libraries/bait_library_suppliers/new.html.erb +++ b/app/views/admin/bait_libraries/bait_library_suppliers/new.html.erb @@ -2,7 +2,7 @@ <%= page_title 'Bait Library Supplier', 'New' %> <%= form_for([:admin,@bait_library_supplier]) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@bait_library_supplier) %> <%= render partial: "edit_form", locals: {f: f } %>

diff --git a/app/views/admin/bait_libraries/bait_library_types/edit.html.erb b/app/views/admin/bait_libraries/bait_library_types/edit.html.erb index 973b42c03f..ae08372a3e 100644 --- a/app/views/admin/bait_libraries/bait_library_types/edit.html.erb +++ b/app/views/admin/bait_libraries/bait_library_types/edit.html.erb @@ -2,7 +2,7 @@ <%= page_title "Bait Library Type", "Edit" %> <%= form_for([:admin,@bait_library_type]) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@bait_library_type) %> <%= render partial: "edit_form", locals: {f: f } %>

diff --git a/app/views/admin/bait_libraries/bait_library_types/new.html.erb b/app/views/admin/bait_libraries/bait_library_types/new.html.erb index d6713f7126..847f72b91d 100644 --- a/app/views/admin/bait_libraries/bait_library_types/new.html.erb +++ b/app/views/admin/bait_libraries/bait_library_types/new.html.erb @@ -2,7 +2,7 @@ <%= page_title "Bait Library Type", "New" %> <%= form_for([:admin,@bait_library_type]) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@bait_library_type) %> <%= render partial: "edit_form", locals: {f: f } %>

diff --git a/app/views/admin/bait_libraries/edit.html.erb b/app/views/admin/bait_libraries/edit.html.erb index 0935f27f8c..ed3115597c 100644 --- a/app/views/admin/bait_libraries/edit.html.erb +++ b/app/views/admin/bait_libraries/edit.html.erb @@ -2,7 +2,7 @@ <%= page_title 'Bait Library', 'Edit' %> <%= form_for([:admin,@bait_library]) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@bait_library) %> <%= render partial: "edit_form", locals: {f: f } %>

diff --git a/app/views/admin/bait_libraries/new.html.erb b/app/views/admin/bait_libraries/new.html.erb index 46d1acbdc7..4b9128e354 100644 --- a/app/views/admin/bait_libraries/new.html.erb +++ b/app/views/admin/bait_libraries/new.html.erb @@ -2,7 +2,7 @@ <%= page_title 'Bait Library', 'New' %> <%= form_for([:admin,@bait_library]) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@bait_library) %> <%= render partial: "edit_form", locals: {f: f } %>

diff --git a/app/views/admin/faculty_sponsors/edit.html.erb b/app/views/admin/faculty_sponsors/edit.html.erb index e2f8279799..bee275ae78 100644 --- a/app/views/admin/faculty_sponsors/edit.html.erb +++ b/app/views/admin/faculty_sponsors/edit.html.erb @@ -2,7 +2,7 @@ <%= page_title 'Faculty Sponsor', 'Edit' %> <%= form_for([:admin,@faculty_sponsor]) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@faculty_sponsor) %>

<%= f.label :name %>
diff --git a/app/views/admin/faculty_sponsors/new.html.erb b/app/views/admin/faculty_sponsors/new.html.erb index c37b6ea986..82c80e913e 100644 --- a/app/views/admin/faculty_sponsors/new.html.erb +++ b/app/views/admin/faculty_sponsors/new.html.erb @@ -2,7 +2,7 @@

<%= form_for([:admin,@faculty_sponsor]) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@faculty_sponsor) %>

<%= f.label :name %>
diff --git a/app/views/admin/plate_purposes/edit.html.erb b/app/views/admin/plate_purposes/edit.html.erb index 157848ec7b..50daffad44 100644 --- a/app/views/admin/plate_purposes/edit.html.erb +++ b/app/views/admin/plate_purposes/edit.html.erb @@ -2,7 +2,7 @@

<%= form_for([:admin,@plate_purpose]) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@plate_purpose) %>

<%= f.label :name %>
diff --git a/app/views/admin/plate_purposes/new.html.erb b/app/views/admin/plate_purposes/new.html.erb index 36093709b0..3d53ce6184 100644 --- a/app/views/admin/plate_purposes/new.html.erb +++ b/app/views/admin/plate_purposes/new.html.erb @@ -2,7 +2,7 @@

<%= form_for([:admin,@plate_purpose]) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@plate_purpose) %>

<%= f.label :name %>
diff --git a/app/views/admin/primer_panels/edit.html.erb b/app/views/admin/primer_panels/edit.html.erb index 91be06fcbf..898c7fcd91 100644 --- a/app/views/admin/primer_panels/edit.html.erb +++ b/app/views/admin/primer_panels/edit.html.erb @@ -7,7 +7,7 @@ <% end %> <%= form_for([:admin, @primer_panel]) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@primer_panel) %> <%= render partial: "edit_form", locals: {f: f } %>

diff --git a/app/views/admin/primer_panels/new.html.erb b/app/views/admin/primer_panels/new.html.erb index a2a8c8fca7..c88df9f87b 100644 --- a/app/views/admin/primer_panels/new.html.erb +++ b/app/views/admin/primer_panels/new.html.erb @@ -2,7 +2,7 @@ <%= page_title 'Primer Panel', 'New' %> <%= form_for([:admin,@primer_panel]) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@primer_panel) %> <%= render partial: "edit_form", locals: {f: f } %>

diff --git a/app/views/admin/programs/edit.html.erb b/app/views/admin/programs/edit.html.erb index 4b72ad6aa5..7fe39a3859 100644 --- a/app/views/admin/programs/edit.html.erb +++ b/app/views/admin/programs/edit.html.erb @@ -1,7 +1,7 @@

<%= form_for([:admin,@program]) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@program) %>

<%= f.label :name %>
diff --git a/app/views/admin/programs/new.html.erb b/app/views/admin/programs/new.html.erb index 2f8a65cb91..981ed25044 100644 --- a/app/views/admin/programs/new.html.erb +++ b/app/views/admin/programs/new.html.erb @@ -1,7 +1,7 @@

<%= form_for([:admin,@program]) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@program) %>

<%= f.label :name %>
diff --git a/app/views/admin/robot_properties/edit.html.erb b/app/views/admin/robot_properties/edit.html.erb index fefeb9c0e4..522939c54b 100644 --- a/app/views/admin/robot_properties/edit.html.erb +++ b/app/views/admin/robot_properties/edit.html.erb @@ -2,7 +2,7 @@

<%= form_for([@robot, @robot_property], url: admin_robot_robot_property_path(@robot, @robot_property)) do |f| %> -<%= f.error_messages %> +<%= render_error_messages(@robot_property) %>

<%= f.label :name %>
diff --git a/app/views/admin/robot_properties/new.html.erb b/app/views/admin/robot_properties/new.html.erb index 3bf447615c..1330a50fc5 100644 --- a/app/views/admin/robot_properties/new.html.erb +++ b/app/views/admin/robot_properties/new.html.erb @@ -2,7 +2,7 @@

<%= form_for([:admin,@robot, @robot_property]) do |f| %> -<%= f.error_messages %> +<%= render_error_messages(@robot_property) %>

<%= f.label :name %>
diff --git a/app/views/admin/robots/edit.html.erb b/app/views/admin/robots/edit.html.erb index 35d933f291..44143ae50a 100644 --- a/app/views/admin/robots/edit.html.erb +++ b/app/views/admin/robots/edit.html.erb @@ -2,7 +2,7 @@

<%= form_for(@robot, url: admin_robot_path(@robot)) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@robot) %>

<%= f.label :name %>
diff --git a/app/views/admin/robots/new.html.erb b/app/views/admin/robots/new.html.erb index ee9a3fda92..d00413efeb 100644 --- a/app/views/admin/robots/new.html.erb +++ b/app/views/admin/robots/new.html.erb @@ -2,7 +2,7 @@

<%= form_for(@robot, url: admin_robots_path ) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@robot) %>

<%= f.label :name %>
diff --git a/app/views/admin/roles/new.html.erb b/app/views/admin/roles/new.html.erb index 666c6c09b0..8ca54af87d 100644 --- a/app/views/admin/roles/new.html.erb +++ b/app/views/admin/roles/new.html.erb @@ -1,7 +1,7 @@

<%= form_for(@role, url: admin_roles_path) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@role) %>

<%= f.text_field :name %>

diff --git a/app/views/barcode_printers/__edit_barcode_printer.html.erb b/app/views/barcode_printers/__edit_barcode_printer.html.erb index 5c1710659d..ea1abde233 100644 --- a/app/views/barcode_printers/__edit_barcode_printer.html.erb +++ b/app/views/barcode_printers/__edit_barcode_printer.html.erb @@ -1,6 +1,6 @@ <%= form_for(@barcode_printer) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@barcode_printer) %>

<%= f.label :name %>
<%= f.text_field :name %> diff --git a/app/views/batches/show.xml.builder b/app/views/batches/show.xml.builder index e2416d9fa6..e0c6cf3701 100644 --- a/app/views/batches/show.xml.builder +++ b/app/views/batches/show.xml.builder @@ -24,7 +24,7 @@ xml.batch do :submission ] ) - .each do |batch_request| + .find_each do |batch_request| request = batch_request.request xml.lane( 'position' => batch_request.position, diff --git a/app/views/labware/edit.html.erb b/app/views/labware/edit.html.erb index 297f9b68d3..2392e535c4 100644 --- a/app/views/labware/edit.html.erb +++ b/app/views/labware/edit.html.erb @@ -3,7 +3,7 @@ <%= form_for(@asset,url: labware_path(@asset),as:'labware') do |f| %> <%= alert do %> - <%= f.error_messages %> + <%= render_error_messages(@asset) %> <% end %> <% if can? :rename, @asset %> diff --git a/app/views/projects/_project_form.html.erb b/app/views/projects/_project_form.html.erb index aa4d67e15d..2db3961390 100644 --- a/app/views/projects/_project_form.html.erb +++ b/app/views/projects/_project_form.html.erb @@ -1,6 +1,6 @@ <%= form_for(@project) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@project) %> <%= form_collection(f.label(:name, nil, class: 'required'), f.text_field(:name, class: 'form-control' ) ) %> diff --git a/app/views/quad_stamp/new.html.erb b/app/views/quad_stamp/new.html.erb index 4282a59c54..ef2f7a6016 100644 --- a/app/views/quad_stamp/new.html.erb +++ b/app/views/quad_stamp/new.html.erb @@ -3,7 +3,7 @@ <%= page_title 'Quadrant Stamping', 'Create' %> -<%= error_messages_for(@quad_creator) %> +<%= render_error_messages(@quad_creator) %> <%= semantic_form_for(:quad_creator, url: quad_stamp_index_path) do |form| %>

diff --git a/app/views/receptacles/edit.html.erb b/app/views/receptacles/edit.html.erb index d6f5bcf702..15ba7718dd 100644 --- a/app/views/receptacles/edit.html.erb +++ b/app/views/receptacles/edit.html.erb @@ -3,7 +3,7 @@ <%= form_for(@asset,url: receptacle_path(@asset),as:'asset') do |f| %> <%= alert do %> - <%= f.error_messages %> + <%= render_error_messages(@asset) %> <% end %> <% if @asset.is_a?(Lane) %> diff --git a/app/views/receptacles/new_request.html.erb b/app/views/receptacles/new_request.html.erb index cb428d5861..b1b1d489d9 100644 --- a/app/views/receptacles/new_request.html.erb +++ b/app/views/receptacles/new_request.html.erb @@ -2,7 +2,7 @@ <%= page_title "New request", "#{@asset.label} - #{@asset.display_name}" %> <% can_edit = can? :edit_additional, Request %> <%= form_for(@asset, url: create_request_receptacle_url(@asset), html: {method: :post}) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@asset) %>

Submission Options

diff --git a/app/views/reference_genomes/edit.html.erb b/app/views/reference_genomes/edit.html.erb index 9544ff62f1..b9e256047e 100644 --- a/app/views/reference_genomes/edit.html.erb +++ b/app/views/reference_genomes/edit.html.erb @@ -2,7 +2,7 @@ <%= form_for(@reference_genome) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@reference_genome) %>

<%= f.label :name %>
diff --git a/app/views/reference_genomes/new.html.erb b/app/views/reference_genomes/new.html.erb index e9f5e5173c..8a368971ec 100644 --- a/app/views/reference_genomes/new.html.erb +++ b/app/views/reference_genomes/new.html.erb @@ -2,7 +2,7 @@

<%= form_for(@reference_genome) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@reference_genome) %>

<%= f.label :name %>
diff --git a/app/views/requests/filter_change_decision.html.erb b/app/views/requests/filter_change_decision.html.erb index 04665d77ad..b58388ed54 100644 --- a/app/views/requests/filter_change_decision.html.erb +++ b/app/views/requests/filter_change_decision.html.erb @@ -7,7 +7,7 @@ <% if @request.finished? %>

<%= form_for(:change_decision, url: change_decision_request_path(@change_decision.request), html: {method: :put}) do |form| -%> - <%= error_messages_for :change_decision %> + <%= render_error_messages(@change_decision) %>
  • <%= label_tag(:request_state_name, 'Request State') %>

      diff --git a/app/views/samples/index.xml.builder b/app/views/samples/index.xml.builder index 504b9c1c86..157f99a047 100644 --- a/app/views/samples/index.xml.builder +++ b/app/views/samples/index.xml.builder @@ -1,7 +1,7 @@ # frozen_string_literal: true xml.instruct! if @exclude_nested_resource - xml.samples({ type: 'array' }) { |samples| Sample.all.each { |p| samples.study { |sample| sample.id p.id } } } + xml.samples({ type: 'array' }) { |samples| Sample.find_each { |p| samples.study { |sample| sample.id p.id } } } else # Depricated interface xml.samples(api_data) do |samples| diff --git a/app/views/studies/asset_groups/edit.html.erb b/app/views/studies/asset_groups/edit.html.erb index 080ca7db79..ecbb1c42d6 100644 --- a/app/views/studies/asset_groups/edit.html.erb +++ b/app/views/studies/asset_groups/edit.html.erb @@ -2,7 +2,7 @@ <%= form_for [@study,@asset_group], method: :put do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@asset_group) %>

      Name: <%= f.text_field :name %> diff --git a/app/views/studies/asset_groups/new.html.erb b/app/views/studies/asset_groups/new.html.erb index 108bc94b0c..28e849168a 100644 --- a/app/views/studies/asset_groups/new.html.erb +++ b/app/views/studies/asset_groups/new.html.erb @@ -2,7 +2,7 @@

      <%= form_for @asset_group, url: study_asset_groups_path(@study) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@asset_group) %>

      <%= f.label(:name, 'Name') %>: <%= f.text_field :name %>

      <%= f.submit "Create" %>

      diff --git a/app/views/studies/asset_groups/search.html.erb b/app/views/studies/asset_groups/search.html.erb index 028e607363..679fa14b04 100644 --- a/app/views/studies/asset_groups/search.html.erb +++ b/app/views/studies/asset_groups/search.html.erb @@ -4,7 +4,7 @@ <%= form_for @asset_group, url: add_study_asset_group_path(@study, @asset_group), html: { method: :post } do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@asset_group) %> <% @assets.each do |asset| %> diff --git a/app/views/studies/plates/wells/edit.html.erb b/app/views/studies/plates/wells/edit.html.erb index e91c413715..7b233d61e7 100644 --- a/app/views/studies/plates/wells/edit.html.erb +++ b/app/views/studies/plates/wells/edit.html.erb @@ -2,7 +2,7 @@ <%= form_for(@well) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@well) %>

      <%= f.submit "Update" %> diff --git a/app/views/studies/plates/wells/new.html.erb b/app/views/studies/plates/wells/new.html.erb index cf84a7d77c..8a40628e86 100644 --- a/app/views/studies/plates/wells/new.html.erb +++ b/app/views/studies/plates/wells/new.html.erb @@ -2,7 +2,7 @@

      <%= form_for(@well) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@well) %>

      <%= f.submit "Create" %>

      diff --git a/app/views/tag_groups/new.html.erb b/app/views/tag_groups/new.html.erb index 8061c05606..583dbbe781 100644 --- a/app/views/tag_groups/new.html.erb +++ b/app/views/tag_groups/new.html.erb @@ -2,7 +2,7 @@ <%= form_for(@form_object) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@form_object) %>
      <%= f.label :name, 'Tag Group name' %>
      <%= f.text_field :name, class: 'form-control' %> diff --git a/app/views/tag_layout_templates/new.html.erb b/app/views/tag_layout_templates/new.html.erb index bf001dd083..a7c700f085 100644 --- a/app/views/tag_layout_templates/new.html.erb +++ b/app/views/tag_layout_templates/new.html.erb @@ -2,7 +2,7 @@ <%= page_title 'Tag Layout Template', 'New' %> <%= form_for(@tag_layout_template) do |f| %> - <%= f.error_messages %> + <%= render_error_messages(@tag_layout_template) %>
      <%= f.label :name, 'Tag Layout Template name' %>
      <%= f.text_field :name, { class: 'form-control' } %> diff --git a/bin/knapsack_pro_cucumber b/bin/knapsack_pro_cucumber index 22e4aa0cfd..d07625fad7 100755 --- a/bin/knapsack_pro_cucumber +++ b/bin/knapsack_pro_cucumber @@ -1,16 +1,20 @@ #!/bin/bash + # See https://knapsackpro.com/faq/question/how-to-make-knapsack_pro-works-for-forked-repositories-of-my-project if [ "$KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER" = "" ]; then echo "WARN: No KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER github secret. Using fallback." echo "To improve performance consider:" echo "1) Add knapsackpro.com API keys to your github secrets" echo "2) Make pull requests from the sanger repo" + echo "Seeding database for cucumber tests" + RAILS_ENV=cucumber bundle exec rake db:seed + KNAPSACK_PRO_ENDPOINT=https://localhost \ KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER=disabled-for-fork \ KNAPSACK_PRO_MAX_REQUEST_RETRIES=0 \ - bundle exec rake "knapsack_pro:cucumber[--format CucumberGithubFormatter --out /dev/null --format progress]" + RAILS_ENV=cucumber bundle exec rake "knapsack_pro:cucumber[--format CucumberGithubFormatter --out /dev/null --format progress]" # use Regular Mode here always else - bundle exec rake "knapsack_pro:queue:cucumber[--format CucumberGithubFormatter --out /dev/null --format progress]" + RAILS_ENV=cucumber bundle exec rake "knapsack_pro:queue:cucumber[--format CucumberGithubFormatter --out /dev/null --format progress]" fi diff --git a/config.ru b/config.ru index e929ae7e14..3059e42a20 100644 --- a/config.ru +++ b/config.ru @@ -1,6 +1,6 @@ # frozen_string_literal: true # Rails.root/config.ru -require ::File.expand_path('config/environment', __dir__) +require File.expand_path('config/environment', __dir__) run Rails.application diff --git a/config/application.rb b/config/application.rb index 6910229d17..3666d6705c 100644 --- a/config/application.rb +++ b/config/application.rb @@ -22,7 +22,7 @@ Bundler.require(*Rails.groups) module Sequencescape - class Application < Rails::Application # rubocop:todo Style/Documentation + class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.0 diff --git a/config/cucumber.yml b/config/cucumber.yml index af3c4fd63f..5aa9c13b42 100644 --- a/config/cucumber.yml +++ b/config/cucumber.yml @@ -1,8 +1,9 @@ <% rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" -rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" -std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict" +rerun = rerun.strip.gsub /\s/, ' ' +rerun_opts = rerun.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" +std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags 'not @wip'" %> -default: <%= std_opts %> features --publish-quiet +default: <%= std_opts %> features wip: --tags @wip:3 --wip features -rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict +rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags 'not @wip' diff --git a/config/database.yml b/config/database.yml index 19b9aac9f8..c2c90997f9 100755 --- a/config/database.yml +++ b/config/database.yml @@ -49,8 +49,10 @@ test: &test timeout: 5000 cucumber: - <<: *test + <<: *MYSQL database: sequencescape_test<%= ENV['TEST_ENV_NUMBER'] %><%= suffix %>_cuke + pool: 10 + timeout: 5000 # We need to have some dummy configuration here when the app is being packaged up (vite:build), # because the initializers are run. @@ -64,3 +66,4 @@ production: ### Next release ### Training ### Production + diff --git a/config/environments/development.rb b/config/environments/development.rb index f58edc1293..03eb9d6529 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,5 +1,9 @@ # frozen_string_literal: true Rails.application.configure do + # Configure 'rails notes' to inspect Cucumber files + config.annotations.register_directories('features') + config.annotations.register_extensions('feature') { |tag| /#\s*(#{tag}):?\s*(.*)$/ } + # Settings specified here will take precedence over those in config/application.rb. # Support requests coming from other Docker containers on localhost. diff --git a/config/environments/production.rb b/config/environments/production.rb index 69d472318f..71c1ba8a4f 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -72,7 +72,7 @@ config.active_support.deprecation = :notify # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new + config.log_formatter = Logger::Formatter.new # Use a different logger for distributed setups. # require 'syslog/logger' diff --git a/config/environments/test.rb b/config/environments/test.rb index b57bfe945a..1cd73956ed 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -5,6 +5,10 @@ # and recreated between test runs. Don't rely on the data there! Rails.application.configure do + # Configure 'rails notes' to inspect Cucumber files + config.annotations.register_directories('features') + config.annotations.register_extensions('feature') { |tag| /#\s*(#{tag}):?\s*(.*)$/ } + # Settings specified here will take precedence over those in config/application.rb. config.cache_classes = true diff --git a/config/initializers/active_record_validations.rb b/config/initializers/active_record_validations.rb index 4f8b496e3c..f3ed0453ea 100644 --- a/config/initializers/active_record_validations.rb +++ b/config/initializers/active_record_validations.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module ActiveRecord::ExtraValidations # rubocop:todo Style/Documentation +module ActiveRecord::ExtraValidations def validates_unassigned(*attrs) validates_each(*attrs) { |record, attr, value| record.errors.add(attr, 'cannot be assigned') if value.present? } end diff --git a/config/initializers/api_routing.rb b/config/initializers/api_routing.rb index 73b7af6e1e..26c900b4d5 100644 --- a/config/initializers/api_routing.rb +++ b/config/initializers/api_routing.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true # TODO: Fix these -module ApiRouting # rubocop:todo Style/Documentation +module ApiRouting # Assets have a couple of extra actions that are always present: namely 'parents' and 'children' def asset(*entities, &block) options = entities.extract_options! diff --git a/config/initializers/formtastic.rb b/config/initializers/formtastic.rb index 903cc78e85..da3ea81cd2 100644 --- a/config/initializers/formtastic.rb +++ b/config/initializers/formtastic.rb @@ -6,7 +6,7 @@ module Formtastic module Inputs module Base - module Labelling # rubocop:todo Style/Documentation + module Labelling def label_html_options { for: input_html_options[:id], class: ['ft-label'] } end diff --git a/config/initializers/function_overrides.rb b/config/initializers/function_overrides.rb new file mode 100644 index 0000000000..a718034ed5 --- /dev/null +++ b/config/initializers/function_overrides.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true +require 'uri' + +module URI + class << self + def unescape(str) + URI.decode_www_form_component(str) + end + end +end diff --git a/config/initializers/process_locale_files_with_erb.rb b/config/initializers/process_locale_files_with_erb.rb index 324b30370c..c4eb19e95d 100644 --- a/config/initializers/process_locale_files_with_erb.rb +++ b/config/initializers/process_locale_files_with_erb.rb @@ -2,7 +2,7 @@ # Causes the locale files to be pre-processed with ERB as we need to perform some substitutions module I18n module Backend - module Base # rubocop:todo Style/Documentation + module Base def load_yml(filename) YAML.load(ERB.new(File.read(filename)).result) end diff --git a/config/initializers/ruby_net_http_proxy_hack.rb b/config/initializers/ruby_net_http_proxy_hack.rb index 1becc958b8..4f373bbb7d 100644 --- a/config/initializers/ruby_net_http_proxy_hack.rb +++ b/config/initializers/ruby_net_http_proxy_hack.rb @@ -14,100 +14,100 @@ # Ideally this hack would be less intrusive, but net/http isn't best designed # for extensibility, and we can't subclass it as we usually use it as a dependency. -require 'net/http' +# require 'net/http' -module Net - class HTTP # rubocop:todo Style/Documentation - def self.set_proxy_header(name, value) - additional_proxy_headers[name] = value - end +# module Net +# class HTTP +# def self.set_proxy_header(name, value) +# additional_proxy_headers[name] = value +# end - def self.additional_proxy_headers - @headers ||= {} - end +# def self.additional_proxy_headers +# @headers ||= {} +# end - def additional_proxy_headers - Net::HTTP.additional_proxy_headers - end +# def additional_proxy_headers +# Net::HTTP.additional_proxy_headers +# end - # Adapted from https://raw.githubusercontent.com/jruby/jruby/9.0.5.0/lib/ruby/stdlib/net/http.rb - # rubocop:todo Metrics/PerceivedComplexity, Metrics/MethodLength, Metrics/AbcSize - def connect # rubocop:todo Metrics/CyclomaticComplexity - if proxy? - conn_address = proxy_address - conn_port = proxy_port - else - conn_address = address - conn_port = port - end +# # Adapted from https://raw.githubusercontent.com/jruby/jruby/9.0.5.0/lib/ruby/stdlib/net/http.rb +# +# def connect +# if proxy? +# conn_address = proxy_address +# conn_port = proxy_port +# else +# conn_address = address +# conn_port = port +# end - D "opening connection to #{conn_address}:#{conn_port}..." - s = - Timeout.timeout(@open_timeout, Net::OpenTimeout) do - TCPSocket.open(conn_address, conn_port, @local_host, @local_port) - end - s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) - D 'opened' - if use_ssl? - ssl_parameters = Hash.new - iv_list = instance_variables - SSL_IVNAMES.each_with_index do |ivname, i| - if iv_list.include?(ivname) && (value = instance_variable_get(ivname)) - ssl_parameters[SSL_ATTRIBUTES[i]] = value if value - end - end - @ssl_context = OpenSSL::SSL::SSLContext.new - @ssl_context.set_params(ssl_parameters) - D "starting SSL for #{conn_address}:#{conn_port}..." - s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context) - s.sync_close = true - D 'SSL established' - end - @socket = BufferedIO.new(s) - @socket.read_timeout = @read_timeout - @socket.continue_timeout = @continue_timeout - @socket.debug_output = @debug_output - if use_ssl? - begin - if proxy? - buf = "CONNECT #{@address}:#{@port} HTTP/#{HTTPVersion}\r\n" - buf << "Host: #{@address}:#{@port}\r\n" +# D "opening connection to #{conn_address}:#{conn_port}..." +# s = +# Timeout.timeout(@open_timeout, Net::OpenTimeout) do +# TCPSocket.open(conn_address, conn_port, @local_host, @local_port) +# end +# s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) +# D 'opened' +# if use_ssl? +# ssl_parameters = Hash.new +# iv_list = instance_variables +# SSL_IVNAMES.each_with_index do |ivname, i| +# if iv_list.include?(ivname) && (value = instance_variable_get(ivname)) +# ssl_parameters[SSL_ATTRIBUTES[i]] = value if value +# end +# end +# @ssl_context = OpenSSL::SSL::SSLContext.new +# @ssl_context.set_params(ssl_parameters) +# D "starting SSL for #{conn_address}:#{conn_port}..." +# s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context) +# s.sync_close = true +# D 'SSL established' +# end +# @socket = BufferedIO.new(s) +# @socket.read_timeout = @read_timeout +# @socket.continue_timeout = @continue_timeout +# @socket.debug_output = @debug_output +# if use_ssl? +# begin +# if proxy? +# buf = "CONNECT #{@address}:#{@port} HTTP/#{HTTPVersion}\r\n" +# buf << "Host: #{@address}:#{@port}\r\n" - # MODIFICATION BEGINS - additional_proxy_headers.each { |k, v| buf << "#{k}: #{v}\r\n" } +# # MODIFICATION BEGINS +# additional_proxy_headers.each { |k, v| buf << "#{k}: #{v}\r\n" } - # MODIFICATION ENDS - if proxy_user - credential = ["#{proxy_user}:#{proxy_pass}"].pack('m') - credential.delete!("\r\n") - buf << "Proxy-Authorization: Basic #{credential}\r\n" - end - buf << "\r\n" - @socket.write(buf) - HTTPResponse.read_new(@socket).value - end - if @ssl_session && - (Process.clock_gettime(Process::CLOCK_REALTIME) < @ssl_session.time.to_f + @ssl_session.timeout) - s.session = @ssl_session if @ssl_session - end +# # MODIFICATION ENDS +# if proxy_user +# credential = ["#{proxy_user}:#{proxy_pass}"].pack('m') +# credential.delete!("\r\n") +# buf << "Proxy-Authorization: Basic #{credential}\r\n" +# end +# buf << "\r\n" +# @socket.write(buf) +# HTTPResponse.read_new(@socket).value +# end +# if @ssl_session && +# (Process.clock_gettime(Process::CLOCK_REALTIME) < @ssl_session.time.to_f + @ssl_session.timeout) +# s.session = @ssl_session if @ssl_session +# end - # Server Name Indication (SNI) RFC 3546 - s.hostname = @address if s.respond_to? :hostname= - Timeout.timeout(@open_timeout, Net::OpenTimeout) { s.connect } - s.post_connection_check(@address) if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE - @ssl_session = s.session - rescue => e - D "Conn close because of connect error #{e}" - @socket.close if @socket && (not @socket.closed?) - raise e - end - end - on_connect - end +# # Server Name Indication (SNI) RFC 3546 +# s.hostname = @address if s.respond_to? :hostname= +# Timeout.timeout(@open_timeout, Net::OpenTimeout) { s.connect } +# s.post_connection_check(@address) if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE +# @ssl_session = s.session +# rescue => e +# D "Conn close because of connect error #{e}" +# @socket.close if @socket && (not @socket.closed?) +# raise e +# end +# end +# on_connect +# end - # rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity - private :connect - end -end +# # rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity +# private :connect +# end +# end -Net::HTTP.set_proxy_header('User-Agent', 'Sequencescape') +# Net::HTTP.set_proxy_header('User-Agent', 'Sequencescape') diff --git a/db/migrate/20180329080953_remove_redundant_plate_classes.rb b/db/migrate/20180329080953_remove_redundant_plate_classes.rb index 91e7ece3bc..b8cdc493f8 100644 --- a/db/migrate/20180329080953_remove_redundant_plate_classes.rb +++ b/db/migrate/20180329080953_remove_redundant_plate_classes.rb @@ -36,7 +36,7 @@ def down .where(target_type: new_type) .joins('LEFT JOIN barcode_prefixes ON barcode_prefixes.id = plate_purposes.barcode_prefix_id') .where(barcode_prefixes: { prefix: prefix }) - .each do |purpose| + .find_each do |purpose| purpose.target_type = original purpose.save Asset.where(plate_purpose_id: purpose.id).update_all(sti_type: original) diff --git a/db/migrate/20180420144414_migrate_sanger_barcodes_to_new_tables.rb b/db/migrate/20180420144414_migrate_sanger_barcodes_to_new_tables.rb index 5798ba4f20..b8f4647492 100644 --- a/db/migrate/20180420144414_migrate_sanger_barcodes_to_new_tables.rb +++ b/db/migrate/20180420144414_migrate_sanger_barcodes_to_new_tables.rb @@ -4,7 +4,7 @@ class MigrateSangerBarcodesToNewTables < ActiveRecord::Migration[5.1] def up # rubocop:disable Metrics/AbcSize say 'Building prefix cache' - @prefixes = BarcodePrefix.all.pluck(:id, :prefix).to_h + @prefixes = BarcodePrefix.pluck(:id, :prefix).to_h say 'Migrating Sanger Barcodes' Barcode.transaction do Asset diff --git a/db/seeds.rb b/db/seeds.rb index da5b8b6a56..03fb36db8f 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -49,5 +49,5 @@ # example, property definitions depend on workflows to be present, so they should be ordered *after* # those workflows have been created. Ideally you will be preceeding your seed data with a 4 digit # 0-extended sequence number, i.e. 0001_foo.rb is executed *before* 0002_bar.rb. - Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), %w[seeds *.rb]))).sort.each(&handler) + Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), %w[seeds *.rb]))).each(&handler) end diff --git a/db/seeds/0019_plate_creators.rb b/db/seeds/0019_plate_creators.rb index bc73bea2c2..2a0541d2f6 100644 --- a/db/seeds/0019_plate_creators.rb +++ b/db/seeds/0019_plate_creators.rb @@ -67,7 +67,7 @@ c = Plate::Creator.find_by!(name: name) c.update!(valid_options: { valid_dilution_factors: values }) end - Plate::Creator.all.each do |c| + Plate::Creator.find_each do |c| if c.valid_options.nil? # Any other valid option will be set to 1 c.update!(valid_options: { valid_dilution_factors: [1.0] }) diff --git a/db/seeds/3000_library_types_setup.rb b/db/seeds/3000_library_types_setup.rb index d395a95a70..ded537a208 100644 --- a/db/seeds/3000_library_types_setup.rb +++ b/db/seeds/3000_library_types_setup.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module SetupLibraryTypes # rubocop:todo Style/Documentation, Metrics/ModuleLength +module SetupLibraryTypes # rubocop:todo Metrics/ModuleLength def self.existing_associations_for(request_type) { 'LibraryCreationRequest' => [ diff --git a/duplicates_1.csv b/duplicates_1.csv deleted file mode 100644 index 6e8bb31cd4..0000000000 --- a/duplicates_1.csv +++ /dev/null @@ -1,11 +0,0 @@ -chosen_sample,rejected_sample -412,413 -411,414 -410,415 -409,416 -408,417 -407,418 -406,419 -405,420 -404,421 -403,422 \ No newline at end of file diff --git a/features/api/qc_files.feature b/features/api/qc_files.feature.IGNORE similarity index 100% rename from features/api/qc_files.feature rename to features/api/qc_files.feature.IGNORE diff --git a/features/step_definitions/.gitkeep b/features/step_definitions/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/features/support/accession_service.rb b/features/support/accession_service.rb index d106a59753..086b6f2f20 100644 --- a/features/support/accession_service.rb +++ b/features/support/accession_service.rb @@ -3,7 +3,7 @@ require 'singleton' require 'rest-client' -class FakeAccessionService # rubocop:todo Style/Documentation +class FakeAccessionService include Singleton # Unfortunately Webmock doesn't handle multipart files, so we can't access diff --git a/features/support/api.rb b/features/support/api.rb index f244dd0e25..44451d7225 100644 --- a/features/support/api.rb +++ b/features/support/api.rb @@ -8,10 +8,10 @@ end # Ensure that the number of results displayed per page by the API is always 1. -Before('@new-api') { ::Core::Endpoint::BasicHandler::Paged.results_per_page = 1 } +Before('@new-api') { Core::Endpoint::BasicHandler::Paged.results_per_page = 1 } # Enables a replacement Sample endpoint for the object service tests, disabling it after -class TestSampleEndpoint < ::Core::Endpoint::Base +class TestSampleEndpoint < Core::Endpoint::Base model { action(:create, to: :standard_create!) } instance do @@ -30,7 +30,7 @@ def self.root end end -module Core::Endpoint::BasicHandler::EndpointLookup # rubocop:todo Style/Documentation +module Core::Endpoint::BasicHandler::EndpointLookup %i[object class].each do |name| line = __LINE__ + 1 @@ -59,5 +59,5 @@ def self.testing_api=(setting) end end -Before('@object_service') { ::Core::Endpoint::BasicHandler::EndpointLookup.testing_api = true } -After('@object_service') { ::Core::Endpoint::BasicHandler::EndpointLookup.testing_api = false } +Before('@object_service') { Core::Endpoint::BasicHandler::EndpointLookup.testing_api = true } +After('@object_service') { Core::Endpoint::BasicHandler::EndpointLookup.testing_api = false } diff --git a/features/support/barcode_service.rb b/features/support/barcode_service.rb index fdd0ea28a6..aa830d262b 100644 --- a/features/support/barcode_service.rb +++ b/features/support/barcode_service.rb @@ -2,7 +2,7 @@ require 'singleton' -class FakeBarcodeService # rubocop:todo Style/Documentation +class FakeBarcodeService include Singleton # Ensure that the configuration is maintained, otherwise things start behaving badly diff --git a/features/support/paths.rb b/features/support/paths.rb index 4c64b972f0..e77c5f2bb2 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # rubocop:todo Metrics/ModuleLength -module NavigationHelpers # rubocop:todo Style/Documentation +module NavigationHelpers # Finds the specified page for the given model with the specified name. def page_for_model(model, page, name) object = model.find_by!(name: name) diff --git a/features/support/step_definitions/api_steps.rb b/features/support/step_definitions/api_steps.rb index 9fdcae1a58..94254d3454 100644 --- a/features/support/step_definitions/api_steps.rb +++ b/features/support/step_definitions/api_steps.rb @@ -89,7 +89,7 @@ def api_request(action, path, body) # rubocop:todo Metrics/AbcSize end Given /^I am using the latest version of the API$/ do - step("I am using version \"#{::Core::Service::API_VERSION}\" of the API") + step("I am using version \"#{Core::Service::API_VERSION}\" of the API") end When %r{^I (GET|PUT|POST|DELETE) the API path "(\/[^"]*)"$} do |action, path| @@ -223,7 +223,7 @@ def decode_json(json, source) raise StandardError, "Status #{status.inspect} should be an HTTP status code + message" begin assert_equal(match[1].to_i, page.driver.status_code) - rescue MiniTest::Assertion => e + rescue Minitest::Assertion => e step 'show me the HTTP response body' raise e end @@ -327,7 +327,7 @@ def decode_json(json, source) end Given /^the number of results returned by the API per page is (\d+)$/ do |count| - ::Core::Endpoint::BasicHandler::Paged.results_per_page = count.to_i + Core::Endpoint::BasicHandler::Paged.results_per_page = count.to_i end Given /^the "([^"]+)" action on samples requires authorisation$/ do |action| diff --git a/features/support/step_definitions/samples_steps.rb b/features/support/step_definitions/samples_steps.rb index 837a083447..519e1e715d 100644 --- a/features/support/step_definitions/samples_steps.rb +++ b/features/support/step_definitions/samples_steps.rb @@ -228,5 +228,5 @@ # To bypass all the callbacks # That trigger when they die Sample.delete_all - Uuid.where(resource_type: 'Sample').each(&:destroy) + Uuid.where(resource_type: 'Sample').find_each(&:destroy) end diff --git a/features/support/step_definitions/study_steps.rb b/features/support/step_definitions/study_steps.rb index 87409d5518..a6aea75424 100644 --- a/features/support/step_definitions/study_steps.rb +++ b/features/support/step_definitions/study_steps.rb @@ -220,7 +220,7 @@ def assign_asset_to_study(asset, study_name) Asset .where(id: asset_ids) .includes(:aliquots) - .each { |asset| asset.aliquots.each { |aliquot| aliquot.update!(study_id: study.id) } } + .find_each { |asset| asset.aliquots.each { |aliquot| aliquot.update!(study_id: study.id) } } end Then /^abbreviation for Study "([^"]*)" should be "([^"]*)"$/ do |study_name, abbreviation_regex| diff --git a/features/support/step_definitions/transfer_steps.rb b/features/support/step_definitions/transfer_steps.rb index 5934b203e0..e7e412741c 100644 --- a/features/support/step_definitions/transfer_steps.rb +++ b/features/support/step_definitions/transfer_steps.rb @@ -160,7 +160,7 @@ def change_request_state(state, targets, direction, request_class) Then 'the study for the aliquots in the wells of {uuid} should match the last submission' do |plate| study = Submission.last.orders.first.study - plate.wells.includes(:aliquots).each { |w| w.aliquots.each { |a| assert_equal study.id, a.study_id } } + plate.wells.includes(:aliquots).find_each { |w| w.aliquots.each { |a| assert_equal study.id, a.study_id } } end Given '{asset_name} is a {string}' do |plate, name| plate_purpose = Purpose.find_by!(name: name) diff --git a/features/support/step_definitions/web_steps.rb b/features/support/step_definitions/web_steps.rb index 90e52e20d2..d7e3dca7e9 100644 --- a/features/support/step_definitions/web_steps.rb +++ b/features/support/step_definitions/web_steps.rb @@ -10,7 +10,7 @@ require 'cgi' require_relative '../paths' -module WithinHelpers # rubocop:todo Style/Documentation +module WithinHelpers def with_scope(locator) locator ? within(locator) { yield } : yield end diff --git a/features/support/timecop.rb b/features/support/timecop.rb index 72c9b49d39..0b5849bb8a 100644 --- a/features/support/timecop.rb +++ b/features/support/timecop.rb @@ -2,7 +2,7 @@ require 'timecop' -class Timecop # rubocop:todo Style/Documentation +class Timecop class << self # Block the use of Timecop.freeze as it upsets the Capybara... def freeze_with_warning(_time) @@ -23,7 +23,7 @@ def freeze_with_warning(_time) # Turning Timecop.freeze off for JavaScript Scenarios Before('@javascript') do - class Timecop # rubocop:todo Style/Documentation + class Timecop class << self alias freeze_without_warning freeze alias freeze freeze_with_warning @@ -32,7 +32,7 @@ class << self end # ...and back on again. After('@javascript') do - class Timecop # rubocop:todo Style/Documentation + class Timecop class << self alias freeze freeze_without_warning undef freeze_without_warning diff --git a/features/support/well_range.rb b/features/support/well_range.rb index 7cee10d40f..f46a66302f 100644 --- a/features/support/well_range.rb +++ b/features/support/well_range.rb @@ -2,7 +2,7 @@ # Helper class that wraps well ranges in specs class WellRange - WELL_REGEXP = /^([A-H])(\d+)$/.freeze + WELL_REGEXP = /^([A-H])(\d+)$/ def initialize(start, finish) start_match = WELL_REGEXP.match(start) diff --git a/lib/accession/accession.rb b/lib/accession/accession.rb index 7624314132..299bab6190 100644 --- a/lib/accession/accession.rb +++ b/lib/accession/accession.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Accession # rubocop:todo Style/Documentation +module Accession # Handles assigning of accessioning number to a Sequenescape sample. # Before accessioning: # check configuration settings, in particular: @@ -28,7 +28,7 @@ def load_file(folder, filename) end end - module Equality # rubocop:todo Style/Documentation + module Equality include Comparable def to_a diff --git a/lib/accession/accession/configuration.rb b/lib/accession/accession/configuration.rb index b9310dd2bb..31f00202a2 100644 --- a/lib/accession/accession/configuration.rb +++ b/lib/accession/accession/configuration.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module Accession - class Configuration # rubocop:todo Style/Documentation + class Configuration include Accession::Helpers include Accession::Equality diff --git a/lib/accession/accession/core_extensions.rb b/lib/accession/accession/core_extensions.rb index 8c4971ca11..6c17d4691f 100644 --- a/lib/accession/accession/core_extensions.rb +++ b/lib/accession/accession/core_extensions.rb @@ -4,7 +4,7 @@ module Accession # Core Extensions provide extensions to standard classes # which can be included whenever needed. module CoreExtensions - module String # rubocop:todo Style/Documentation + module String # replace everything that is not a valid character with an underscore def sanitize downcase.gsub(/[^\w\d]/i, '_') diff --git a/lib/accession/accession/sample.rb b/lib/accession/accession/sample.rb index c77a1daa21..dd5e1924e0 100644 --- a/lib/accession/accession/sample.rb +++ b/lib/accession/accession/sample.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module Accession - class Sample # rubocop:todo Style/Documentation + class Sample # Validate the sample to ensure that it can be accessioned # The sample must: # - not be accessioned diff --git a/lib/accession/accession/service.rb b/lib/accession/accession/service.rb index 7e44a52f7f..71ef37ecc1 100644 --- a/lib/accession/accession/service.rb +++ b/lib/accession/accession/service.rb @@ -37,7 +37,7 @@ def url def login return configatron.accession.ega!.to_hash if ega? - return configatron.accession.ena!.to_hash if ena? + configatron.accession.ena!.to_hash if ena? end end end diff --git a/lib/accession/accession/tag.rb b/lib/accession/accession/tag.rb index afd6477637..fc7f49e02a 100644 --- a/lib/accession/accession/tag.rb +++ b/lib/accession/accession/tag.rb @@ -117,7 +117,6 @@ def value_for(record, key) class TagCollectionDate < Tag # rubocop:disable Layout/LineLength REGEXP = %r{(^[12][0-9]{3}(-(0[1-9]|1[0-2])(-(0[1-9]|[12][0-9]|3[01])(T[0-9]{2}:[0-9]{2}(:[0-9]{2})?Z?([+-][0-9]{1,2})?)?)?)?(/[0-9]{4}(-[0-9]{2}(-[0-9]{2}(T[0-9]{2}:[0-9]{2}(:[0-9]{2})?Z?([+-][0-9]{1,2})?)?)?)?)?$)} - .freeze # rubocop:enable Layout/LineLength diff --git a/lib/accession/accession/tag_list.rb b/lib/accession/accession/tag_list.rb index 8e0824ceb0..eba8db0f00 100644 --- a/lib/accession/accession/tag_list.rb +++ b/lib/accession/accession/tag_list.rb @@ -8,7 +8,7 @@ module Accession # Tags contain information about a sample, that should be provided to an external service to accession the sample # Tags are used to validate a sample and to create a correct xml file for accessioning request. - class TagList # rubocop:todo Style/Documentation + class TagList include Enumerable include Comparable diff --git a/lib/api_tools.rb b/lib/api_tools.rb index d1aad7b742..1695003e91 100644 --- a/lib/api_tools.rb +++ b/lib/api_tools.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true -module ApiTools # rubocop:todo Style/Documentation +module ApiTools def self.included(base) base.extend(ClassMethods) end - module ClassMethods # rubocop:todo Style/Documentation + module ClassMethods def render_class @render_class ||= Api::Base.render_class_for_model(self) end diff --git a/lib/authenticated_system.rb b/lib/authenticated_system.rb index 43063f27d3..2341aac656 100644 --- a/lib/authenticated_system.rb +++ b/lib/authenticated_system.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module AuthenticatedSystem # rubocop:todo Style/Documentation +module AuthenticatedSystem protected # Returns true or false if the user is logged in. diff --git a/lib/authenticated_test_helper.rb b/lib/authenticated_test_helper.rb index 453cbe475c..d4d106f8f6 100644 --- a/lib/authenticated_test_helper.rb +++ b/lib/authenticated_test_helper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module AuthenticatedTestHelper # rubocop:todo Style/Documentation +module AuthenticatedTestHelper # Sets the current user in the session from the user fixtures. def login_as(user) @request.session[:user] = user ? user.id : nil @@ -63,7 +63,7 @@ def reset!(*instance_vars) end end -class BaseLoginProxy # rubocop:todo Style/Documentation +class BaseLoginProxy attr_reader :controller, :options def initialize(controller, login) @@ -89,7 +89,7 @@ def method_missing(method, *args) end end -class HttpLoginProxy < BaseLoginProxy # rubocop:todo Style/Documentation +class HttpLoginProxy < BaseLoginProxy protected def authenticate @@ -101,7 +101,7 @@ def check end end -class XmlLoginProxy < BaseLoginProxy # rubocop:todo Style/Documentation +class XmlLoginProxy < BaseLoginProxy protected def authenticate diff --git a/lib/capybara_failure_logger.rb b/lib/capybara_failure_logger.rb index 2b7aa52c2b..5495b4d441 100644 --- a/lib/capybara_failure_logger.rb +++ b/lib/capybara_failure_logger.rb @@ -43,9 +43,9 @@ def self.log_html(name, page) end def self.log_js(_name, page) - return unless page.driver.browser.respond_to?(:manage) + return unless page.driver.browser.respond_to?(:logs) - errors = page.driver.browser.manage.logs.get(:browser) + errors = page.driver.browser.logs.get(:browser) yield '== JS errors ============' errors.each { |jserror| yield jserror.message } yield '=========================' diff --git a/lib/control_request_type_creation.rb b/lib/control_request_type_creation.rb index 9146584667..57e95e12ac 100644 --- a/lib/control_request_type_creation.rb +++ b/lib/control_request_type_creation.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module ControlRequestTypeCreation # rubocop:todo Style/Documentation +module ControlRequestTypeCreation def control_type_name key_name.titleize end diff --git a/lib/deployed_version.rb b/lib/deployed_version.rb index 7256d97fdd..f992db948b 100644 --- a/lib/deployed_version.rb +++ b/lib/deployed_version.rb @@ -2,8 +2,8 @@ require 'open3' -module Deployed # rubocop:todo Style/Documentation - class RepoData # rubocop:todo Style/Documentation +module Deployed + class RepoData def tag @tag ||= git_tag || read_file('TAG').strip.presence end @@ -107,8 +107,8 @@ def read_file(filename) COMMIT = REPO_DATA.revision.presence || 'unknown_revision' ABBREV_COMMIT = REPO_DATA.revision_short.presence || 'unknown_revision' - VERSION_STRING = "#{APP_NAME} #{VERSION_ID} [#{ENVIRONMENT}]" - VERSION_COMMIT = "#{BRANCH}@#{ABBREV_COMMIT}" + VERSION_STRING = "#{APP_NAME} #{VERSION_ID} [#{ENVIRONMENT}]".freeze + VERSION_COMMIT = "#{BRANCH}@#{ABBREV_COMMIT}".freeze REPO_URL = REPO_DATA.release_url.presence || '#' HOSTNAME = Socket.gethostname diff --git a/lib/event_factory.rb b/lib/event_factory.rb index ba96620fc8..5b2b23d276 100644 --- a/lib/event_factory.rb +++ b/lib/event_factory.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true require 'eventful_mailer' -class EventFactory # rubocop:todo Style/Documentation +class EventFactory ################################# # project related notifications # ################################# diff --git a/lib/eventful_mailer.rb b/lib/eventful_mailer.rb index d58232301d..d9b4d20526 100644 --- a/lib/eventful_mailer.rb +++ b/lib/eventful_mailer.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class EventfulMailer < ActionMailer::Base # rubocop:todo Style/Documentation +class EventfulMailer < ActionMailer::Base # rubocop:todo Metrics/ParameterLists def confirm_event(receiver, eventful, message, content, _milestone, sent_at = Time.zone.now) @eventful = eventful diff --git a/lib/eventful_record.rb b/lib/eventful_record.rb index 99eee83b0f..a78ac30c25 100644 --- a/lib/eventful_record.rb +++ b/lib/eventful_record.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module EventfulRecord # rubocop:todo Style/Documentation +module EventfulRecord def has_many_events(&block) # rubocop:todo Metrics/MethodLength has_many(:events, -> { order(created_at: :asc, id: :asc) }, as: :eventful, dependent: :destroy) do def self.event_constructor(name, event_class, event_class_method) diff --git a/lib/generators/api_v2/api_v2_generator.rb b/lib/generators/api_v2/api_v2_generator.rb index 4481fbe5c2..58cebf32c3 100644 --- a/lib/generators/api_v2/api_v2_generator.rb +++ b/lib/generators/api_v2/api_v2_generator.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -class ApiV2Generator < Rails::Generators::NamedBase # rubocop:todo Style/Documentation +class ApiV2Generator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) def create_directories diff --git a/lib/has_behaviour.rb b/lib/has_behaviour.rb index 46f6ee60e5..cec1b5ba0f 100644 --- a/lib/has_behaviour.rb +++ b/lib/has_behaviour.rb @@ -5,7 +5,7 @@ # ruby classes as HasBehaviour::File for instance loads the global file # object. module HasBehaviour - module ClassMethods # rubocop:todo Style/Documentation + module ClassMethods def has_behaviour(klass, behaviour_name: nil) @registered_behaviours ||= {} @registered_behaviours[behaviour_name || klass.name] = klass diff --git a/lib/illumina_c/helper.rb b/lib/illumina_c/helper.rb index 5c974239a4..a7b8612246 100644 --- a/lib/illumina_c/helper.rb +++ b/lib/illumina_c/helper.rb @@ -21,7 +21,7 @@ module IlluminaC::Helper ].freeze PIPELINE = 'Illumina-C' - class TemplateConstructor # rubocop:todo Style/Documentation + class TemplateConstructor # Construct submission templates for the generic pipeline # opts is a hash # { diff --git a/lib/informatics.rb b/lib/informatics.rb index 5830a6ca8f..bbbf0110ee 100644 --- a/lib/informatics.rb +++ b/lib/informatics.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module Informatics - module Globals # rubocop:todo Style/Documentation + module Globals @@application = nil @@defaults = nil diff --git a/lib/informatics/lib/informatics.rb b/lib/informatics/lib/informatics.rb index 86ea94b9fb..6cbbef311e 100644 --- a/lib/informatics/lib/informatics.rb +++ b/lib/informatics/lib/informatics.rb @@ -1,3 +1,3 @@ # frozen_string_literal: true -module Informatics # rubocop:todo Style/Documentation +module Informatics end diff --git a/lib/informatics/lib/informatics/application.rb b/lib/informatics/lib/informatics/application.rb index 10504c70b1..9e368e14fb 100644 --- a/lib/informatics/lib/informatics/application.rb +++ b/lib/informatics/lib/informatics/application.rb @@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/support/options' module Informatics - class Application # rubocop:todo Style/Documentation + class Application include Informatics::Globals attr_accessor :name, :description, :home_page, :title, :authentication diff --git a/lib/informatics/lib/informatics/controller_helper.rb b/lib/informatics/lib/informatics/controller_helper.rb index cda3e0c420..dcef1cc003 100644 --- a/lib/informatics/lib/informatics/controller_helper.rb +++ b/lib/informatics/lib/informatics/controller_helper.rb @@ -5,7 +5,7 @@ require_relative 'view/tabs/list' require_relative 'globals' -module ApplicationHelper # rubocop:todo Style/Documentation +module ApplicationHelper include Informatics::Globals # rubocop:todo Metrics/MethodLength, Metrics/AbcSize diff --git a/lib/informatics/lib/informatics/globals.rb b/lib/informatics/lib/informatics/globals.rb index 5830a6ca8f..bbbf0110ee 100644 --- a/lib/informatics/lib/informatics/globals.rb +++ b/lib/informatics/lib/informatics/globals.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module Informatics - module Globals # rubocop:todo Style/Documentation + module Globals @@application = nil @@defaults = nil diff --git a/lib/informatics/lib/informatics/support/options.rb b/lib/informatics/lib/informatics/support/options.rb index bfba05ace0..bcba83eb9c 100644 --- a/lib/informatics/lib/informatics/support/options.rb +++ b/lib/informatics/lib/informatics/support/options.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Informatics module Support - class Options # rubocop:todo Style/Documentation + class Options attr_reader :options def self.collect(*options) diff --git a/lib/informatics/lib/informatics/view/menu/item.rb b/lib/informatics/lib/informatics/view/menu/item.rb index 2b80e13e44..693f0beaa9 100644 --- a/lib/informatics/lib/informatics/view/menu/item.rb +++ b/lib/informatics/lib/informatics/view/menu/item.rb @@ -2,7 +2,7 @@ module Informatics module View module Menu - class Item # rubocop:todo Style/Documentation + class Item attr_accessor :text, :link, :confirm, :method def initialize(options = {}) diff --git a/lib/informatics/lib/informatics/view/menu/list.rb b/lib/informatics/lib/informatics/view/menu/list.rb index b3484d09c9..073c365fe3 100644 --- a/lib/informatics/lib/informatics/view/menu/list.rb +++ b/lib/informatics/lib/informatics/view/menu/list.rb @@ -2,7 +2,7 @@ module Informatics module View module Menu - class List # rubocop:todo Style/Documentation + class List attr_accessor :items def add_item(options = {}) diff --git a/lib/informatics/lib/informatics/view/tabs/item.rb b/lib/informatics/lib/informatics/view/tabs/item.rb index 18ada68952..0a4a01f082 100644 --- a/lib/informatics/lib/informatics/view/tabs/item.rb +++ b/lib/informatics/lib/informatics/view/tabs/item.rb @@ -2,7 +2,7 @@ module Informatics module View module Tabs - class Item # rubocop:todo Style/Documentation + class Item attr_accessor :text, :link def initialize(options = {}) diff --git a/lib/informatics/lib/informatics/view/tabs/list.rb b/lib/informatics/lib/informatics/view/tabs/list.rb index 01bb5fd294..51b287ef21 100644 --- a/lib/informatics/lib/informatics/view/tabs/list.rb +++ b/lib/informatics/lib/informatics/view/tabs/list.rb @@ -2,7 +2,7 @@ module Informatics module View module Tabs - class List # rubocop:todo Style/Documentation + class List attr_accessor :items def initialize(_options = {}) diff --git a/lib/informatics/test/helpers/authentication_helper.rb b/lib/informatics/test/helpers/authentication_helper.rb index e72fa7cae8..26dce88c76 100644 --- a/lib/informatics/test/helpers/authentication_helper.rb +++ b/lib/informatics/test/helpers/authentication_helper.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module AuthenticatedTestHelper # rubocop:todo Style/Documentation +module AuthenticatedTestHelper # Sets the current user in the session from the user fixtures. def login_as(user) @request.session[:user] = user ? users(user).id : nil @@ -63,7 +63,7 @@ def reset!(*instance_vars) end end -class BaseLoginProxy # rubocop:todo Style/Documentation +class BaseLoginProxy attr_reader :controller, :options def initialize(controller, login) @@ -89,7 +89,7 @@ def method_missing(method, *args) end end -class HttpLoginProxy < BaseLoginProxy # rubocop:todo Style/Documentation +class HttpLoginProxy < BaseLoginProxy protected def authenticate @@ -101,7 +101,7 @@ def check end end -class XmlLoginProxy < BaseLoginProxy # rubocop:todo Style/Documentation +class XmlLoginProxy < BaseLoginProxy protected def authenticate diff --git a/lib/informatics/test/test_informatics.rb b/lib/informatics/test/test_informatics.rb index ce688b56e2..44fdbd3b78 100644 --- a/lib/informatics/test/test_informatics.rb +++ b/lib/informatics/test/test_informatics.rb @@ -2,7 +2,7 @@ require 'test/unit' require 'informatics/support/options' -class TestInformatics < Test::Unit::TestCase # rubocop:todo Style/Documentation +class TestInformatics < Test::Unit::TestCase def setup @hash = { 'KEY' => 'VALUE' } @o = Informatics::Support::Options.collect(@hash) diff --git a/lib/insdc/import_countries.rb b/lib/insdc/import_countries.rb index e7b677de77..db86dc4efe 100644 --- a/lib/insdc/import_countries.rb +++ b/lib/insdc/import_countries.rb @@ -6,7 +6,7 @@ class Insdc::ImportCountries FILE_ROOT = Rails.root.join('data/ena_sample_checklists') FIELD_NAME = 'geographic location (country and/or sea)' - XPATH = "//FIELD//NAME[text() = '#{FIELD_NAME}']/following-sibling::FIELD_TYPE//TEXT_VALUE//VALUE" + XPATH = "//FIELD//NAME[text() = '#{FIELD_NAME}']/following-sibling::FIELD_TYPE//TEXT_VALUE//VALUE".freeze def initialize(ena_root:, sample_checklist:, priorities: {}) @ena_root = ena_root diff --git a/lib/lab_where_client.rb b/lib/lab_where_client.rb index 22e80faf43..dc5d5b9924 100644 --- a/lib/lab_where_client.rb +++ b/lib/lab_where_client.rb @@ -4,7 +4,7 @@ module LabWhereClient LabwhereException = Class.new(StandardError) - class LabWhere # rubocop:todo Style/Documentation + class LabWhere def base_url configatron.fetch(:labwhere_api) end @@ -45,7 +45,7 @@ def put(instance, target, payload) end end - class Endpoint # rubocop:todo Style/Documentation + class Endpoint def self.endpoint_name(name) @endpoint = name end @@ -57,8 +57,8 @@ class << self def initialize(params); end # rubocop:todo Style/RedundantInitialize end - module EndpointCreateActions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module EndpointCreateActions + module ClassMethods def creation_params(params) params end @@ -74,8 +74,8 @@ def self.included(base) end end - module EndpointUpdateActions # rubocop:todo Style/Documentation - module ClassMethods # rubocop:todo Style/Documentation + module EndpointUpdateActions + module ClassMethods def update(target, params) attrs = LabWhere.new.put(self, target, params) new(attrs) unless attrs.nil? @@ -87,7 +87,7 @@ def self.included(base) end end - class Labware < Endpoint # rubocop:todo Style/Documentation + class Labware < Endpoint endpoint_name 'labwares' attr_reader :barcode, :location @@ -105,7 +105,7 @@ def initialize(params) end end - class LabwareSearch < Endpoint # rubocop:todo Style/Documentation + class LabwareSearch < Endpoint endpoint_name 'labwares/searches' attr_reader :labwares @@ -124,7 +124,7 @@ def initialize(params_list) end end - class Scan < Endpoint # rubocop:todo Style/Documentation + class Scan < Endpoint include EndpointCreateActions attr_reader :message, :errors @@ -155,7 +155,7 @@ def error end end - class Location < Endpoint # rubocop:todo Style/Documentation + class Location < Endpoint endpoint_name 'locations' attr_reader :name, :parentage, :barcode diff --git a/lib/label_printer/label_printer.rb b/lib/label_printer/label_printer.rb index 0f643b535d..db386875a3 100644 --- a/lib/label_printer/label_printer.rb +++ b/lib/label_printer/label_printer.rb @@ -3,7 +3,7 @@ require_relative 'label_printer/label/base_plate' require_relative 'label_printer/label/base_tube' -Dir["#{File.dirname(__FILE__)}/**/*.rb"].sort.each { |file| require file } +Dir["#{File.dirname(__FILE__)}/**/*.rb"].each { |file| require file } -module LabelPrinter # rubocop:todo Style/Documentation +module LabelPrinter end diff --git a/lib/label_printer/label_printer/batch_plates.rb b/lib/label_printer/label_printer/batch_plates.rb index 4bd2aa69c7..0a26554a80 100644 --- a/lib/label_printer/label_printer/batch_plates.rb +++ b/lib/label_printer/label_printer/batch_plates.rb @@ -2,7 +2,7 @@ module LabelPrinter module Label - module BatchPlates # rubocop:todo Style/Documentation + module BatchPlates def plates barcodes = printable.select { |_barcode, check| check == 'on' }.keys batch.plate_group_barcodes.keys.select { |plate| barcodes.include?(plate.human_barcode) } diff --git a/lib/label_printer/label_printer/label.rb b/lib/label_printer/label_printer/label.rb index 85443c9211..e56ebc6fcc 100644 --- a/lib/label_printer/label_printer/label.rb +++ b/lib/label_printer/label_printer/label.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - module MultipleLabels # rubocop:todo Style/Documentation + module MultipleLabels attr_accessor :count def labels diff --git a/lib/label_printer/label_printer/label/asset_plate.rb b/lib/label_printer/label_printer/label/asset_plate.rb index 668630beaa..17fe262f5d 100644 --- a/lib/label_printer/label_printer/label/asset_plate.rb +++ b/lib/label_printer/label_printer/label/asset_plate.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class AssetPlate < BasePlate # rubocop:todo Style/Documentation + class AssetPlate < BasePlate attr_reader :plates def initialize(plates) diff --git a/lib/label_printer/label_printer/label/asset_plate_double.rb b/lib/label_printer/label_printer/label/asset_plate_double.rb index 47b5b31c9e..25d838bf9f 100644 --- a/lib/label_printer/label_printer/label/asset_plate_double.rb +++ b/lib/label_printer/label_printer/label/asset_plate_double.rb @@ -4,7 +4,7 @@ module LabelPrinter module Label - class AssetPlateDouble < BasePlateDouble # rubocop:todo Style/Documentation + class AssetPlateDouble < BasePlateDouble attr_reader :plates def initialize(plates) diff --git a/lib/label_printer/label_printer/label/asset_redirect.rb b/lib/label_printer/label_printer/label/asset_redirect.rb index 4eb35120fb..731f05aaba 100644 --- a/lib/label_printer/label_printer/label/asset_redirect.rb +++ b/lib/label_printer/label_printer/label/asset_redirect.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class AssetRedirect # rubocop:todo Style/Documentation + class AssetRedirect attr_reader :printables def initialize(options) diff --git a/lib/label_printer/label_printer/label/asset_tube.rb b/lib/label_printer/label_printer/label/asset_tube.rb index afc86c617e..6427121c32 100644 --- a/lib/label_printer/label_printer/label/asset_tube.rb +++ b/lib/label_printer/label_printer/label/asset_tube.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class AssetTube < BaseTube # rubocop:todo Style/Documentation + class AssetTube < BaseTube attr_reader :tubes def initialize(tubes) diff --git a/lib/label_printer/label_printer/label/base_plate.rb b/lib/label_printer/label_printer/label/base_plate.rb index 605995fcfc..725b5030ec 100644 --- a/lib/label_printer/label_printer/label/base_plate.rb +++ b/lib/label_printer/label_printer/label/base_plate.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class BasePlate # rubocop:todo Style/Documentation + class BasePlate include Label::MultipleLabels def build_label(plate) diff --git a/lib/label_printer/label_printer/label/base_plate_double.rb b/lib/label_printer/label_printer/label/base_plate_double.rb index 74d5b263ee..0e230a434e 100644 --- a/lib/label_printer/label_printer/label/base_plate_double.rb +++ b/lib/label_printer/label_printer/label/base_plate_double.rb @@ -4,7 +4,7 @@ module LabelPrinter module Label - class BasePlateDouble # rubocop:todo Style/Documentation + class BasePlateDouble include Label::MultipleDoubleLabels def barcode(plate) diff --git a/lib/label_printer/label_printer/label/base_tube.rb b/lib/label_printer/label_printer/label/base_tube.rb index dcf60bf7ac..1799fdb95a 100644 --- a/lib/label_printer/label_printer/label/base_tube.rb +++ b/lib/label_printer/label_printer/label/base_tube.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class BaseTube # rubocop:todo Style/Documentation + class BaseTube include Label::MultipleLabels def build_label(tube) diff --git a/lib/label_printer/label_printer/label/batch_plate.rb b/lib/label_printer/label_printer/label/batch_plate.rb index 607b6f6c5b..48b0283b9e 100644 --- a/lib/label_printer/label_printer/label/batch_plate.rb +++ b/lib/label_printer/label_printer/label/batch_plate.rb @@ -4,7 +4,7 @@ module LabelPrinter module Label - class BatchPlate < BasePlate # rubocop:todo Style/Documentation + class BatchPlate < BasePlate include Label::BatchPlates attr_reader :count, :printable, :batch diff --git a/lib/label_printer/label_printer/label/batch_plate_double.rb b/lib/label_printer/label_printer/label/batch_plate_double.rb index 37939a2ffe..1d9eb1aea4 100644 --- a/lib/label_printer/label_printer/label/batch_plate_double.rb +++ b/lib/label_printer/label_printer/label/batch_plate_double.rb @@ -5,7 +5,7 @@ module LabelPrinter module Label - class BatchPlateDouble < BasePlateDouble # rubocop:todo Style/Documentation + class BatchPlateDouble < BasePlateDouble include Label::BatchPlates attr_reader :count, :printable, :batch diff --git a/lib/label_printer/label_printer/label/batch_redirect.rb b/lib/label_printer/label_printer/label/batch_redirect.rb index 0eedd9af47..cab6fd96ac 100644 --- a/lib/label_printer/label_printer/label/batch_redirect.rb +++ b/lib/label_printer/label_printer/label/batch_redirect.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class BatchRedirect # rubocop:todo Style/Documentation + class BatchRedirect attr_reader :options def initialize(options) diff --git a/lib/label_printer/label_printer/label/batch_tube.rb b/lib/label_printer/label_printer/label/batch_tube.rb index 9082760b90..e188a35bf7 100644 --- a/lib/label_printer/label_printer/label/batch_tube.rb +++ b/lib/label_printer/label_printer/label/batch_tube.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class BatchTube < BaseTube # rubocop:todo Style/Documentation + class BatchTube < BaseTube attr_reader :count, :printable, :batch, :stock def initialize(options) diff --git a/lib/label_printer/label_printer/label/multiplexed_tube.rb b/lib/label_printer/label_printer/label/multiplexed_tube.rb index 47720c5ca1..77405ef644 100644 --- a/lib/label_printer/label_printer/label/multiplexed_tube.rb +++ b/lib/label_printer/label_printer/label/multiplexed_tube.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class MultiplexedTube < BaseTube # rubocop:todo Style/Documentation + class MultiplexedTube < BaseTube attr_reader :tubes def initialize(options) diff --git a/lib/label_printer/label_printer/label/plate_creator.rb b/lib/label_printer/label_printer/label/plate_creator.rb index 4dbd3e045a..7e9b75d766 100644 --- a/lib/label_printer/label_printer/label/plate_creator.rb +++ b/lib/label_printer/label_printer/label/plate_creator.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class PlateCreator < BasePlate # rubocop:todo Style/Documentation + class PlateCreator < BasePlate attr_reader :plates, :plate_purpose, :user_login def initialize(options) diff --git a/lib/label_printer/label_printer/label/plate_to_tubes.rb b/lib/label_printer/label_printer/label/plate_to_tubes.rb index 38aa1a05a4..dbe89ce4a2 100644 --- a/lib/label_printer/label_printer/label/plate_to_tubes.rb +++ b/lib/label_printer/label_printer/label/plate_to_tubes.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class PlateToTubes < BaseTube # rubocop:todo Style/Documentation + class PlateToTubes < BaseTube attr_reader :tubes def initialize(options) diff --git a/lib/label_printer/label_printer/label/robot_beds.rb b/lib/label_printer/label_printer/label/robot_beds.rb index 6588708397..f2558c2cd5 100644 --- a/lib/label_printer/label_printer/label/robot_beds.rb +++ b/lib/label_printer/label_printer/label/robot_beds.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class RobotBeds < BasePlate # rubocop:todo Style/Documentation + class RobotBeds < BasePlate attr_reader :plates def initialize(beds) diff --git a/lib/label_printer/label_printer/label/sample_manifest_multiplex.rb b/lib/label_printer/label_printer/label/sample_manifest_multiplex.rb index 05e44a9a04..4c39701709 100644 --- a/lib/label_printer/label_printer/label/sample_manifest_multiplex.rb +++ b/lib/label_printer/label_printer/label/sample_manifest_multiplex.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class SampleManifestMultiplex < BaseTube # rubocop:todo Style/Documentation + class SampleManifestMultiplex < BaseTube attr_reader :sample_manifest def initialize(options) diff --git a/lib/label_printer/label_printer/label/sample_manifest_plate.rb b/lib/label_printer/label_printer/label/sample_manifest_plate.rb index 6bc9818066..7a99397d44 100644 --- a/lib/label_printer/label_printer/label/sample_manifest_plate.rb +++ b/lib/label_printer/label_printer/label/sample_manifest_plate.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class SampleManifestPlate < BasePlate # rubocop:todo Style/Documentation + class SampleManifestPlate < BasePlate attr_reader :sample_manifest, :only_first_label def initialize(options) diff --git a/lib/label_printer/label_printer/label/sample_manifest_plate_double.rb b/lib/label_printer/label_printer/label/sample_manifest_plate_double.rb index 6a6b46b114..f5a8a348dc 100644 --- a/lib/label_printer/label_printer/label/sample_manifest_plate_double.rb +++ b/lib/label_printer/label_printer/label/sample_manifest_plate_double.rb @@ -4,7 +4,7 @@ module LabelPrinter module Label - class SampleManifestPlateDouble < BasePlateDouble # rubocop:todo Style/Documentation + class SampleManifestPlateDouble < BasePlateDouble attr_reader :sample_manifest, :only_first_label def initialize(options) diff --git a/lib/label_printer/label_printer/label/sample_manifest_redirect.rb b/lib/label_printer/label_printer/label/sample_manifest_redirect.rb index 52d5ec7471..21f335e8fb 100644 --- a/lib/label_printer/label_printer/label/sample_manifest_redirect.rb +++ b/lib/label_printer/label_printer/label/sample_manifest_redirect.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class SampleManifestRedirect # rubocop:todo Style/Documentation + class SampleManifestRedirect attr_reader :options, :sample_manifest def initialize(options) diff --git a/lib/label_printer/label_printer/label/sample_manifest_tube.rb b/lib/label_printer/label_printer/label/sample_manifest_tube.rb index 092ccff027..9158f8fa9b 100644 --- a/lib/label_printer/label_printer/label/sample_manifest_tube.rb +++ b/lib/label_printer/label_printer/label/sample_manifest_tube.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class SampleManifestTube < BaseTube # rubocop:todo Style/Documentation + class SampleManifestTube < BaseTube attr_reader :sample_manifest, :only_first_label def initialize(options) diff --git a/lib/label_printer/label_printer/label/swipecard.rb b/lib/label_printer/label_printer/label/swipecard.rb index 258fb2790a..c754c8555a 100644 --- a/lib/label_printer/label_printer/label/swipecard.rb +++ b/lib/label_printer/label_printer/label/swipecard.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module LabelPrinter module Label - class Swipecard # rubocop:todo Style/Documentation + class Swipecard def initialize(attributes) @swipecard = attributes[:swipecard] @user_login = attributes[:user_login] diff --git a/lib/label_printer/label_printer/multiple_double_labels.rb b/lib/label_printer/label_printer/multiple_double_labels.rb index f0fb08ae59..a8841c2d9e 100644 --- a/lib/label_printer/label_printer/multiple_double_labels.rb +++ b/lib/label_printer/label_printer/multiple_double_labels.rb @@ -2,7 +2,7 @@ module LabelPrinter module Label - module MultipleDoubleLabels # rubocop:todo Style/Documentation + module MultipleDoubleLabels include MultipleLabels def create_labels diff --git a/lib/label_printer/label_printer/pmb_client.rb b/lib/label_printer/label_printer/pmb_client.rb index d48dd13dcf..d97445c38b 100644 --- a/lib/label_printer/label_printer/pmb_client.rb +++ b/lib/label_printer/label_printer/pmb_client.rb @@ -4,7 +4,7 @@ module LabelPrinter PmbException = Class.new(StandardError) - class PmbClient # rubocop:todo Style/Documentation + class PmbClient def self.base_url configatron.pmb_api end @@ -63,14 +63,16 @@ def self.get_label_template_by_name(name) def self.register_printer(name, printer_type) unless printer_exists?(name) - RestClient.post printers_url, - { 'data' => { 'attributes' => { 'name' => name, 'printer_type' => printer_type } } }.to_json, - headers + RestClient.post( + printers_url, + { 'data' => { 'attributes' => { 'name' => name, 'printer_type' => printer_type } } }.to_json, + **headers + ) end end def self.printer_exists?(name) - response = JSON.parse(RestClient.get "#{printers_filter_url}#{name}", headers) + response = JSON.parse(RestClient.get("#{printers_filter_url}#{name}", **headers)) response['data'].present? end diff --git a/lib/label_printer/label_printer/print_job.rb b/lib/label_printer/label_printer/print_job.rb index 2b575118de..15d6fed08f 100644 --- a/lib/label_printer/label_printer/print_job.rb +++ b/lib/label_printer/label_printer/print_job.rb @@ -2,7 +2,7 @@ # require 'pmb_client' module LabelPrinter - class PrintJob # rubocop:todo Style/Documentation + class PrintJob include ActiveModel::Validations attr_reader :printer_name, :label_class, :options, :labels diff --git a/lib/limber/helper.rb b/lib/limber/helper.rb index b93b4e7606..2ba0e325ef 100644 --- a/lib/limber/helper.rb +++ b/lib/limber/helper.rb @@ -3,7 +3,7 @@ # Helper templates and methods used in limber.rake module Limber::Helper PIPELINE = 'Limber-Htp' - PIPELINE_REGEX = /Illumina-[A-z]+ /.freeze + PIPELINE_REGEX = /Illumina-[A-z]+ / PRODUCTLINE = 'Illumina-Htp' # Construct submission templates for the Limber pipeline diff --git a/lib/manifest_util.rb b/lib/manifest_util.rb index 9f10583f8d..e810d7a622 100644 --- a/lib/manifest_util.rb +++ b/lib/manifest_util.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module ManifestUtil # rubocop:todo Style/Documentation +module ManifestUtil def is_end_of_header?(row, pos) ((pos != (row.length - 1)) && row[pos].blank? && row[pos + 1].blank?) end diff --git a/lib/product_helpers.rb b/lib/product_helpers.rb index d0f4bcb94b..5c6be42db6 100644 --- a/lib/product_helpers.rb +++ b/lib/product_helpers.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module ProductHelpers # rubocop:todo Style/Documentation +module ProductHelpers def self.single_template(name) { name: name, selection_behaviour: 'SingleProduct', products: { nil => name } } end diff --git a/lib/psd_formatter.rb b/lib/psd_formatter.rb index 7b7cc64779..4d661bdf6d 100644 --- a/lib/psd_formatter.rb +++ b/lib/psd_formatter.rb @@ -3,7 +3,7 @@ require 'syslog/logger' require 'ostruct' -class PsdFormatter < Syslog::Logger::Formatter # rubocop:todo Style/Documentation +class PsdFormatter < Syslog::Logger::Formatter LINE_FORMAT = "(thread-%s) [%s] %5s -- : %s\n".freeze def initialize(deployment_info) diff --git a/lib/record_loader/plate_purpose_loader.rb b/lib/record_loader/plate_purpose_loader.rb index 3e4c22960a..c9cc8e8c5a 100644 --- a/lib/record_loader/plate_purpose_loader.rb +++ b/lib/record_loader/plate_purpose_loader.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module RecordLoader - class PlatePurposeLoader < ApplicationRecordLoader # rubocop:todo Style/Documentation + class PlatePurposeLoader < ApplicationRecordLoader config_folder 'plate_purposes' DEFAULT_PRINTER_TYPE = '96 Well Plate' diff --git a/lib/request_class_deprecator.rb b/lib/request_class_deprecator.rb index 4d1811da0b..afd0469c17 100644 --- a/lib/request_class_deprecator.rb +++ b/lib/request_class_deprecator.rb @@ -9,7 +9,7 @@ # state_change: Hash of from_state => to_state applied to affected requests # } module RequestClassDeprecator - class Request < ApplicationRecord # rubocop:todo Style/Documentation + class Request < ApplicationRecord self.table_name = 'requests' end @@ -26,7 +26,7 @@ def deprecate_class(request_class_name, options = {}) # rubocop:todo Metrics/Abc ActiveRecord::Base.transaction do RequestType .where(request_class_name: request_class_name) - .each do |rt| + .find_each do |rt| say "Deprecating: #{rt.name}" rt.update!(deprecated: true) diff --git a/lib/request_type_purpose_creation.rb b/lib/request_type_purpose_creation.rb index 1e52de5db6..5479da7dd1 100644 --- a/lib/request_type_purpose_creation.rb +++ b/lib/request_type_purpose_creation.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module RequestTypePurposeCreation # rubocop:todo Style/Documentation +module RequestTypePurposeCreation def add_request_purpose self.request_purpose = :standard self diff --git a/lib/sequencing_qc_batch.rb b/lib/sequencing_qc_batch.rb index 42475df464..12bda0b1e5 100644 --- a/lib/sequencing_qc_batch.rb +++ b/lib/sequencing_qc_batch.rb @@ -51,7 +51,7 @@ def self.adjacent_state_helper(direction, offset, delimiter) # rubocop:todo Metr end return nil if qc_state.to_s == qc_states.send(delimiter) - return qc_states[qc_states.index(qc_state.to_s) + offset] + qc_states[qc_states.index(qc_state.to_s) + offset] end end diff --git a/lib/submission_serializer.rb b/lib/submission_serializer.rb index 4073f7ccb6..10f3c9cfad 100644 --- a/lib/submission_serializer.rb +++ b/lib/submission_serializer.rb @@ -14,7 +14,7 @@ # } # } -module SubmissionSerializer # rubocop:todo Style/Documentation +module SubmissionSerializer STRAIGHT_CLONE = %w[name submission_class_name].freeze SP_STRAIGHT_CLONE = %i[info_differential asset_input_methods request_options].freeze diff --git a/lib/tasks/add_templates_and_printers_to_pmb.rake b/lib/tasks/add_templates_and_printers_to_pmb.rake index 35f895ebdd..19aa80741c 100644 --- a/lib/tasks/add_templates_and_printers_to_pmb.rake +++ b/lib/tasks/add_templates_and_printers_to_pmb.rake @@ -4,7 +4,7 @@ require_relative '../../config/config' namespace :pmb do task add_label_templates: :environment do - class LabelTemplateCreator # rubocop:todo Style/Documentation + class LabelTemplateCreator attr_accessor :label_types class << self diff --git a/lib/tasks/create_mbrave_tags.rake b/lib/tasks/create_mbrave_tags.rake index 5aa190cb3b..7be603b031 100644 --- a/lib/tasks/create_mbrave_tags.rake +++ b/lib/tasks/create_mbrave_tags.rake @@ -58,7 +58,7 @@ namespace :mbrave do version = args[:version] tag_layout_templates = - TagLayoutTemplate.all.select do |template| + TagLayoutTemplate.select do |template| template.name.match(Regexp.new("^Bioscan_384_template_(\\d+)_#{version}$")) end diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake index 4981bf6f5a..d0225d86a0 100644 --- a/lib/tasks/cucumber.rake +++ b/lib/tasks/cucumber.rake @@ -41,19 +41,11 @@ unless ARGV.any? { |a| a =~ /^gems/ } task statsetup: :environment do require 'rails/code_statistics' - ::STATS_DIRECTORIES << %w[Cucumber\ features features] if File.exist?('features') - ::CodeStatistics::TEST_TYPES << 'Cucumber features' if File.exist?('features') - end - - task annotations_setup: :environment do - Rails.application.configure do - if config.respond_to?(:annotations) - config.annotations.directories << 'features' - config.annotations.register_extensions('feature') { |tag| /#\s*(#{tag}):?\s*(.*)$/ } - end - end + STATS_DIRECTORIES << %w[Cucumber\ features features] if File.exist?('features') + CodeStatistics::TEST_TYPES << 'Cucumber features' if File.exist?('features') end end + desc 'Alias for cucumber:ok' task cucumber: 'cucumber:ok' @@ -68,8 +60,6 @@ unless ARGV.any? { |a| a =~ /^gems/ } end task stats: 'cucumber:statsetup' - - task notes: 'cucumber:annotations_setup' rescue LoadError desc 'cucumber rake task not available (cucumber not installed)' task cucumber: :environment do diff --git a/lib/tasks/jsorm.rake b/lib/tasks/jsorm.rake index 0d31de2e50..1d44d77d4a 100644 --- a/lib/tasks/jsorm.rake +++ b/lib/tasks/jsorm.rake @@ -37,7 +37,7 @@ namespace :jsorm do resource = Api::V2.const_get(resource_key) next unless resource < Api::V2::BaseResource - name = resource_key.to_s.gsub(/Resource/, '') + name = resource_key.to_s.gsub('Resource', '') type = resource._type puts " #{name}: ApplicationRecord.extend({" puts " static: { jsonapiType: '#{type}' }," diff --git a/lib/tasks/rebroadcast_pac_bio_multiple_requests_run.rake b/lib/tasks/rebroadcast_pac_bio_multiple_requests_run.rake index d359a30f7b..1b598d6ddf 100644 --- a/lib/tasks/rebroadcast_pac_bio_multiple_requests_run.rake +++ b/lib/tasks/rebroadcast_pac_bio_multiple_requests_run.rake @@ -191,6 +191,6 @@ namespace :pac_bio_run do 9993 ] - Messenger.where(template: 'PacBioRunIO', target_id: list_of_runs).each(&:broadcast) + Messenger.where(template: 'PacBioRunIO', target_id: list_of_runs).find_each(&:broadcast) end end diff --git a/lib/tasks/sequencing.rake b/lib/tasks/sequencing.rake index 288047fce3..14a624b30a 100644 --- a/lib/tasks/sequencing.rake +++ b/lib/tasks/sequencing.rake @@ -6,10 +6,10 @@ namespace :sequencing do desc 'Run to update descriptors. Can be removed once run' task update_descriptors: :environment do - Descriptor.where(name: 'Operator').each(&:destroy) + Descriptor.where(name: 'Operator').find_each(&:destroy) Task .where(workflow: Workflow.where(name: 'NovaSeq 6000 PE'), name: 'Read 1 & 2') - .each { |task| task.descriptors.where(name: 'Pipette Carousel').each(&:destroy) } + .find_each { |task| task.descriptors.where(name: 'Pipette Carousel').find_each(&:destroy) } end task 'application:post_deploy' => 'sequencing:update_descriptors' diff --git a/lib/tasks/support/update_library_types.rake b/lib/tasks/support/update_library_types.rake index 2989a86c00..90cb4510e9 100644 --- a/lib/tasks/support/update_library_types.rake +++ b/lib/tasks/support/update_library_types.rake @@ -30,7 +30,7 @@ namespace :support do lane.aliquots.each do |aliquot| Aliquot .where(library_id: aliquot.library_id) - .each do |ali| + .find_each do |ali| ali.library_type = new_library_type.name ali.save! record_count += 1 diff --git a/lib/validateable.rb b/lib/validateable.rb index 77177c5712..08c6010541 100644 --- a/lib/validateable.rb +++ b/lib/validateable.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Validateable # rubocop:todo Style/Documentation +module Validateable %i[save save! update_attribute].each { |attr| define_method(attr) {} } def method_missing(symbol, *_params) @@ -16,7 +16,7 @@ def validate! raise(ActiveRecord::RecordInvalid, self) unless valid? end - module ClassMethods # rubocop:todo Style/Documentation + module ClassMethods def self_and_descendants_from_active_record [self] end @@ -31,7 +31,7 @@ def human_attribute_name(attribute_key_name, options = {}) # rubocop:todo Metric defaults.flatten! defaults << attribute_key_name.to_s.humanize options[:count] ||= 1 - I18n.t(defaults.shift, options.merge(default: defaults, scope: %i[activerecord attributes])) + I18n.t(defaults.shift, **options.merge(default: defaults, scope: %i[activerecord attributes])) end def human_name(options = {}) diff --git a/lib/views_schema.rb b/lib/views_schema.rb index 3055242dc5..88f2e868e9 100644 --- a/lib/views_schema.rb +++ b/lib/views_schema.rb @@ -32,8 +32,8 @@ module ViewsSchema # rubocop:todo Layout/LineLength REGEXP = /\ACREATE ALGORITHM=(?\w*) DEFINER=`[^`]*`@`[^`]*` SQL SECURITY (?\w*) VIEW `[^`]+` AS (?.*)\z/i - # rubocop:enable Layout/LineLength - .freeze + + # rubocop:enable Layout/LineLength def self.each_view all_views.each do |name| diff --git a/lib/working_setup/standard_seeder.rb b/lib/working_setup/standard_seeder.rb index 8458bbaace..b06fc2ea9f 100644 --- a/lib/working_setup/standard_seeder.rb +++ b/lib/working_setup/standard_seeder.rb @@ -37,7 +37,7 @@ def supplier end def seed - Sample.all.each { |s| study_b.samples << s } + Sample.find_each { |s| study_b.samples << s } create_purposes Robot diff --git a/script/spec b/script/spec index c9deb5f054..b8f14c700e 100755 --- a/script/spec +++ b/script/spec @@ -8,4 +8,4 @@ else require File.expand_path(File.dirname(__FILE__) + '/../config/environment') unless defined?(Rails.root) end require 'spec/autorun' -exit ::Spec::Runner::CommandLine.run +exit Spec::Runner::CommandLine.run diff --git a/script/support/.rubocop.yml b/script/support/.rubocop.yml index 876c3922fe..f37145aea9 100644 --- a/script/support/.rubocop.yml +++ b/script/support/.rubocop.yml @@ -1,2 +1,5 @@ inherit_from: .rubocop_todo.yml require: rubocop-rails + +Style/Documentation: + Enabled: false diff --git a/spec/api/state_change_spec.rb b/spec/api/state_change_spec.rb index c348d96c7f..2e21b88ebe 100644 --- a/spec/api/state_change_spec.rb +++ b/spec/api/state_change_spec.rb @@ -49,13 +49,13 @@ before { api_request :post, subject, payload } - it 'supports resource creation', aggregate_failures: true do + it 'supports resource creation', :aggregate_failures do expect(JSON.parse(response.body)).to include_json(JSON.parse(response_body)) expect(status).to eq(response_code) end # This probably best belongs on a unit test. Just porting current feature tests for now. - it 'transitions the selected well only', aggregate_failures: true do + it 'transitions the selected well only', :aggregate_failures do all_wells = target_plate.maps.pluck(:description) affected_wells = contents || all_wells unaffected_wells = all_wells - affected_wells @@ -81,7 +81,7 @@ before { api_request :post, subject, payload } - it 'errors on resource creation', aggregate_failures: true do + it 'errors on resource creation', :aggregate_failures do expect(JSON.parse(response.body)).to include_json(JSON.parse(response_body)) expect(status).to eq(response_code) end diff --git a/spec/api/transfer_request_collection_spec.rb b/spec/api/transfer_request_collection_spec.rb index bb10f3dcc2..699f75d514 100644 --- a/spec/api/transfer_request_collection_spec.rb +++ b/spec/api/transfer_request_collection_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'shared_contexts/limber_shared_context' -describe '/api/1/transfer_request_collection', transfer_request_collection: true do +describe '/api/1/transfer_request_collection', :transfer_request_collection do include_context 'a limber target plate with submissions' subject { '/api/1/transfer_request_collection' } diff --git a/spec/bulk_submission_excel/bulk_submission_excel_spec.rb b/spec/bulk_submission_excel/bulk_submission_excel_spec.rb index 8f4ecf0256..328bb3a544 100644 --- a/spec/bulk_submission_excel/bulk_submission_excel_spec.rb +++ b/spec/bulk_submission_excel/bulk_submission_excel_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe BulkSubmissionExcel, bulk_submission_excel: true, type: :model do +RSpec.describe BulkSubmissionExcel, :bulk_submission_excel, type: :model do before do described_class.configure do |config| config.folder = File.join('spec', 'data', 'bulk_submission_excel') diff --git a/spec/bulk_submission_excel/configuration_spec.rb b/spec/bulk_submission_excel/configuration_spec.rb index 0bd8faf894..0378de7513 100644 --- a/spec/bulk_submission_excel/configuration_spec.rb +++ b/spec/bulk_submission_excel/configuration_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe BulkSubmissionExcel::Configuration, bulk_submission_excel: true, type: :model do +RSpec.describe BulkSubmissionExcel::Configuration, :bulk_submission_excel, type: :model do let(:configuration) { described_class.new } it 'is comparable' do diff --git a/spec/bulk_submission_excel/data_worksheet_spec.rb b/spec/bulk_submission_excel/data_worksheet_spec.rb index 0d30e018d1..b5b03206e4 100644 --- a/spec/bulk_submission_excel/data_worksheet_spec.rb +++ b/spec/bulk_submission_excel/data_worksheet_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe BulkSubmissionExcel::Worksheet::DataWorksheet, bulk_submission_excel: true, type: :model do +RSpec.describe BulkSubmissionExcel::Worksheet::DataWorksheet, :bulk_submission_excel, type: :model do let(:xls) { Axlsx::Package.new } let(:workbook) { xls.workbook } let(:test_file) { 'test.xlsx' } diff --git a/spec/bulk_submission_excel/download_spec.rb b/spec/bulk_submission_excel/download_spec.rb index 521c5a4195..52375e7a63 100644 --- a/spec/bulk_submission_excel/download_spec.rb +++ b/spec/bulk_submission_excel/download_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe BulkSubmissionExcel::Download, bulk_submission_excel: true, type: :model do +RSpec.describe BulkSubmissionExcel::Download, :bulk_submission_excel, type: :model do attr_reader :download, :spreadsheet let(:test_file) { 'test.xlsx' } @@ -75,7 +75,7 @@ end it 'have the correct number of columns' do - expect(download.column_list.count).to eq(configuration.columns.all.count) + expect(download.column_list.count).to eq(configuration.columns.count) end describe 'with requested_flowcell_type column' do diff --git a/spec/controllers/api/v2/heron/plates_controller_spec.rb b/spec/controllers/api/v2/heron/plates_controller_spec.rb index f544629669..2298b4f593 100644 --- a/spec/controllers/api/v2/heron/plates_controller_spec.rb +++ b/spec/controllers/api/v2/heron/plates_controller_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'support/barcode_helper' -RSpec.describe Api::V2::Heron::PlatesController, heron: true, type: :request do +RSpec.describe Api::V2::Heron::PlatesController, :heron, type: :request do include BarcodeHelper let(:stock_plate_purpose) { PlatePurpose.stock_plate_purpose } diff --git a/spec/controllers/api/v2/heron/tube_racks_controller_spec.rb b/spec/controllers/api/v2/heron/tube_racks_controller_spec.rb index 3256916ebb..94e8df454b 100644 --- a/spec/controllers/api/v2/heron/tube_racks_controller_spec.rb +++ b/spec/controllers/api/v2/heron/tube_racks_controller_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'support/barcode_helper' -RSpec.describe Api::V2::Heron::TubeRacksController, heron: true, type: :request do +RSpec.describe Api::V2::Heron::TubeRacksController, :heron, type: :request do include BarcodeHelper let!(:purpose_96) { create(:tube_rack_purpose, target_type: 'TubeRack', size: 96) } diff --git a/spec/controllers/labwhere_receptions_controller_spec.rb b/spec/controllers/labwhere_receptions_controller_spec.rb index 633e576621..85636935c0 100644 --- a/spec/controllers/labwhere_receptions_controller_spec.rb +++ b/spec/controllers/labwhere_receptions_controller_spec.rb @@ -11,7 +11,7 @@ shared_examples 'a reception' do before do - expect(LabWhereClient::Scan).to receive(:create) # rubocop:todo RSpec/ExpectInHook + expect(LabWhereClient::Scan).to receive(:create) .with( location_barcode: location_barcode, user_code: SBCF::SangerBarcode.from_human(user.barcode).machine_barcode.to_s, diff --git a/spec/controllers/npg_actions/assets_controller_spec.rb b/spec/controllers/npg_actions/assets_controller_spec.rb index 64e0e874dc..0dbae5b567 100644 --- a/spec/controllers/npg_actions/assets_controller_spec.rb +++ b/spec/controllers/npg_actions/assets_controller_spec.rb @@ -36,7 +36,7 @@ before { post '/login', params: { login: user.login, password: 'password' } } shared_examples 'a passed state change' do - it 'renders and creates events', aggregate_failures: true do + it 'renders and creates events', :aggregate_failures do # Response expect(response).to have_http_status(:ok) expect(response).to render_template :'assets/show.xml.builder' @@ -61,7 +61,7 @@ end shared_examples 'a failed state change' do - it 'renders and creates events', aggregate_failures: true do + it 'renders and creates events', :aggregate_failures do # Response expect(response).to render_template :'assets/show.xml.builder' expect(response.body).to match(expected_response_content) @@ -266,7 +266,7 @@ lane.reload end - it 'renders and but does not recreate the events', aggregate_failures: true do + it 'renders and but does not recreate the events', :aggregate_failures do # Response expect(response).to have_http_status(:ok) expect(response).to render_template :'assets/show.xml.builder' diff --git a/spec/controllers/phi_x/spiked_buffers_controller_spec.rb b/spec/controllers/phi_x/spiked_buffers_controller_spec.rb index 4a07e5e3d3..ba17b3ee01 100644 --- a/spec/controllers/phi_x/spiked_buffers_controller_spec.rb +++ b/spec/controllers/phi_x/spiked_buffers_controller_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe PhiX::SpikedBuffersController, phi_x: true do +RSpec.describe PhiX::SpikedBuffersController, :phi_x do describe 'POST create' do let(:current_user) { create :user } let(:library_tube) { create :phi_x_stock_tube, name: 'PhiX Stock' } diff --git a/spec/controllers/phi_x/stocks_controller_spec.rb b/spec/controllers/phi_x/stocks_controller_spec.rb index fb61cedf6a..912fe76a3e 100644 --- a/spec/controllers/phi_x/stocks_controller_spec.rb +++ b/spec/controllers/phi_x/stocks_controller_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe PhiX::StocksController, phi_x: true do +RSpec.describe PhiX::StocksController, :phi_x do describe 'POST create' do let(:current_user) { create :user } let(:study) { create :study } diff --git a/spec/controllers/phi_xes_controller_spec.rb b/spec/controllers/phi_xes_controller_spec.rb index e96a80196d..0e38077378 100644 --- a/spec/controllers/phi_xes_controller_spec.rb +++ b/spec/controllers/phi_xes_controller_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe PhiXesController, phi_x: true do +RSpec.describe PhiXesController, :phi_x do describe 'GET show' do let(:current_user) { create :user } diff --git a/spec/controllers/sequenom_qc_plates_controller_spec.rb b/spec/controllers/sequenom_qc_plates_controller_spec.rb index f1fc435a1f..baa03245c6 100644 --- a/spec/controllers/sequenom_qc_plates_controller_spec.rb +++ b/spec/controllers/sequenom_qc_plates_controller_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SequenomQcPlatesController, phi_x: true do +RSpec.describe SequenomQcPlatesController, :phi_x do describe 'GET index' do let(:current_user) { create :user } diff --git a/spec/controllers/studies_controller_spec.rb b/spec/controllers/studies_controller_spec.rb index 5c2d5ae2f2..430b9c45ad 100644 --- a/spec/controllers/studies_controller_spec.rb +++ b/spec/controllers/studies_controller_spec.rb @@ -55,7 +55,7 @@ end it 'changes Study.count by 1' do - assert_equal 1, Study.count - @study_count + expect(Study.count - @study_count).to eq(1) end end @@ -73,7 +73,7 @@ end it 'not change Study.count' do - assert_equal @initial_study_count, Study.count + expect(Study.count).to eq(@initial_study_count) end end end diff --git a/spec/controllers/submissions_controller_spec.rb b/spec/controllers/submissions_controller_spec.rb index 160572f553..63efe6562e 100644 --- a/spec/controllers/submissions_controller_spec.rb +++ b/spec/controllers/submissions_controller_spec.rb @@ -47,7 +47,7 @@ end it 'allow update of priorities' do - assert_equal 3, @submission.reload.priority + expect(@submission.reload.priority).to eq(3) end end @@ -136,7 +136,7 @@ end it 'create the appropriate orders' do - assert_equal 4, Order.first.assets.count + expect(Order.first.assets.count).to eq(4) end context 'with a more recent plate' do @@ -173,8 +173,8 @@ # Return an empty hash if we have no hits, makes the test failures clearer. per_plate.default = [] - assert_equal 1, per_plate[@new_plate].count - assert_equal 3, per_plate[@plate].count + expect(per_plate[@new_plate].count).to eq(1) + expect(per_plate[@plate].count).to eq(3) end end end @@ -215,7 +215,7 @@ end it 'used the working dilution plate' do - assert_equal 1, Order.count - @order_count + expect(Order.count - @order_count).to eq(1) wells = Order.last.assets @@ -232,7 +232,7 @@ it 'create the appropriate orders' do assert Order.first.present?, 'No order was created!' - assert_equal 9, Order.first.assets.count + expect(Order.first.assets.count).to eq(9) end end @@ -243,7 +243,7 @@ end it 'create the appropriate orders' do - assert_equal 9, Order.first.assets.count + expect(Order.first.assets.count).to eq(9) end end @@ -251,7 +251,7 @@ before { post :create, params: plate_submission('SQPD-123456:A1,B3,C2') } it 'create the appropriate orders' do - assert_equal 3, Order.first.assets.count + expect(Order.first.assets.count).to eq(3) end end @@ -259,7 +259,7 @@ before { post :create, params: plate_submission('SQPD-123456:B,C') } it 'create the appropriate orders' do - assert_equal 6, Order.first.assets.count + expect(Order.first.assets.count).to eq(6) end end @@ -267,7 +267,7 @@ before { post :create, params: plate_submission('SQPD-123456:1,2,3') } it 'create the appropriate orders' do - assert_equal 9, Order.first.assets.count + expect(Order.first.assets.count).to eq(9) end end diff --git a/spec/factories/asset_audits.rb b/spec/factories/asset_audits.rb index 9e9ec9b40b..67d6967d0b 100644 --- a/spec/factories/asset_audits.rb +++ b/spec/factories/asset_audits.rb @@ -6,6 +6,6 @@ key { 'some_key' } created_by { 'abc123' } witnessed_by { 'jane' } - association(:asset, factory: :labware) + asset factory: %i[labware] end end diff --git a/spec/factories/asset_groups.rb b/spec/factories/asset_groups.rb index b82563b597..4411d565ea 100644 --- a/spec/factories/asset_groups.rb +++ b/spec/factories/asset_groups.rb @@ -15,7 +15,7 @@ end factory :asset_group_asset do - association(:asset, factory: :receptacle) + asset factory: %i[receptacle] asset_group end end diff --git a/spec/factories/barcode_factories.rb b/spec/factories/barcode_factories.rb index 0792f6b974..9699f0802d 100644 --- a/spec/factories/barcode_factories.rb +++ b/spec/factories/barcode_factories.rb @@ -4,7 +4,7 @@ sequence(:barcode_number) { |i| i } factory :barcode, aliases: [:external] do - association(:asset, factory: :labware) + asset factory: %i[labware] sequence(:barcode) { |i| "EXT_#{i}_A" } format { 'external' } diff --git a/spec/factories/barcode_printers.rb b/spec/factories/barcode_printers.rb index 4e7d911834..3eea0e112c 100644 --- a/spec/factories/barcode_printers.rb +++ b/spec/factories/barcode_printers.rb @@ -3,6 +3,6 @@ FactoryBot.define do factory(:barcode_printer) do sequence(:name) { |i| "a#{i}bc" } - association(:barcode_printer_type, factory: :plate_barcode_printer_type) + barcode_printer_type factory: %i[plate_barcode_printer_type] end end diff --git a/spec/factories/batch_factories.rb b/spec/factories/batch_factories.rb index 373bdd4e4f..b4077ba19f 100644 --- a/spec/factories/batch_factories.rb +++ b/spec/factories/batch_factories.rb @@ -29,11 +29,11 @@ end factory :multiplexed_batch do - association(:pipeline, factory: :multiplexed_pipeline) + pipeline factory: %i[multiplexed_pipeline] end factory :sequencing_batch do - association(:pipeline, factory: :sequencing_pipeline) + pipeline factory: %i[sequencing_pipeline] end factory :cherrypick_batch do @@ -42,7 +42,7 @@ batch_request_factory { :cherrypick_batch_request } request_factory { :cherrypick_request } end - association(:pipeline, factory: :cherrypick_pipeline) + pipeline factory: %i[cherrypick_pipeline] end end @@ -53,7 +53,7 @@ assets { create_list(:pac_bio_library_tube, request_count) } end - association(:pipeline, factory: :pac_bio_sequencing_pipeline) + pipeline factory: %i[pac_bio_sequencing_pipeline] after(:build) do |batch, evaluator| evaluator.assets.each_with_index.each do |asset, index| diff --git a/spec/factories/broadcast_event_factories.rb b/spec/factories/broadcast_event_factories.rb index 625579aef9..03c824c3de 100644 --- a/spec/factories/broadcast_event_factories.rb +++ b/spec/factories/broadcast_event_factories.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :broadcast_event_asset_audit, class: 'BroadcastEvent::AssetAudit' do - association(:seed, factory: :asset_audit) + seed factory: %i[asset_audit] end factory :event_subject, class: Hash do diff --git a/spec/factories/comments.rb b/spec/factories/comments.rb index d97d581c83..b6f599ecba 100644 --- a/spec/factories/comments.rb +++ b/spec/factories/comments.rb @@ -3,6 +3,6 @@ FactoryBot.define do factory :comment do description { 'It is okay I guess' } - association(:commentable, factory: :labware) + commentable factory: %i[labware] end end diff --git a/spec/factories/custom_metadatum_collection_factories.rb b/spec/factories/custom_metadatum_collection_factories.rb index 03fb2abdee..ea75323023 100644 --- a/spec/factories/custom_metadatum_collection_factories.rb +++ b/spec/factories/custom_metadatum_collection_factories.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :custom_metadatum_collection do - association(:asset, factory: :labware) + asset factory: %i[labware] user factory :custom_metadatum_collection_with_metadata do diff --git a/spec/factories/lib_pcr_xp_factories.rb b/spec/factories/lib_pcr_xp_factories.rb index 556001f2ea..7258eb7307 100644 --- a/spec/factories/lib_pcr_xp_factories.rb +++ b/spec/factories/lib_pcr_xp_factories.rb @@ -43,14 +43,14 @@ factory :lib_pool_tube, class: 'StockMultiplexedLibraryTube' do name { |_a| FactoryBot.generate :asset_name } - association(:purpose, factory: :illumina_htp_initial_stock_tube_purpose) + purpose factory: %i[illumina_htp_initial_stock_tube_purpose] after(:create) { |tube| create(:transfer_request, target_asset: tube) } end factory :lib_pool_norm_tube, class: 'MultiplexedLibraryTube' do transient { parent_tube { create :lib_pool_tube } } name { generate :asset_name } - association(:purpose, factory: :illumina_htp_mx_tube_purpose) + purpose factory: %i[illumina_htp_mx_tube_purpose] after(:create) { |tube, factory| create(:transfer_request, asset: factory.parent_tube, target_asset: tube) } end end diff --git a/spec/factories/messengers.rb b/spec/factories/messengers.rb index 8981b18667..7e1934c6b9 100644 --- a/spec/factories/messengers.rb +++ b/spec/factories/messengers.rb @@ -9,12 +9,12 @@ factory :messenger do root { 'barcode' } - association(:target, factory: :barcode) + target factory: %i[barcode] template { 'BarcodeIO' } factory :flowcell_messenger do root { 'flowcell' } - association(:target, factory: :sequencing_batch) + target factory: %i[sequencing_batch] template { 'FlowcellIO' } end end diff --git a/spec/factories/pipelines_factories.rb b/spec/factories/pipelines_factories.rb index 859bb74947..546a33f259 100644 --- a/spec/factories/pipelines_factories.rb +++ b/spec/factories/pipelines_factories.rb @@ -101,7 +101,7 @@ control_request_type_id { 0 } min_size { 1 } - association(:workflow, factory: :fluidigm_pipeline_workflow) + workflow factory: %i[fluidigm_pipeline_workflow] after(:build) { |pipeline| pipeline.request_types << build(:well_request_type) } end @@ -234,12 +234,12 @@ factory :cherrypick_batch_request do batch - association(:request, factory: :cherrypick_request) + request factory: %i[cherrypick_request] end factory :sequencing_batch_request do batch - association(:request, factory: :complete_sequencing_request) + request factory: %i[complete_sequencing_request] end end @@ -280,8 +280,8 @@ factory :asset_link do # Asset links get annoyed if created between nodes which have # not been persisted. - association(:ancestor, factory: :labware, strategy: :create) - association(:descendant, factory: :labware, strategy: :create) + ancestor factory: %i[labware], strategy: :create + descendant factory: %i[labware], strategy: :create direct { true } end diff --git a/spec/factories/plate_factories.rb b/spec/factories/plate_factories.rb index 502c1f7cc4..740929ebab 100644 --- a/spec/factories/plate_factories.rb +++ b/spec/factories/plate_factories.rb @@ -68,7 +68,7 @@ transient { barcode { nil } } factory :input_plate do - association(:plate_purpose, factory: :input_plate_purpose) + plate_purpose factory: %i[input_plate_purpose] end factory :target_plate do @@ -196,7 +196,7 @@ end factory :input_plate_for_pooling do - association(:plate_purpose, factory: :input_plate_purpose) + plate_purpose factory: %i[input_plate_purpose] transient do well_count { 6 } well_factory { :tagged_well } @@ -204,7 +204,7 @@ end factory :stock_plate do - association(:plate_purpose, factory: :stock_plate_purpose) + plate_purpose factory: %i[stock_plate_purpose] end factory(:full_stock_plate) do diff --git a/spec/factories/pulldown_factories.rb b/spec/factories/pulldown_factories.rb index a26d4260e7..6ceea99f2f 100644 --- a/spec/factories/pulldown_factories.rb +++ b/spec/factories/pulldown_factories.rb @@ -20,13 +20,13 @@ # Transfers and their templates factory(:transfer_between_plates, class: 'Transfer::BetweenPlates') do user - association(:source, factory: :transfer_plate) - association(:destination, factory: :plate_with_empty_wells) + source factory: %i[transfer_plate] + destination factory: %i[plate_with_empty_wells] transfers { { 'A1' => 'A1', 'B1' => 'B1' } } factory(:full_transfer_between_plates) do - association(:source, factory: :full_plate) - association(:destination, factory: :full_plate) + source factory: %i[full_plate] + destination factory: %i[full_plate] transfers { ('A'..'H').map { |r| (1..12).map { |c| "#{r}#{c}" } }.flatten.to_h { |w| [w, w] } } end end @@ -105,8 +105,8 @@ factory(:plate_creation) do user barcode { create(:sequencescape22).barcode } - association(:parent, factory: :full_plate, well_count: 2) - association(:child_purpose, factory: :plate_purpose) + parent factory: %i[full_plate], well_count: 2 + child_purpose factory: %i[plate_purpose] # PlateCreation inherits from AssetCreation that will try to call # Baracoda to obtain a new barcode. As this is not needed for the @@ -116,8 +116,8 @@ factory(:tube_creation) do user - association(:parent, factory: :full_plate, well_count: 2) - association(:child_purpose, factory: :child_tube_purpose) + parent factory: %i[full_plate], well_count: 2 + child_purpose factory: %i[child_tube_purpose] after(:build) do |tube_creation| mock_request_type = create(:library_creation_request_type) @@ -165,7 +165,7 @@ factory(:isc_request, class: 'Pulldown::Requests::IscLibraryRequest', aliases: [:pulldown_isc_request]) do transient { bait_library { BaitLibrary.first || create(:bait_library) } } - association(:request_type, factory: :library_creation_request_type) + request_type factory: %i[library_creation_request_type] asset { |target| target.association(:well_with_sample_and_plate) } target_asset { |target| target.association(:empty_well) } request_purpose { :standard } @@ -180,9 +180,9 @@ end factory(:re_isc_request, class: 'Pulldown::Requests::ReIscLibraryRequest') do - association(:request_type, factory: :library_request_type) - association(:asset, factory: :well_with_sample_and_plate) - association(:target_asset, factory: :empty_well) + request_type factory: %i[library_request_type] + asset factory: %i[well_with_sample_and_plate] + target_asset factory: %i[empty_well] request_purpose { :standard } request_metadata_attributes do { diff --git a/spec/factories/purpose_factories.rb b/spec/factories/purpose_factories.rb index ee295ff358..77de1bc374 100644 --- a/spec/factories/purpose_factories.rb +++ b/spec/factories/purpose_factories.rb @@ -35,7 +35,7 @@ prefix { 'DN' } name { generate :purpose_name } size { 96 } - association(:barcode_printer_type, factory: :plate_barcode_printer_type) + barcode_printer_type factory: %i[plate_barcode_printer_type] target_type { 'Plate' } asset_shape { AssetShape.default } @@ -58,12 +58,12 @@ factory :fluidigm_96_purpose do cherrypick_direction { 'interlaced_column' } size { 96 } - association(:asset_shape, factory: :fluidigm_96_shape) + asset_shape factory: %i[fluidigm_96_shape] end factory :fluidigm_192_purpose do cherrypick_direction { 'interlaced_column' } size { 192 } - association(:asset_shape, factory: :fluidigm_192_shape) + asset_shape factory: %i[fluidigm_192_shape] end end diff --git a/spec/factories/qc_results.rb b/spec/factories/qc_results.rb index 5a0a118aff..3b8ad3d174 100644 --- a/spec/factories/qc_results.rb +++ b/spec/factories/qc_results.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :qc_result do - association(:asset, factory: :receptacle) + asset factory: %i[receptacle] key { 'molarity' } value { '5.43' } units { 'nM' } diff --git a/spec/factories/request_factories.rb b/spec/factories/request_factories.rb index 1972e244e4..28bef29184 100644 --- a/spec/factories/request_factories.rb +++ b/spec/factories/request_factories.rb @@ -17,7 +17,7 @@ sti_type { 'MultiplexedLibraryCreationRequest' } asset { |asset| asset.association(:sample_tube) } target_asset { |asset| asset.association(:library_tube) } - association(:request_type, factory: :multiplexed_library_creation_request_type) + request_type factory: %i[multiplexed_library_creation_request_type] request_metadata_attributes do { fragment_size_required_from: 150, fragment_size_required_to: 400, library_type: 'Standard' } end @@ -41,7 +41,7 @@ factory :customer_request, class: 'CustomerRequest' do sti_type { 'CustomerRequest' } # Oddly, this seems to be necessary! - association(:request_type, factory: :customer_request_type) + request_type factory: %i[customer_request_type] end factory :create_asset_request do @@ -50,20 +50,20 @@ end factory :sequencing_request, class: 'SequencingRequest' do - association(:request_type, factory: :sequencing_request_type) + request_type factory: %i[sequencing_request_type] request_purpose { :standard } sti_type { 'SequencingRequest' } request_metadata_attributes { attributes_for :request_metadata_for_standard_sequencing_with_read_length } factory(:sequencing_request_with_assets) do - association(:asset, factory: :library_tube) - association(:target_asset, factory: :lane) + asset factory: %i[library_tube] + target_asset factory: %i[lane] end factory(:complete_sequencing_request) do transient { event_descriptors { { 'Chip Barcode' => 'fcb' } } } - association(:asset, factory: :library_tube) - association(:target_asset, factory: :lane) + asset factory: %i[library_tube] + target_asset factory: %i[lane] after(:build) do |request, evaluator| request.lab_events << build(:flowcell_event, descriptors: evaluator.event_descriptors, batch: request.batch) @@ -72,8 +72,8 @@ end factory(:library_creation_request, parent: :request, class: 'LibraryCreationRequest') do - association(:asset, factory: :sample_tube) - association(:request_type, factory: :library_creation_request_type) + asset factory: %i[sample_tube] + request_type factory: %i[library_creation_request_type] request_metadata_attributes do { fragment_size_required_from: 100, fragment_size_required_to: 200, library_type: 'Standard' } @@ -82,8 +82,8 @@ # Well based library request as used in eg. Limber pipeline factory :library_request, class: 'IlluminaHtp::Requests::StdLibraryRequest' do - association(:asset, factory: :well) - association(:request_type, factory: :library_request_type) + asset factory: %i[well] + request_type factory: %i[library_request_type] request_purpose { :standard } request_metadata_attributes { attributes_for :request_metadata_for_library_manufacture } @@ -102,24 +102,24 @@ factory(:multiplex_request, class: 'Request::Multiplexing') do asset { nil } - association(:target_asset, factory: :multiplexed_library_tube) - association(:request_type, factory: :multiplex_request_type) + target_asset factory: %i[multiplexed_library_tube] + request_type factory: %i[multiplex_request_type] request_purpose { :standard } end factory :cherrypick_request do - association :asset, factory: :well - association :target_asset, factory: :well - association(:request_type, factory: :cherrypick_request_type) + asset factory: %i[well] + target_asset factory: %i[well] + request_type factory: %i[cherrypick_request_type] request_purpose { :standard } # Adds the associations needed for processing down a pipeline factory :cherrypick_request_for_pipeline do - association :asset, factory: :well_with_sample_and_plate + asset factory: %i[well_with_sample_and_plate] submission factory :passed_cherrypick_request do - association :target_asset, factory: :well_with_sample_and_plate + target_asset factory: %i[well_with_sample_and_plate] state { 'passed' } end end @@ -127,14 +127,14 @@ factory :cherrypick_for_fluidigm_request do transient { target_purpose { create :plate_purpose } } - association :asset, factory: :well - association :target_asset, factory: :well - association(:request_type, factory: :cherrypick_request_type) + asset factory: %i[well] + target_asset factory: %i[well] + request_type factory: %i[cherrypick_request_type] request_purpose { :standard } request_metadata_attributes { { target_purpose: target_purpose } } factory :final_cherrypick_for_fluidigm_request do - association(:request_type, factory: :request_type, key: 'pick_to_fluidigm') + request_type factory: %i[request_type], key: 'pick_to_fluidigm' end end @@ -148,8 +148,8 @@ factory :request, parent: :request_without_assets do # the sample should be setup correctly and the assets should be valid - association(:asset, factory: :sample_tube) - association(:target_asset, factory: :empty_library_tube) + asset factory: %i[sample_tube] + target_asset factory: %i[empty_library_tube] factory :request_with_submission do after(:build) do |request| @@ -194,10 +194,10 @@ end factory :request_traction_grid_ion, class: 'Request::Traction::GridIon' do - association(:asset, factory: :well) + asset factory: %i[well] target_asset { nil } request_purpose { :standard } - association(:request_type, factory: :well_request_type) + request_type factory: %i[well_request_type] request_metadata_attributes { attributes_for(:request_traction_grid_ion_metadata) } end @@ -222,7 +222,7 @@ class: 'Request::LibraryCreation', aliases: [:library_creation_request_for_testing_sequencing_requests] ) do - association(:request_type, factory: :library_creation_request_type) + request_type factory: %i[library_creation_request_type] request_purpose { :standard } asset { |target| target.association(:well_with_sample_and_plate) } target_asset { |target| target.association(:empty_well) } @@ -240,7 +240,7 @@ target_asset { |ta| ta.association(:pac_bio_library_tube) } asset { |a| a.association(:well) } submission { |s| s.association(:submission) } - association(:request_type, factory: :pac_bio_sample_prep_request_type) + request_type factory: %i[pac_bio_sample_prep_request_type] request_purpose { :standard } end diff --git a/spec/factories/request_metadata.rb b/spec/factories/request_metadata.rb index 36b49cef78..1e98bad652 100644 --- a/spec/factories/request_metadata.rb +++ b/spec/factories/request_metadata.rb @@ -9,7 +9,7 @@ factory :request_traction_grid_ion_metadata, class: 'Request::Traction::GridIon::Metadata' do library_type { 'Rapid' } data_type { 'basecalls and raw data' } - association(:owner, factory: :request_traction_grid_ion) + owner factory: %i[request_traction_grid_ion] end # Automatically generated request types @@ -31,7 +31,7 @@ fragment_size_required_from { 1 } fragment_size_required_to { 21 } read_length { 76 } - association(:owner, factory: :sequencing_request) + owner factory: %i[sequencing_request] end # HiSeq sequencing @@ -103,12 +103,12 @@ factory :request_metadata_for_gbs, class: 'IlluminaHtp::Requests::GbsRequest::Metadata' do primer_panel_name { create(:primer_panel).name } - association(:owner, factory: :gbs_request) + owner factory: %i[gbs_request] end factory :request_metadata_for_heron, class: 'IlluminaHtp::Requests::HeronRequest::Metadata' do primer_panel_name { create(:primer_panel).name } - association(:owner, factory: :heron_request) + owner factory: %i[heron_request] end end @@ -118,7 +118,7 @@ end # set default metadata factories to every request types which have been defined yet - RequestType.all.each do |rt| + RequestType.find_each do |rt| factory_name = :"request_metadata_for_#{rt.name.downcase.gsub(/[^a-z]+/, '_')}" next if FactoryBot.factories.registered?(factory_name) diff --git a/spec/factories/request_type_factories.rb b/spec/factories/request_type_factories.rb index 75586fa9a8..2671e18564 100644 --- a/spec/factories/request_type_factories.rb +++ b/spec/factories/request_type_factories.rb @@ -60,7 +60,7 @@ request_class { Request::Multiplexing } billable { false } for_multiplexing { true } - association(:target_purpose, factory: :tube_purpose) + target_purpose factory: %i[tube_purpose] end end @@ -182,12 +182,12 @@ factory :sequencing_request_type_validator do default { 54 } - association(:request_type, factory: :sequencing_request_type) + request_type factory: %i[sequencing_request_type] end factory :library_request_type_validator, class: 'RequestType::Validator' do request_option { 'library_type' } - association(:request_type, factory: :library_creation_request_type) + request_type factory: %i[library_creation_request_type] valid_options { |rtva| RequestType::Validator::LibraryTypeValidator.new(rtva.request_type.id) } end diff --git a/spec/factories/sample_manifest_excel/sample_manifest_assets.rb b/spec/factories/sample_manifest_excel/sample_manifest_assets.rb index 7807705d4f..5a53b72f0a 100644 --- a/spec/factories/sample_manifest_excel/sample_manifest_assets.rb +++ b/spec/factories/sample_manifest_excel/sample_manifest_assets.rb @@ -4,7 +4,7 @@ factory :sample_manifest_asset do sanger_sample_id sample_manifest - association(:asset, factory: :receptacle) + asset factory: %i[receptacle] after(:build) do |sma| sma.sample_manifest.labware = [sma.asset.labware] if sma.sample_manifest && diff --git a/spec/factories/samples.rb b/spec/factories/samples.rb index cdf4bfe3f8..128023bbab 100644 --- a/spec/factories/samples.rb +++ b/spec/factories/samples.rb @@ -11,7 +11,7 @@ end factory :sample_with_gender do - association :sample_metadata, factory: :sample_metadata_with_gender + sample_metadata factory: %i[sample_metadata_with_gender] end factory :sample_with_sanger_sample_id do @@ -20,7 +20,7 @@ end factory :accessioned_sample do - association :sample_metadata, factory: :sample_metadata_with_accession_number + sample_metadata factory: %i[sample_metadata_with_accession_number] end end diff --git a/spec/factories/shared_traits.rb b/spec/factories/shared_traits.rb index 0a313baa91..7ef04b736b 100644 --- a/spec/factories/shared_traits.rb +++ b/spec/factories/shared_traits.rb @@ -18,7 +18,7 @@ end factory :uuid do - association(:resource, factory: :labware) + resource factory: %i[labware] external_id { SecureRandom.uuid } end diff --git a/spec/factories/tag2_layout_factories.rb b/spec/factories/tag2_layout_factories.rb index 5277b607f2..4a11d2a6fd 100644 --- a/spec/factories/tag2_layout_factories.rb +++ b/spec/factories/tag2_layout_factories.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :tag2_layout do - association(:plate, factory: :plate_with_untagged_wells) + plate factory: %i[plate_with_untagged_wells] tag user end diff --git a/spec/factories/tasks.rb b/spec/factories/tasks.rb index e5b17966b2..42cac9d057 100644 --- a/spec/factories/tasks.rb +++ b/spec/factories/tasks.rb @@ -3,7 +3,7 @@ FactoryBot.define do factory :task do name { 'New task' } - association(:workflow, factory: :lab_workflow) + workflow factory: %i[lab_workflow] sorted { nil } batched { nil } location { '' } @@ -12,7 +12,7 @@ factory :plate_template_task do name { 'Select Plate Template' } - association(:workflow, factory: :cherrypick_pipeline_workflow) + workflow factory: %i[cherrypick_pipeline_workflow] sorted { 1 } batched { true } lab_activity { true } @@ -23,7 +23,7 @@ factory :fluidigm_template_task do name { 'Select Plate Template' } - association(:workflow, factory: :fluidigm_pipeline_workflow) + workflow factory: %i[fluidigm_pipeline_workflow] sorted { 1 } batched { true } lab_activity { true } diff --git a/spec/factories/transfer_requests.rb b/spec/factories/transfer_requests.rb index 53d606a73c..405a90ced6 100644 --- a/spec/factories/transfer_requests.rb +++ b/spec/factories/transfer_requests.rb @@ -2,11 +2,11 @@ FactoryBot.define do factory :transfer_request do - association(:asset, factory: :well) - association(:target_asset, factory: :well) + asset factory: %i[well] + target_asset factory: %i[well] factory :transfer_request_with_submission do - association(:submission, factory: :submission) + submission factory: %i[submission] factory :transfer_request_with_volume do volume { 10 } diff --git a/spec/factories/tube_factories.rb b/spec/factories/tube_factories.rb index cd24a38fe6..5f65aa982e 100644 --- a/spec/factories/tube_factories.rb +++ b/spec/factories/tube_factories.rb @@ -28,18 +28,18 @@ factory :tube, traits: [:tube_barcode] do name { generate :asset_name } - association(:purpose, factory: :tube_purpose) + purpose factory: %i[tube_purpose] end factory :unbarcoded_tube, class: 'Tube' do name { generate :asset_name } - association(:purpose, factory: :tube_purpose) + purpose factory: %i[tube_purpose] end factory :empty_sample_tube, class: 'SampleTube', traits: [:tube_barcode] do name { generate :asset_name } qc_state { '' } - association(:purpose, factory: :sample_tube_purpose) # { Tube::Purpose.standard_sample_tube } + purpose factory: %i[sample_tube_purpose] # { Tube::Purpose.standard_sample_tube } end factory :sample_tube, parent: :empty_sample_tube do @@ -79,7 +79,7 @@ end name { generate :asset_name } - association(:purpose, factory: :mx_tube_purpose) + purpose factory: %i[mx_tube_purpose] after(:build) do |tube, evaluator| unless evaluator.sample_count.zero? tube.aliquots = build_list(:library_aliquot, evaluator.sample_count, study: evaluator.study) @@ -97,13 +97,13 @@ purpose { Tube::Purpose.stock_mx_tube } factory :new_stock_multiplexed_library_tube do |_t| - association(:purpose, factory: :new_stock_tube_purpose) + purpose factory: %i[new_stock_tube_purpose] end end factory(:empty_library_tube, traits: [:tube_barcode], class: 'LibraryTube') do name { generate :asset_name } - association(:purpose, factory: :library_tube_purpose) # { Tube::Purpose.standard_library_tube } + purpose factory: %i[library_tube_purpose] # { Tube::Purpose.standard_library_tube } transient do sample_count { 0 } diff --git a/spec/factories/well_factories.rb b/spec/factories/well_factories.rb index 0755f0f087..3f6f400556 100644 --- a/spec/factories/well_factories.rb +++ b/spec/factories/well_factories.rb @@ -66,8 +66,8 @@ end factory :well_link, class: 'Well::Link' do - association(:source_well, factory: :well) - association(:target_well, factory: :well) + source_well factory: %i[well] + target_well factory: %i[well] type { 'stock' } factory :stock_well_link diff --git a/spec/factories/z_tag_qc_factories.rb b/spec/factories/z_tag_qc_factories.rb index f7203fe01d..7f93eb31a2 100644 --- a/spec/factories/z_tag_qc_factories.rb +++ b/spec/factories/z_tag_qc_factories.rb @@ -36,18 +36,18 @@ factory :lot do sequence(:lot_number) { |n| "lot#{n}" } lot_type - association(:template, factory: :plate_template_with_well) + template factory: %i[plate_template_with_well] user received_at { '2014-02-01' } factory :tag2_lot do - association(:lot_type, factory: :tag2_lot_type) - association(:template, factory: :tag2_layout_template) + lot_type factory: %i[tag2_lot_type] + template factory: %i[tag2_layout_template] end factory :tag_layout_lot do - association(:lot_type, factory: :tag_layout_lot_type) - association(:template, factory: :tag_layout_template) + lot_type factory: %i[tag_layout_lot_type] + template factory: %i[tag_layout_template] end end diff --git a/spec/features/admin/changing_user_roles_spec.rb b/spec/features/admin/changing_user_roles_spec.rb index eb9ee9f621..61396f5b63 100644 --- a/spec/features/admin/changing_user_roles_spec.rb +++ b/spec/features/admin/changing_user_roles_spec.rb @@ -37,7 +37,7 @@ expect(test_user.roles.pluck(:name)).to eq(['lab_manager']) end - it 'assign a study role', js: true do + it 'assign a study role', :js do within('div#study_role') do select('manager', from: 'Study role') select('Study Name', from: 'for Study') @@ -46,7 +46,7 @@ expect(page).to have_content 'Manager' end - it 'assign a project role', js: true do + it 'assign a project role', :js do within('div#project_role') do select('manager', from: 'Project role') select('Project Name', from: 'for Project') diff --git a/spec/features/asset_information_spec.rb b/spec/features/asset_information_spec.rb index 4a1a86656d..68022bf69f 100644 --- a/spec/features/asset_information_spec.rb +++ b/spec/features/asset_information_spec.rb @@ -12,8 +12,8 @@ let(:user) { create :user } before do - expect(Labware).to receive(:find_by).with(id: '1').and_return(labware) # rubocop:todo RSpec/ExpectInHook - expect(Receptacle).to receive(:find_by).with(id: '1').and_return(receptacle) # rubocop:todo RSpec/ExpectInHook + expect(Labware).to receive(:find_by).with(id: '1').and_return(labware) + expect(Receptacle).to receive(:find_by).with(id: '1').and_return(receptacle) login_user user visit asset_path(id: 1) end diff --git a/spec/features/assets/asset_submission_spec.rb b/spec/features/assets/asset_submission_spec.rb index e8e145b695..ba5bfd1352 100644 --- a/spec/features/assets/asset_submission_spec.rb +++ b/spec/features/assets/asset_submission_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Asset submission', js: true do +describe 'Asset submission', :js do let(:project) { create :project } let(:study) { create :study } let(:request_factory) { :sequencing_request } diff --git a/spec/features/assets/show_plate_spec.rb b/spec/features/assets/show_plate_spec.rb index 0eb3dac89f..42d59aa867 100644 --- a/spec/features/assets/show_plate_spec.rb +++ b/spec/features/assets/show_plate_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Show plate', js: true do +describe 'Show plate', :js do let(:plate) { create :plate, well_count: 3 } let(:user) { create :user } diff --git a/spec/features/assets/upload_and_retrieve_qc_file_spec.rb b/spec/features/assets/upload_and_retrieve_qc_file_spec.rb index a2427d6fc5..b92884b791 100644 --- a/spec/features/assets/upload_and_retrieve_qc_file_spec.rb +++ b/spec/features/assets/upload_and_retrieve_qc_file_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'pry' -describe 'Asset submission', js: true do +describe 'Asset submission', :js do let(:plate) { create :plate } let(:user) { create :user } diff --git a/spec/features/batches/failing_requests_spec.rb b/spec/features/batches/failing_requests_spec.rb index 0c02049991..135d1cabdf 100644 --- a/spec/features/batches/failing_requests_spec.rb +++ b/spec/features/batches/failing_requests_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'pry' -describe 'Batches controller', js: true do +describe 'Batches controller', :js do let(:request_count) { 3 } let(:batch) do create :cherrypick_batch, diff --git a/spec/features/batches/sort_requests_spec.rb b/spec/features/batches/sort_requests_spec.rb index 01fc88eafe..94fd73b0b2 100644 --- a/spec/features/batches/sort_requests_spec.rb +++ b/spec/features/batches/sort_requests_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'pry' -describe 'Batches controller', js: true, warren: true do +describe 'Batches controller', :js, :warren do let(:request_count) { 3 } let(:batch) { create :sequencing_batch, request_count: request_count, created_at: 1.day.ago, updated_at: 1.day.ago } let(:user) { create :admin } diff --git a/spec/features/generate_a_bulk_submission_template_spec.rb b/spec/features/generate_a_bulk_submission_template_spec.rb index fc26bf998a..2c0f55be1d 100644 --- a/spec/features/generate_a_bulk_submission_template_spec.rb +++ b/spec/features/generate_a_bulk_submission_template_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Generate a bulk submission spreadsheet', bulk_submission_excel: true, js: true do +describe 'Generate a bulk submission spreadsheet', :bulk_submission_excel, :js do let!(:user) { create :user } let!(:plate) { create(:plate_with_untagged_wells, well_count: 30) } diff --git a/spec/features/lab_view_spec.rb b/spec/features/lab_view_spec.rb index 44dd99aa42..b2a2c5fb93 100644 --- a/spec/features/lab_view_spec.rb +++ b/spec/features/lab_view_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Lab view', js: true do +describe 'Lab view', :js do let(:user) { create :user, email: 'login@example.com' } let(:library_tube) { create :library_tube } diff --git a/spec/features/labware/looking_up_labware_history_spec.rb b/spec/features/labware/looking_up_labware_history_spec.rb index 540ee44029..45b4388472 100644 --- a/spec/features/labware/looking_up_labware_history_spec.rb +++ b/spec/features/labware/looking_up_labware_history_spec.rb @@ -15,7 +15,7 @@ } end - it 'displays asset audits', js: true do + it 'displays asset audits', :js do login_user(user) visit labware_path(tube) click_link 'Event history' diff --git a/spec/features/labwhere_reception_spec.rb b/spec/features/labwhere_reception_spec.rb index 72b100492f..97811a70c6 100644 --- a/spec/features/labwhere_reception_spec.rb +++ b/spec/features/labwhere_reception_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Labwhere reception', js: true do +describe 'Labwhere reception', :js do let(:user) { create :user, email: 'login@example.com', swipecard_code: 12_345 } let(:plate) { create :plate } diff --git a/spec/features/perform_a_tag_substitution_spec.rb b/spec/features/perform_a_tag_substitution_spec.rb index 2d96b796b5..d07ed0654a 100644 --- a/spec/features/perform_a_tag_substitution_spec.rb +++ b/spec/features/perform_a_tag_substitution_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Perform a tag substitution', js: true do +describe 'Perform a tag substitution', :js do let(:sample_a) { create :sample } let(:sample_b) { create :sample } let(:library_tube_a) { create :library_tube } diff --git a/spec/features/pipelines/cherrypick/cherrypick_for_fluidigm_pipeline_micro_litre_spec.rb b/spec/features/pipelines/cherrypick/cherrypick_for_fluidigm_pipeline_micro_litre_spec.rb index 87d7e842e4..ae49231bd2 100644 --- a/spec/features/pipelines/cherrypick/cherrypick_for_fluidigm_pipeline_micro_litre_spec.rb +++ b/spec/features/pipelines/cherrypick/cherrypick_for_fluidigm_pipeline_micro_litre_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'pry' -describe 'cherrypick for fluidigm pipeline - micro litre', js: true do +describe 'cherrypick for fluidigm pipeline - micro litre', :js do let(:user) { create :admin } let(:project) { create :project, name: 'Test project' } let(:study) { create :study } diff --git a/spec/features/pipelines/cherrypick/cherrypick_pipeline_spec.rb b/spec/features/pipelines/cherrypick/cherrypick_pipeline_spec.rb index 7eb9ee1526..90cc5aaffc 100644 --- a/spec/features/pipelines/cherrypick/cherrypick_pipeline_spec.rb +++ b/spec/features/pipelines/cherrypick/cherrypick_pipeline_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require './spec/features/shared_examples/cherrypicking' -describe 'Cherrypicking pipeline', cherrypicking: true, js: true do +describe 'Cherrypicking pipeline', :cherrypicking, :js do include BarcodeHelper let(:swipecard_code) { '123456' } @@ -408,7 +408,7 @@ def initialize_plates(plates) end end - describe 'where there is a control plate and multiple destinations', js: true do + describe 'where there is a control plate and multiple destinations', :js do let(:plate1) { create :plate_with_untagged_wells, sample_count: 50 } let(:plate2) { create :plate_with_untagged_wells, sample_count: 50 } let(:control_plate) { create :control_plate, sample_count: 2 } diff --git a/spec/features/pipelines/creating_an_empty_batch_spec.rb b/spec/features/pipelines/creating_an_empty_batch_spec.rb index b205a95e05..d240403589 100644 --- a/spec/features/pipelines/creating_an_empty_batch_spec.rb +++ b/spec/features/pipelines/creating_an_empty_batch_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Empty batch creation', js: true do +describe 'Empty batch creation', :js do let(:user) { create :user } let(:pipeline) { create :cherrypick_pipeline } let(:pipeline_name) { pipeline.name } diff --git a/spec/features/pipelines/sequencing/following_a_sequencing_pipeline_spec.rb b/spec/features/pipelines/sequencing/following_a_sequencing_pipeline_spec.rb index b776e6628f..26383ba494 100644 --- a/spec/features/pipelines/sequencing/following_a_sequencing_pipeline_spec.rb +++ b/spec/features/pipelines/sequencing/following_a_sequencing_pipeline_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require './spec/features/shared_examples/sequencing' -RSpec.describe 'Following a Sequencing Pipeline', js: true do +RSpec.describe 'Following a Sequencing Pipeline', :js do let(:user) { create :user } let(:pipeline) { create(:sequencing_pipeline, :with_workflow) } @@ -51,7 +51,7 @@ ] end - it 'can be processed', warren: true do + it 'can be processed', :warren do login_user(user) visit pipeline_path(pipeline) within('#available-requests') { all('input[type=checkbox]', count: 2).each(&:check) } @@ -145,7 +145,7 @@ end end - it 'descriptors can be edited', warren: true do + it 'descriptors can be edited', :warren do Warren.handler.clear_messages login_user(user) @@ -182,7 +182,7 @@ expect(Batch.last.updated_at).to be_today end - it 'multiple descriptors can be edited', warren: true do + it 'multiple descriptors can be edited', :warren do Warren.handler.clear_messages login_user(user) @@ -221,7 +221,7 @@ expect(Batch.last.updated_at).to be_today end - it 'spiked PhiX can be edited', warren: true do + it 'spiked PhiX can be edited', :warren do Warren.handler.clear_messages login_user(user) diff --git a/spec/features/pipelines/sequencing/following_a_sequencing_pipeline_with_compound_sample_creation_spec.rb b/spec/features/pipelines/sequencing/following_a_sequencing_pipeline_with_compound_sample_creation_spec.rb index 50ff41a816..3a6facd24b 100644 --- a/spec/features/pipelines/sequencing/following_a_sequencing_pipeline_with_compound_sample_creation_spec.rb +++ b/spec/features/pipelines/sequencing/following_a_sequencing_pipeline_with_compound_sample_creation_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require './spec/features/shared_examples/sequencing' -RSpec.describe 'Following a Sequencing Pipeline', js: true do +RSpec.describe 'Following a Sequencing Pipeline', :js do let(:user) { create :user } let(:study1) { create :study } let(:project1) { create :project } diff --git a/spec/features/pipelines/viewing_request_comments_spec.rb b/spec/features/pipelines/viewing_request_comments_spec.rb index 1c7b825912..5f6dc0fe6e 100644 --- a/spec/features/pipelines/viewing_request_comments_spec.rb +++ b/spec/features/pipelines/viewing_request_comments_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Viewing request comments', js: true do +describe 'Viewing request comments', :js do let(:user) { create :user } let(:pipeline) { create :sequencing_pipeline } let(:pipeline_name) { pipeline.name } diff --git a/spec/features/plate_qc_display_spec.rb b/spec/features/plate_qc_display_spec.rb index 90e74585e5..7b2c84e2b7 100644 --- a/spec/features/plate_qc_display_spec.rb +++ b/spec/features/plate_qc_display_spec.rb @@ -13,14 +13,14 @@ visit plate_path(plate) %w[concentration volume quantity_in_nano_grams loci_passed rin].each do |qc_result| within("##{qc_result}") do - expect(page).to have_selector('td', count: 126) - expect(page).to have_selector('tr', count: 10) - expect(page).to have_selector('th[2]', text: '1') - expect(page).to have_selector('th[13]', text: '12') - expect(page).to have_selector('tr[1]/td[1]', text: 'A') - expect(page).to have_selector('tr[8]/td[14]', text: 'H') - expect(page).to have_selector('tr[9]/td[2]', text: '1') - expect(page).to have_selector('tr[9]/td[13]', text: '12') + expect(page).to have_css('td', count: 126) + expect(page).to have_css('tr', count: 10) + expect(page).to have_css('th[2]', text: '1') + expect(page).to have_css('th[13]', text: '12') + expect(page).to have_css('tr[1]/td[1]', text: 'A') + expect(page).to have_css('tr[8]/td[14]', text: 'H') + expect(page).to have_css('tr[9]/td[2]', text: '1') + expect(page).to have_css('tr[9]/td[13]', text: '12') end end end diff --git a/spec/features/pooling_spec.rb b/spec/features/pooling_spec.rb index d2177fff6b..3b59d8bad4 100644 --- a/spec/features/pooling_spec.rb +++ b/spec/features/pooling_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Pooling', js: true, poolings: true do +describe 'Pooling', :js, :poolings do let(:user) { create :user, email: 'login@example.com' } describe 'from page directly' do diff --git a/spec/features/sample_logistics/lab/stock_stamping_spec.rb b/spec/features/sample_logistics/lab/stock_stamping_spec.rb index 52c5d226df..e0d6fdfa40 100644 --- a/spec/features/sample_logistics/lab/stock_stamping_spec.rb +++ b/spec/features/sample_logistics/lab/stock_stamping_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'stamping of stock', js: true do +describe 'stamping of stock', :js do let(:user) { create :admin, barcode: 'ID41440E', swipecard_code: '1234567' } let(:plate) { create :plate_with_3_wells } let!(:barcode_printer) { create :barcode_printer } diff --git a/spec/features/sample_manifests/create_manifest_spec.rb b/spec/features/sample_manifests/create_manifest_spec.rb index 39142d4ddf..92e168706b 100644 --- a/spec/features/sample_manifests/create_manifest_spec.rb +++ b/spec/features/sample_manifests/create_manifest_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'SampleManifest controller', sample_manifest: true do +describe 'SampleManifest controller', :sample_manifest do def load_manifest_spec SampleManifestExcel.configure do |config| config.folder = File.join('spec', 'data', 'sample_manifest_excel') @@ -24,8 +24,8 @@ def load_manifest_spec select(study.name, from: 'Study') select(supplier.name, from: 'Supplier') within('#sample_manifest_template') do - expect(page).to have_selector('option', count: 7) - expect(page).not_to have_selector('option', text: 'Default Tube') + expect(page).to have_css('option', count: 7) + expect(page).not_to have_css('option', text: 'Default Tube') end select('Default Plate', from: 'Template') select(printer.name, from: 'Barcode printer') @@ -66,7 +66,7 @@ def load_manifest_spec it 'indicate the purpose field is used for plates only' do visit(new_sample_manifest_path) - within('#sample_manifest_template') { expect(page).to have_selector('option', count: 22) } + within('#sample_manifest_template') { expect(page).to have_css('option', count: 22) } select(created_purpose.name, from: 'Purpose') expect(page).to have_text('Used for plate manifests only') end @@ -81,8 +81,8 @@ def load_manifest_spec select(study.name, from: 'Study') select(supplier.name, from: 'Supplier') within('#sample_manifest_template') do - expect(page).to have_selector('option', count: 2) - expect(page).to have_selector('option', text: 'Default Tube Rack') + expect(page).to have_css('option', count: 2) + expect(page).to have_css('option', text: 'Default Tube Rack') end select('Default Tube Rack', from: 'Template') expect(page).not_to have_text('Barcodes') @@ -90,8 +90,8 @@ def load_manifest_spec select(selected_purpose.name, from: 'Tube purpose') if selected_purpose expect(page).to have_text('Tube rack purpose') within('#sample_manifest_tube_rack_purpose_input') do - expect(page).to have_selector('option', count: 2) - expect(page).to have_selector('option', text: selected_tube_rack_purpose.name) + expect(page).to have_css('option', count: 2) + expect(page).to have_css('option', text: selected_tube_rack_purpose.name) end select(selected_tube_rack_purpose.name, from: 'Tube rack purpose') if selected_tube_rack_purpose click_button('Create manifest') diff --git a/spec/features/sample_manifests/track_sample_manifest_updates_spec.rb b/spec/features/sample_manifests/track_sample_manifest_updates_spec.rb index bd0791b990..cdd5fd21ce 100644 --- a/spec/features/sample_manifests/track_sample_manifest_updates_spec.rb +++ b/spec/features/sample_manifests/track_sample_manifest_updates_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'timecop' -describe 'track SampleManifest updates', sample_manifest: true do +describe 'track SampleManifest updates', :sample_manifest do include FetchTable def load_manifest_spec @@ -20,9 +20,8 @@ def load_manifest_spec let!(:supplier) { create :supplier } let!(:study) { create :study } - around { |example| travel_to(Time.zone.local(2010, 7, 12, 10, 25, 0)) { example.run } } - before do + travel_to(Time.zone.local(2010, 7, 12, 10, 25, 0)) login_user user load_manifest_spec visit(study_path(study)) diff --git a/spec/features/sample_manifests/uploader_for_manifests_with_tag_sequences_spec.rb b/spec/features/sample_manifests/uploader_for_manifests_with_tag_sequences_spec.rb index f323b0e5ec..9e21150201 100644 --- a/spec/features/sample_manifests/uploader_for_manifests_with_tag_sequences_spec.rb +++ b/spec/features/sample_manifests/uploader_for_manifests_with_tag_sequences_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Sample manifest with tag sequences', sample_manifest: true do +describe 'Sample manifest with tag sequences', :sample_manifest do before(:all) do SampleManifestExcel.configure do |config| config.folder = File.join('spec', 'data', 'sample_manifest_excel') diff --git a/spec/features/shared_examples/cherrypicking.rb b/spec/features/shared_examples/cherrypicking.rb index 02479f07b7..5ebe7d0405 100644 --- a/spec/features/shared_examples/cherrypicking.rb +++ b/spec/features/shared_examples/cherrypicking.rb @@ -69,9 +69,9 @@ expect(page).to have_content('Batch released!') expected_input_count = plates.count expected_input_count += 1 if control_plate - within('#input_assets table tbody') { expect(page).to have_selector('tr', count: expected_input_count) } + within('#input_assets table tbody') { expect(page).to have_css('tr', count: expected_input_count) } within('#output_assets table tbody') do - expect(page).to have_selector('tr', count: expected_plates_by_destination_plate.size) + expect(page).to have_css('tr', count: expected_plates_by_destination_plate.size) end end end @@ -233,7 +233,11 @@ def get_machine_barcode_for_bed(bedcode) end step "Download pick file for destination plate #{destination_barcode} pick number #{pick_number_index}" do - expect(page).to have_content("Download #{robot.name.capitalize} File Step 3 of 3") + Capybara.using_wait_time(5) do + # This requires more time to perform the check between runs. + # Throws a JS error if not waiting enough + expect(page).to have_content("Download #{robot.name.capitalize} File Step 3 of 3") + end click_link("Download #{robot.name} File") diff --git a/spec/features/shared_examples/sequencing.rb b/spec/features/shared_examples/sequencing.rb index a7e4989f14..3e53228444 100644 --- a/spec/features/shared_examples/sequencing.rb +++ b/spec/features/shared_examples/sequencing.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true shared_examples 'a sequencing procedure' do - it 'can be processed', warren: true do + it 'can be processed', :warren do login_user(user) visit pipeline_path(pipeline) within('#available-requests') { all('input[type=checkbox]', count: 2).each(&:check) } diff --git a/spec/features/studies/change_study_roles_spec.rb b/spec/features/studies/change_study_roles_spec.rb index b458df5d6d..495434151a 100644 --- a/spec/features/studies/change_study_roles_spec.rb +++ b/spec/features/studies/change_study_roles_spec.rb @@ -7,7 +7,7 @@ let!(:study) { create :study_with_manager, updated_at: 1.year.ago } let(:manager) { study.managers.first } - it 'can be removed', js: true do + it 'can be removed', :js do # We had an issue where the timestamp was not updating on study # https://github.com/sanger/sequencescape/issues/2942 # which was user list to not be updated in the UWH diff --git a/spec/features/studies/create_study_spec.rb b/spec/features/studies/create_study_spec.rb index 548042899c..4500a0bc25 100644 --- a/spec/features/studies/create_study_spec.rb +++ b/spec/features/studies/create_study_spec.rb @@ -58,7 +58,7 @@ expect(page).to have_content "Study description can't be blank" end - it 'create managed study', js: true do + it 'create managed study', :js do login_user user visit root_path click_link 'Create Study' @@ -69,7 +69,7 @@ expect(page).not_to have_content "Study metadata HuMFre approval number can't be blank" end - it 'create open study', js: true do + it 'create open study', :js do login_user user visit new_study_path expect(page).to have_content('Study Create') diff --git a/spec/features/studies/edit_study_spec.rb b/spec/features/studies/edit_study_spec.rb index 593a28d663..89f7649b3a 100644 --- a/spec/features/studies/edit_study_spec.rb +++ b/spec/features/studies/edit_study_spec.rb @@ -6,7 +6,7 @@ let(:user) { create :admin } let!(:study) { create :study } - it 'edit open study', js: true do + it 'edit open study', :js do study.study_metadata.bam = false study.save login_user(user) @@ -22,7 +22,7 @@ expect(page).to have_content('Alignments in BAM: true') end - it 'add external customer information', js: true do + it 'add external customer information', :js do login_user(user) visit study_path(study) click_link 'Edit' @@ -38,7 +38,7 @@ context 'when data release strategy is Not Applicable' do let!(:study) { create :not_app_study } - it 'does not error when setting strategy to Open', js: true do + it 'does not error when setting strategy to Open', :js do study.study_metadata.data_release_strategy = 'not applicable' study.save login_user(user) diff --git a/spec/features/studies/manage_study_spec.rb b/spec/features/studies/manage_study_spec.rb index e56a8e8d0b..c5f242150a 100644 --- a/spec/features/studies/manage_study_spec.rb +++ b/spec/features/studies/manage_study_spec.rb @@ -6,7 +6,7 @@ let(:user) { create :admin } let!(:study) { create :study, name: 'Original name' } - it 'Rename a study', js: true do + it 'Rename a study', :js do login_user(user) visit study_path(study) click_link 'Manage' diff --git a/spec/features/studies/qc_reports_spec.rb b/spec/features/studies/qc_reports_spec.rb index 992881a8f1..b132ba7cf2 100644 --- a/spec/features/studies/qc_reports_spec.rb +++ b/spec/features/studies/qc_reports_spec.rb @@ -25,6 +25,6 @@ plate_purpose_names.each { |plate_purpose| select(plate_purpose, from: 'Plate purpose') } end click_button('Create report') - expect(QcReport.first.plate_purposes & plate_purpose_names).to contain_exactly(*plate_purpose_names) + expect(QcReport.first.plate_purposes & plate_purpose_names).to match_array(plate_purpose_names) end end diff --git a/spec/features/studies/view_study_properties_spec.rb b/spec/features/studies/view_study_properties_spec.rb index 41a40443bf..24699959f0 100644 --- a/spec/features/studies/view_study_properties_spec.rb +++ b/spec/features/studies/view_study_properties_spec.rb @@ -7,7 +7,7 @@ let(:prelim_id) { 'A1234' } let(:study) { create(:study, study_metadata: create(:study_metadata, prelim_id: prelim_id)) } - it 'view open study properties', js: true do + it 'view open study properties', :js do login_user(user) visit study_path(study) click_link 'Study details' diff --git a/spec/features/studies/view_study_request_links_spec.rb b/spec/features/studies/view_study_request_links_spec.rb index 2b894b3d55..764090be4e 100644 --- a/spec/features/studies/view_study_request_links_spec.rb +++ b/spec/features/studies/view_study_request_links_spec.rb @@ -36,12 +36,12 @@ visit study_path(study) end - it 'No links to absent requests', js: true do + it 'No links to absent requests', :js do click_link sequencing_request_type.name expect(page).not_to have_link(title: "#{library_tube.human_barcode} started") end - it 'Single requests link directly to the request', js: true do + it 'Single requests link directly to the request', :js do click_link sequencing_request_type.name expect(page).to have_link('1', title: "#{library_tube.human_barcode} passed") click_link('1', title: "#{library_tube.human_barcode} passed") @@ -49,14 +49,14 @@ expect(page).to have_text(sequencing_request_type.name) end - it 'Multiple requests link to the summary', js: true do + it 'Multiple requests link to the summary', :js do click_link sequencing_request_type.name expect(page).to have_link('2', title: "#{library_tube.human_barcode} failed") click_link('2', title: "#{library_tube.human_barcode} failed") expect(page).to have_text("#{sequencing_request_type.name} Study 3871492") end - it 'Filtering by asset type', js: true do + it 'Filtering by asset type', :js do click_link 'Assets progress' within '#summary' do expect(page).to have_text sample_tube.name diff --git a/spec/features/tag_layout_template_spec.rb b/spec/features/tag_layout_template_spec.rb index 459a42996c..5dd6411f53 100644 --- a/spec/features/tag_layout_template_spec.rb +++ b/spec/features/tag_layout_template_spec.rb @@ -12,7 +12,7 @@ tag_group_2 end - it 'create a new layout template from a tag group', js: true do + it 'create a new layout template from a tag group', :js do login_user user visit tag_group_path(tag_group_1) expect(page).to have_content 'Test tag group 1' @@ -32,7 +32,7 @@ expect(page).to have_content 'To tag layout templates list' end - it 'create a new layout template directly', js: true do + it 'create a new layout template directly', :js do login_user user visit new_tag_layout_template_path expect(page).to have_content 'Tag Layout Template New' @@ -52,7 +52,7 @@ expect(page).to have_content 'To tag layout templates list' end - it 'get an error when creating a new layout template', js: true do + it 'get an error when creating a new layout template', :js do login_user user visit new_tag_layout_template_path expect(page).to have_content 'Tag Layout Template New' diff --git a/spec/helpers/deprecation_helper_spec.rb b/spec/helpers/deprecation_helper_spec.rb index 77081b1aa5..f563ba48c1 100644 --- a/spec/helpers/deprecation_helper_spec.rb +++ b/spec/helpers/deprecation_helper_spec.rb @@ -8,7 +8,7 @@ include FontawesomeHelper describe '#deprecate_section' do - subject(:returned_html) { deprecate_section(params) { '

      Deprecated content

      ' } } + subject(:returned_html) { deprecate_section(**params) { '

      Deprecated content

      ' } } context 'with only a message' do let(:params) { { message: 'This is old' } } diff --git a/spec/heron/factories/concerns/contents_spec.rb b/spec/heron/factories/concerns/contents_spec.rb index 875d8bfbcb..ca09e482c4 100644 --- a/spec/heron/factories/concerns/contents_spec.rb +++ b/spec/heron/factories/concerns/contents_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Heron::Factories::Concerns::Contents, heron: true, lighthouse: true, type: :model do +RSpec.describe Heron::Factories::Concerns::Contents, :heron, :lighthouse, type: :model do require 'rspec/mocks/standalone' let(:factory_klass) do Class.new do @@ -20,7 +20,7 @@ def self.model_name end def content_factory - ::Heron::Factories::Sample + Heron::Factories::Sample end def recipients_key @@ -49,7 +49,7 @@ def recipients_key it 'is not valid' do factory = factory_klass.new(params) - expect(factory).to be_invalid + expect(factory).not_to be_valid end it 'gets an error message about it for each wrong location' do @@ -71,7 +71,7 @@ def recipients_key it 'is not valid' do factory = factory_klass.new(params) - expect(factory).to be_invalid + expect(factory).not_to be_valid end context 'when supplying the study_uuid' do @@ -113,15 +113,14 @@ def recipients_key it 'is not valid' do factory = factory_klass.new(params) - expect(factory).to be_invalid + expect(factory).not_to be_valid end it 'gets an error message about it for each wrong sample' do expect(factory_klass.new(params).tap(&:validate).errors.full_messages.uniq).to eq( [ - 'Content b1, pos: 1 Phenotype No other params can be added when sample uuid specified', - "Content c1 Study can't be blank", - 'Content c1 Asdf Unexisting field for sample or sample_metadata' + 'Content b1, pos: 1 ["Phenotype No other params can be added when sample uuid specified"]', + "Content c1 [\"Study can't be blank\", \"Asdf Unexisting field for sample or sample_metadata\"]" ] ) end @@ -234,7 +233,7 @@ def recipients_key context 'with a tube rack' do let(:purpose) { create(:plate_purpose, target_type: 'Plate', name: 'Stock Plate', size: '96') } - let(:tube_rack) { ::TubeRack.create!(size: '96', purpose: purpose) } + let(:tube_rack) { TubeRack.create!(size: '96', purpose: purpose) } let(:plate) { tube_rack } let(:tubes) do %w[A1 B1 C1].map do |coordinate| diff --git a/spec/heron/factories/concerns/eventful_spec.rb b/spec/heron/factories/concerns/eventful_spec.rb index 71b225e33a..06b54f777f 100644 --- a/spec/heron/factories/concerns/eventful_spec.rb +++ b/spec/heron/factories/concerns/eventful_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true require 'rails_helper' -RSpec.describe Heron::Factories::Concerns::Eventful, heron_events: true do +RSpec.describe Heron::Factories::Concerns::Eventful, :heron_events do let(:my_test_class) do Class.new do include ActiveModel::Model diff --git a/spec/heron/factories/event_spec.rb b/spec/heron/factories/event_spec.rb index ee7ef03cec..a2c7bd759e 100644 --- a/spec/heron/factories/event_spec.rb +++ b/spec/heron/factories/event_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Heron::Factories::Event, heron: true, heron_events: true, type: :model do +RSpec.describe Heron::Factories::Event, :heron, :heron_events, type: :model do let(:plate) { create :plate } let(:subjects) do [ diff --git a/spec/heron/factories/plate_from_rack_spec.rb b/spec/heron/factories/plate_from_rack_spec.rb index b9287181e0..8205c5ddd1 100644 --- a/spec/heron/factories/plate_from_rack_spec.rb +++ b/spec/heron/factories/plate_from_rack_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Heron::Factories::PlateFromRack, heron: true, type: :model do +RSpec.describe Heron::Factories::PlateFromRack, :heron, type: :model do let(:purpose) { create(:plate_purpose, target_type: 'Plate', name: 'Stock Plate', size: '96') } let(:rack) { create :tube_rack } let(:plate_factory) { described_class.new(tube_rack: rack, plate_purpose: purpose) } diff --git a/spec/heron/factories/plate_spec.rb b/spec/heron/factories/plate_spec.rb index 3dfdbf0752..a6f8100ff6 100644 --- a/spec/heron/factories/plate_spec.rb +++ b/spec/heron/factories/plate_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Heron::Factories::Plate, heron: true, heron_events: true, lighthouse: true, type: :model do +RSpec.describe Heron::Factories::Plate, :heron, :heron_events, :lighthouse, type: :model do let(:purpose) { create(:plate_purpose, target_type: 'Plate', name: 'Stock Plate', size: '96') } let(:study) { create(:study) } let(:barcode) { '0000000001' } @@ -24,7 +24,7 @@ shared_examples_for 'an invalid parameter' do let(:factory) { described_class.new(params) } it 'is not valid' do - expect(factory).to be_invalid + expect(factory).not_to be_valid end it 'has an error' do @@ -141,15 +141,15 @@ end it 'is invalid' do - expect(plate_factory).to be_invalid + expect(plate_factory).not_to be_valid end it 'stores the error message from samples' do expect(plate_factory.tap(&:validate).errors.full_messages).to eq( [ - 'Content a1 Wrong Unexisting field for sample or sample_metadata', - "Content c1, pos: 0 Study can't be blank", - 'Content c1, pos: 1 Phenotype No other params can be added when sample uuid specified' + 'Content a1 ["Wrong Unexisting field for sample or sample_metadata"]', + "Content c1, pos: 0 [\"Study can't be blank\"]", + 'Content c1, pos: 1 ["Phenotype No other params can be added when sample uuid specified"]' ] ) end diff --git a/spec/heron/factories/sample_spec.rb b/spec/heron/factories/sample_spec.rb index 4d88dd3320..f52fe446d9 100644 --- a/spec/heron/factories/sample_spec.rb +++ b/spec/heron/factories/sample_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Heron::Factories::Sample, heron: true, lighthouse: true, type: :model do +RSpec.describe Heron::Factories::Sample, :heron, :lighthouse, type: :model do let(:study) { create :study } describe '#valid?' do @@ -20,7 +20,7 @@ it 'is not valid' do factory = described_class.new(params) - expect(factory).to be_invalid + expect(factory).not_to be_valid end it 'stores the error message' do @@ -36,7 +36,7 @@ it 'is not valid' do factory = described_class.new(params) - expect(factory).to be_invalid + expect(factory).not_to be_valid end it 'stores the error message' do @@ -63,7 +63,7 @@ it 'is valid' do factory = described_class.new(params) - expect(factory).to be_invalid + expect(factory).not_to be_valid end end end @@ -73,7 +73,7 @@ it 'is invalid' do factory = described_class.new(params) - expect(factory).to be_invalid + expect(factory).not_to be_valid end end end @@ -85,20 +85,18 @@ let(:factory) { described_class.new(study: study, aliquot: { tag_id: tag_id }) } it 'can create an aliquot of the sample in the well' do - expect { factory.create_aliquot_at(well) }.to change(::Aliquot, :count) - .by(1) - .and(change(::Sample, :count).by(1)) + expect { factory.create_aliquot_at(well) }.to change(Aliquot, :count).by(1).and(change(Sample, :count).by(1)) end it 'creates aliquots using the arguments provided' do aliquot = factory.create_aliquot_at(well) - expect(aliquot.class).to eq(::Aliquot) + expect(aliquot.class).to eq(Aliquot) expect(aliquot.tag_id).to eq(tag_id) end it 'registers a stock resource message' do expect { factory.create_aliquot_at(well) }.to change( - ::Messenger.where(root: 'stock_resource', template: 'WellStockResourceIO', target: well), + Messenger.where(root: 'stock_resource', template: 'WellStockResourceIO', target: well), :count ).by(1) end @@ -116,7 +114,7 @@ context 'when the factory is valid' do it 'returns a sample instance' do factory = described_class.new(study: study) - expect(factory.create.class).to eq(::Sample) + expect(factory.create.class).to eq(Sample) end it 'returns the same sample instance in any subsequent call' do @@ -152,7 +150,7 @@ it 'will be invalid if providing any other extra attributes' do factory = described_class.new(study: study, sample_uuid: sample.uuid, sample_id: '1234') - expect(factory).to be_invalid + expect(factory).not_to be_valid end it 'will be valid if providing any other attributes not sample related' do diff --git a/spec/heron/factories/tube_rack_spec.rb b/spec/heron/factories/tube_rack_spec.rb index aa1a5e5571..8ba2fcadd9 100644 --- a/spec/heron/factories/tube_rack_spec.rb +++ b/spec/heron/factories/tube_rack_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Heron::Factories::TubeRack, heron: true, type: :model do +RSpec.describe Heron::Factories::TubeRack, :heron, type: :model do let(:study) { create(:study) } let(:params) do diff --git a/spec/heron/factories/tube_rack_status_spec.rb b/spec/heron/factories/tube_rack_status_spec.rb index e1e2632bb9..8ca3b9b5cd 100644 --- a/spec/heron/factories/tube_rack_status_spec.rb +++ b/spec/heron/factories/tube_rack_status_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Heron::Factories::TubeRackStatus, heron: true, type: :model do +RSpec.describe Heron::Factories::TubeRackStatus, :heron, type: :model do before { create(:study) } let(:params) { { barcode: '0000000001', status: 'validation_failed', messages: ['message 1', 'message 2'] } } diff --git a/spec/heron/factories/tube_spec.rb b/spec/heron/factories/tube_spec.rb index 7721983b9e..b8f55f84d5 100644 --- a/spec/heron/factories/tube_spec.rb +++ b/spec/heron/factories/tube_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Heron::Factories::Tube, heron: true, type: :model do +RSpec.describe Heron::Factories::Tube, :heron, type: :model do let(:params) { { barcode: 'FD00000001' } } it 'is valid with all relevant attributes' do @@ -19,7 +19,7 @@ barcode = 'FD00000001' create(:barcode, barcode: barcode, asset: create(:sample_tube), format: Barcode.matching_barcode_format(barcode)) tube = described_class.new(params) - expect(tube).to be_invalid + expect(tube).not_to be_valid end describe '#create' do diff --git a/spec/lib/accession/accessionable_spec.rb b/spec/lib/accession/accessionable_spec.rb index fa63192b37..75de4fce0d 100644 --- a/spec/lib/accession/accessionable_spec.rb +++ b/spec/lib/accession/accessionable_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Accession::Accessionable, accession: true, type: :model do +RSpec.describe Accession::Accessionable, :accession, type: :model do class Accessionobubble include Accession::Accessionable diff --git a/spec/lib/accession/configuration_spec.rb b/spec/lib/accession/configuration_spec.rb index 6b1fd1f456..aad3d618df 100644 --- a/spec/lib/accession/configuration_spec.rb +++ b/spec/lib/accession/configuration_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Accession::Accessionable, accession: true, type: :model do +RSpec.describe Accession::Accessionable, :accession, type: :model do let(:configuration) { Accession::Configuration.new } it 'is comparable' do diff --git a/spec/lib/accession/contact_spec.rb b/spec/lib/accession/contact_spec.rb index 3314cb2d71..ea8765ff72 100644 --- a/spec/lib/accession/contact_spec.rb +++ b/spec/lib/accession/contact_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Accession::Contact, accession: true, type: :model do +RSpec.describe Accession::Contact, :accession, type: :model do subject { described_class.new(user) } before(:all) do diff --git a/spec/lib/accession/request_spec.rb b/spec/lib/accession/request_spec.rb index 9909e257ce..b81fc984b4 100644 --- a/spec/lib/accession/request_spec.rb +++ b/spec/lib/accession/request_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Accession::Request, accession: true, type: :model do +RSpec.describe Accession::Request, :accession, type: :model do include MockAccession let(:submission) { build(:accession_submission) } diff --git a/spec/lib/accession/response_spec.rb b/spec/lib/accession/response_spec.rb index 9597d74474..f7cfa8fb1e 100644 --- a/spec/lib/accession/response_spec.rb +++ b/spec/lib/accession/response_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Accession::Response, accession: true, type: :model do +RSpec.describe Accession::Response, :accession, type: :model do include MockAccession it 'is successful if the status code is in the correct range' do diff --git a/spec/lib/accession/sample_spec.rb b/spec/lib/accession/sample_spec.rb index f25629f6ca..8872a1d7f8 100644 --- a/spec/lib/accession/sample_spec.rb +++ b/spec/lib/accession/sample_spec.rb @@ -15,7 +15,7 @@ def find_value_at_tag(xml_received, tag_name) end end -RSpec.describe Accession::Sample, accession: true, type: :model do +RSpec.describe Accession::Sample, :accession, type: :model do let(:tag_list) { build(:standard_accession_tag_list) } before { @country = create :insdc_country, name: 'Australia' } diff --git a/spec/lib/accession/service_spec.rb b/spec/lib/accession/service_spec.rb index 7134e30624..7a116eec75 100644 --- a/spec/lib/accession/service_spec.rb +++ b/spec/lib/accession/service_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Accession::Service, accession: true, type: :model do +RSpec.describe Accession::Service, :accession, type: :model do it 'can have a provider' do service = described_class.new('open') expect(service.provider).to eq(:ENA) diff --git a/spec/lib/accession/study_spec.rb b/spec/lib/accession/study_spec.rb index cd85c9e2a4..c1268b040b 100644 --- a/spec/lib/accession/study_spec.rb +++ b/spec/lib/accession/study_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Study, accession: true, type: :model do +RSpec.describe Study, :accession, type: :model do include MockAccession context 'accession all samples in study' do diff --git a/spec/lib/accession/submission_spec.rb b/spec/lib/accession/submission_spec.rb index 3676c6437e..01ac12c4a8 100644 --- a/spec/lib/accession/submission_spec.rb +++ b/spec/lib/accession/submission_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Accession::Submission, accession: true, type: :model do +RSpec.describe Accession::Submission, :accession, type: :model do let!(:user) { create(:user) } let!(:sample) { build(:accession_sample) } diff --git a/spec/lib/accession/tag_list_spec.rb b/spec/lib/accession/tag_list_spec.rb index 81160406ac..0609381b35 100644 --- a/spec/lib/accession/tag_list_spec.rb +++ b/spec/lib/accession/tag_list_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Accession::TagList, accession: true, type: :model do +RSpec.describe Accession::TagList, :accession, type: :model do include Accession::Helpers let(:folder) { File.join('spec', 'data', 'accession') } diff --git a/spec/lib/accession/tag_spec.rb b/spec/lib/accession/tag_spec.rb index 58c2210faa..8af2b9666d 100644 --- a/spec/lib/accession/tag_spec.rb +++ b/spec/lib/accession/tag_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Accession::Tag, accession: true, type: :model do +RSpec.describe Accession::Tag, :accession, type: :model do it 'onlies be valid with a name and groups' do expect(described_class.new(name: :tag_1, groups: :a)).to be_valid expect(described_class.new(name: :tag_1)).not_to be_valid diff --git a/spec/lib/label_printer/sample_manifest_plate_double_spec.rb b/spec/lib/label_printer/sample_manifest_plate_double_spec.rb index f6885777d6..d322b601c3 100644 --- a/spec/lib/label_printer/sample_manifest_plate_double_spec.rb +++ b/spec/lib/label_printer/sample_manifest_plate_double_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe LabelPrinter::Label::SampleManifestPlateDouble, sample_manifest: true do +describe LabelPrinter::Label::SampleManifestPlateDouble, :sample_manifest do subject { described_class.new(label_options) } let(:sample_manifest) { create :pending_plate_sample_manifest } diff --git a/spec/lib/record_loader/barcode_printer_type_loader_spec.rb b/spec/lib/record_loader/barcode_printer_type_loader_spec.rb index a4ad9db8c7..f720ea538f 100644 --- a/spec/lib/record_loader/barcode_printer_type_loader_spec.rb +++ b/spec/lib/record_loader/barcode_printer_type_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/barcode_printer_type_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::BarcodePrinterTypeLoader, loader: true, type: :model do +RSpec.describe RecordLoader::BarcodePrinterTypeLoader, :loader, type: :model do def a_new_record_loader described_class.new(directory: test_directory, files: selected_files) end diff --git a/spec/lib/record_loader/flowcell_type_loader_spec.rb b/spec/lib/record_loader/flowcell_type_loader_spec.rb index cdc81967a9..c5e877f5b3 100644 --- a/spec/lib/record_loader/flowcell_type_loader_spec.rb +++ b/spec/lib/record_loader/flowcell_type_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/flowcell_type_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::FlowcellTypeLoader, loader: true, type: :model do +RSpec.describe RecordLoader::FlowcellTypeLoader, :loader, type: :model do subject(:record_loader) { described_class.new(directory: test_directory, files: selected_files) } # Tests use a separate directory to avoid coupling your specs to the data diff --git a/spec/lib/record_loader/flowcell_type_request_type_loader_spec.rb b/spec/lib/record_loader/flowcell_type_request_type_loader_spec.rb index 03500f12d8..00024a1059 100644 --- a/spec/lib/record_loader/flowcell_type_request_type_loader_spec.rb +++ b/spec/lib/record_loader/flowcell_type_request_type_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/flowcell_type_request_type_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::FlowcellTypeRequestTypeLoader, loader: true, type: :model do +RSpec.describe RecordLoader::FlowcellTypeRequestTypeLoader, :loader, type: :model do subject(:record_loader) { described_class.new(directory: test_directory, files: selected_files) } # Tests use a separate directory to avoid coupling your specs to the data diff --git a/spec/lib/record_loader/library_type_loader_spec.rb b/spec/lib/record_loader/library_type_loader_spec.rb index 0af364a721..d4e0e52703 100644 --- a/spec/lib/record_loader/library_type_loader_spec.rb +++ b/spec/lib/record_loader/library_type_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/library_type_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::LibraryTypeLoader, loader: true, type: :model do +RSpec.describe RecordLoader::LibraryTypeLoader, :loader, type: :model do def a_new_record_loader described_class.new(directory: test_directory, files: selected_files) end diff --git a/spec/lib/record_loader/pipeline_loader_spec.rb b/spec/lib/record_loader/pipeline_loader_spec.rb index db2d6b446e..fda6e8b9db 100644 --- a/spec/lib/record_loader/pipeline_loader_spec.rb +++ b/spec/lib/record_loader/pipeline_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/pipeline_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::PipelineLoader, loader: true, type: :model do +RSpec.describe RecordLoader::PipelineLoader, :loader, type: :model do subject(:record_loader) { described_class.new(directory: test_directory, files: selected_files) } # Tests use a separate directory to avoid coupling your specs to the data diff --git a/spec/lib/record_loader/pipeline_request_information_type_loader_spec.rb b/spec/lib/record_loader/pipeline_request_information_type_loader_spec.rb index 21fef3e30f..a8e851a2b2 100644 --- a/spec/lib/record_loader/pipeline_request_information_type_loader_spec.rb +++ b/spec/lib/record_loader/pipeline_request_information_type_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/pipeline_request_information_type_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::PipelineRequestInformationTypeLoader, loader: true, type: :model do +RSpec.describe RecordLoader::PipelineRequestInformationTypeLoader, :loader, type: :model do subject(:record_loader) { described_class.new(directory: test_directory, files: selected_files) } # Tests use a separate directory to avoid coupling your specs to the data diff --git a/spec/lib/record_loader/plate_purpose_loader_spec.rb b/spec/lib/record_loader/plate_purpose_loader_spec.rb index 3c6e83d35f..d7f0d14259 100644 --- a/spec/lib/record_loader/plate_purpose_loader_spec.rb +++ b/spec/lib/record_loader/plate_purpose_loader_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'record_loader/plate_purpose_loader' -RSpec.describe RecordLoader::PlatePurposeLoader, loader: true, type: :model do +RSpec.describe RecordLoader::PlatePurposeLoader, :loader, type: :model do def a_new_record_loader described_class.new(directory: test_directory, files: selected_files) end diff --git a/spec/lib/record_loader/plate_type_loader_spec.rb b/spec/lib/record_loader/plate_type_loader_spec.rb index a049dbdd38..c02482a1ac 100644 --- a/spec/lib/record_loader/plate_type_loader_spec.rb +++ b/spec/lib/record_loader/plate_type_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/plate_type_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::PlateTypeLoader, loader: true, type: :model do +RSpec.describe RecordLoader::PlateTypeLoader, :loader, type: :model do def a_new_record_loader described_class.new(directory: test_directory, files: selected_files) end diff --git a/spec/lib/record_loader/primer_panel_loader_spec.rb b/spec/lib/record_loader/primer_panel_loader_spec.rb index a1907a3ded..8b7fa1aea0 100644 --- a/spec/lib/record_loader/primer_panel_loader_spec.rb +++ b/spec/lib/record_loader/primer_panel_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/primer_panel_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::PrimerPanelLoader, loader: true, type: :model do +RSpec.describe RecordLoader::PrimerPanelLoader, :loader, type: :model do def a_new_record_loader described_class.new(directory: test_directory, files: selected_files) end diff --git a/spec/lib/record_loader/product_catalogue_loader_spec.rb b/spec/lib/record_loader/product_catalogue_loader_spec.rb index f2ae05a7df..746dad5f78 100644 --- a/spec/lib/record_loader/product_catalogue_loader_spec.rb +++ b/spec/lib/record_loader/product_catalogue_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/product_catalogue_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::ProductCatalogueLoader, loader: true, type: :model do +RSpec.describe RecordLoader::ProductCatalogueLoader, :loader, type: :model do subject(:record_loader) { described_class.new(directory: test_directory, files: selected_files) } # Tests use a separate directory to avoid coupling your specs to the data diff --git a/spec/lib/record_loader/request_information_type_loader_spec.rb b/spec/lib/record_loader/request_information_type_loader_spec.rb index 9408c97518..c60d703ca9 100644 --- a/spec/lib/record_loader/request_information_type_loader_spec.rb +++ b/spec/lib/record_loader/request_information_type_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/request_information_type_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::RequestInformationTypeLoader, loader: true, type: :model do +RSpec.describe RecordLoader::RequestInformationTypeLoader, :loader, type: :model do subject(:record_loader) { described_class.new(directory: test_directory, files: selected_files) } # Tests use a separate directory to avoid coupling your specs to the data diff --git a/spec/lib/record_loader/request_type_loader_spec.rb b/spec/lib/record_loader/request_type_loader_spec.rb index f9adadbf66..b059bc6d32 100644 --- a/spec/lib/record_loader/request_type_loader_spec.rb +++ b/spec/lib/record_loader/request_type_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/request_type_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::RequestTypeLoader, loader: true, type: :model do +RSpec.describe RecordLoader::RequestTypeLoader, :loader, type: :model do def a_new_record_loader(files = selected_files) described_class.new(directory: test_directory, files: files) end diff --git a/spec/lib/record_loader/request_type_validators_loader_spec.rb b/spec/lib/record_loader/request_type_validators_loader_spec.rb index 8383108045..a65411a494 100644 --- a/spec/lib/record_loader/request_type_validators_loader_spec.rb +++ b/spec/lib/record_loader/request_type_validators_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/request_type_validators_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::RequestTypeValidatorsLoader, loader: true, type: :model do +RSpec.describe RecordLoader::RequestTypeValidatorsLoader, :loader, type: :model do subject(:record_loader) { described_class.new(directory: test_directory, files: selected_files) } # Tests use a separate directory to avoid coupling your specs to the data diff --git a/spec/lib/record_loader/robot_loader_spec.rb b/spec/lib/record_loader/robot_loader_spec.rb index 7aad02a200..89ba93e00c 100644 --- a/spec/lib/record_loader/robot_loader_spec.rb +++ b/spec/lib/record_loader/robot_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/robot_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::RobotLoader, loader: true, type: :model do +RSpec.describe RecordLoader::RobotLoader, :loader, type: :model do def a_new_record_loader described_class.new(directory: test_directory, files: selected_files) end diff --git a/spec/lib/record_loader/robot_property_loader_spec.rb b/spec/lib/record_loader/robot_property_loader_spec.rb index 51bcbcd3ad..97f87216b8 100644 --- a/spec/lib/record_loader/robot_property_loader_spec.rb +++ b/spec/lib/record_loader/robot_property_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/robot_property_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::RobotPropertyLoader, loader: true, type: :model do +RSpec.describe RecordLoader::RobotPropertyLoader, :loader, type: :model do def a_new_record_loader described_class.new(directory: test_directory, files: selected_files) end diff --git a/spec/lib/record_loader/submission_template_loader_spec.rb b/spec/lib/record_loader/submission_template_loader_spec.rb index 5529647e8f..ec1b61bc76 100644 --- a/spec/lib/record_loader/submission_template_loader_spec.rb +++ b/spec/lib/record_loader/submission_template_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/submission_template_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::SubmissionTemplateLoader, loader: true, type: :model do +RSpec.describe RecordLoader::SubmissionTemplateLoader, :loader, type: :model do subject(:record_loader) { described_class.new(directory: test_directory, files: selected_files) } # Tests use a separate directory to avoid coupling your specs to the data diff --git a/spec/lib/record_loader/tag_group_adapter_type_loader_spec.rb b/spec/lib/record_loader/tag_group_adapter_type_loader_spec.rb index de38250454..67eb493780 100644 --- a/spec/lib/record_loader/tag_group_adapter_type_loader_spec.rb +++ b/spec/lib/record_loader/tag_group_adapter_type_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/tag_group_adapter_type_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::TagGroupAdapterTypeLoader, loader: true, type: :model do +RSpec.describe RecordLoader::TagGroupAdapterTypeLoader, :loader, type: :model do def a_new_record_loader described_class.new(directory: test_directory, files: selected_files) end diff --git a/spec/lib/record_loader/tag_group_loader_spec.rb b/spec/lib/record_loader/tag_group_loader_spec.rb index 4d9dd537a2..26428c2b54 100644 --- a/spec/lib/record_loader/tag_group_loader_spec.rb +++ b/spec/lib/record_loader/tag_group_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/tag_group_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::TagGroupLoader, loader: true, type: :model do +RSpec.describe RecordLoader::TagGroupLoader, :loader, type: :model do def a_new_record_loader described_class.new(directory: test_directory, files: selected_files) end diff --git a/spec/lib/record_loader/tag_layout_templates_loader_spec.rb b/spec/lib/record_loader/tag_layout_templates_loader_spec.rb index 9777d1801e..d8a1e153bb 100644 --- a/spec/lib/record_loader/tag_layout_templates_loader_spec.rb +++ b/spec/lib/record_loader/tag_layout_templates_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/tag_layout_templates_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::TagLayoutTemplatesLoader, loader: true, type: :model do +RSpec.describe RecordLoader::TagLayoutTemplatesLoader, :loader, type: :model do def a_new_record_loader described_class.new(directory: test_directory, files: selected_files) end diff --git a/spec/lib/record_loader/transfer_template_loader_spec.rb b/spec/lib/record_loader/transfer_template_loader_spec.rb index 75bcfaaa6a..5f8944a43b 100644 --- a/spec/lib/record_loader/transfer_template_loader_spec.rb +++ b/spec/lib/record_loader/transfer_template_loader_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'record_loader/transfer_template_loader' -RSpec.describe RecordLoader::TransferTemplateLoader, loader: true, type: :model do +RSpec.describe RecordLoader::TransferTemplateLoader, :loader, type: :model do subject(:record_loader) { described_class.new(directory: test_directory, files: selected_files) } let(:test_directory) { Rails.root.join('spec/data/record_loader/transfer_templates') } diff --git a/spec/lib/record_loader/tube_purpose_loader_spec.rb b/spec/lib/record_loader/tube_purpose_loader_spec.rb index c9a27004d0..d4ee0a2e47 100644 --- a/spec/lib/record_loader/tube_purpose_loader_spec.rb +++ b/spec/lib/record_loader/tube_purpose_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/tube_purpose_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::TubePurposeLoader, loader: true, type: :model do +RSpec.describe RecordLoader::TubePurposeLoader, :loader, type: :model do def a_new_record_loader described_class.new(directory: test_directory, files: selected_files) end diff --git a/spec/lib/record_loader/tube_rack_purpose_loader_spec.rb b/spec/lib/record_loader/tube_rack_purpose_loader_spec.rb index 4e5ace932f..867a6b552f 100644 --- a/spec/lib/record_loader/tube_rack_purpose_loader_spec.rb +++ b/spec/lib/record_loader/tube_rack_purpose_loader_spec.rb @@ -4,7 +4,7 @@ require 'record_loader/tube_rack_purpose_loader' # This file was initially generated via `rails g record_loader` -RSpec.describe RecordLoader::TubeRackPurposeLoader, loader: true, type: :model do +RSpec.describe RecordLoader::TubeRackPurposeLoader, :loader, type: :model do subject(:record_loader) { described_class.new(directory: test_directory, files: selected_files) } # Tests use a separate directory to avoid coupling your specs to the data diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index bae36c99dd..f0a69e9262 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -110,7 +110,7 @@ def merge_permissions(*permissions) end shared_examples 'it grants only granted_permissions' do - it 'grants expected permissions', aggregate_failures: true do + it 'grants expected permissions', :aggregate_failures do all_actions.each do |klass, action| next unless granted_permissions.fetch(klass, []).include?(action) @@ -118,7 +118,7 @@ def merge_permissions(*permissions) end end - it 'does not grant unexpected permissions', aggregate_failures: true do + it 'does not grant unexpected permissions', :aggregate_failures do all_actions.each do |klass, action| next if granted_permissions.fetch(klass, []).include?(action) diff --git a/spec/models/broadcast_event/broadcast_event_spec.rb b/spec/models/broadcast_event/broadcast_event_spec.rb index dc0e460fb5..e98ea36287 100644 --- a/spec/models/broadcast_event/broadcast_event_spec.rb +++ b/spec/models/broadcast_event/broadcast_event_spec.rb @@ -102,7 +102,7 @@ def accessible end end -RSpec.describe BroadcastEvent, broadcast_event: true do +RSpec.describe BroadcastEvent, :broadcast_event do it 'is not directly instantiated' do expect(described_class.new).not_to be_valid end @@ -149,7 +149,7 @@ def accessible it 'has five subjects' do expect(event.subjects).to be_present - assert_equal 5, event.subjects.length + expect(event.subjects.length).to eq(5) end it 'finds subjects with a 1 to many relationship' do @@ -199,7 +199,7 @@ def accessible end it 'finds all metadata as a hash' do - assert_equal({ 'data_a' => value_a, 'data_b' => value_b, 'data_c' => 'value_c' }, event.metadata) + expect(event.metadata).to eq({ 'data_a' => value_a, 'data_b' => value_b, 'data_c' => 'value_c' }) end describe '#routing_key' do @@ -258,7 +258,7 @@ def accessible 'lims' => 'SQSCP' } - assert_equal expected_json, JSON.parse(event.to_json) + expect(JSON.parse(event.to_json)).to eq(expected_json) end end end diff --git a/spec/models/broadcast_event/helpers/external_subjects_spec.rb b/spec/models/broadcast_event/helpers/external_subjects_spec.rb index bc349d47cc..fe0a44598a 100644 --- a/spec/models/broadcast_event/helpers/external_subjects_spec.rb +++ b/spec/models/broadcast_event/helpers/external_subjects_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'rails_helper' -RSpec.describe BroadcastEvent::Helpers::ExternalSubjects, heron_events: true do +RSpec.describe BroadcastEvent::Helpers::ExternalSubjects, :heron_events do let(:testing_event_class) { Class.new(BroadcastEvent) { include BroadcastEvent::Helpers::ExternalSubjects } } let(:labware) { create :labware } let(:sub1) do diff --git a/spec/models/broadcast_event/lab_event_spec.rb b/spec/models/broadcast_event/lab_event_spec.rb index df3d9a5385..572d91c3bd 100644 --- a/spec/models/broadcast_event/lab_event_spec.rb +++ b/spec/models/broadcast_event/lab_event_spec.rb @@ -4,7 +4,7 @@ require 'rails_helper' -RSpec.describe BroadcastEvent::LabEvent, broadcast_event: true do +RSpec.describe BroadcastEvent::LabEvent, :broadcast_event do subject do described_class.create!(seed: lab_event, user: user, created_at: Time.zone.parse('2018-01-12T13:37:03+00:00')) end diff --git a/spec/models/broadcast_event/library_complete_spec.rb b/spec/models/broadcast_event/library_complete_spec.rb index e43566e479..a0233be7fe 100644 --- a/spec/models/broadcast_event/library_complete_spec.rb +++ b/spec/models/broadcast_event/library_complete_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'shared_contexts/limber_shared_context' -RSpec.describe BroadcastEvent::LibraryComplete, broadcast_event: true do +RSpec.describe BroadcastEvent::LibraryComplete, :broadcast_event do include_context 'a limber target plate with submissions' let(:user) { create(:user) } diff --git a/spec/models/broadcast_event/plate_cherrypicked_spec.rb b/spec/models/broadcast_event/plate_cherrypicked_spec.rb index 87cccba490..b28c9f4031 100644 --- a/spec/models/broadcast_event/plate_cherrypicked_spec.rb +++ b/spec/models/broadcast_event/plate_cherrypicked_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe BroadcastEvent::PlateCherrypicked, broadcast_event: true, heron_events: true do +RSpec.describe BroadcastEvent::PlateCherrypicked, :broadcast_event, :heron_events do def subject_record(subject_type, role_type, friendly_name, uuid) { role_type: role_type, subject_type: subject_type, friendly_name: friendly_name, uuid: uuid } end diff --git a/spec/models/broadcast_event/pool_released_spec.rb b/spec/models/broadcast_event/pool_released_spec.rb index 1d95feb00b..8d2cf90a48 100644 --- a/spec/models/broadcast_event/pool_released_spec.rb +++ b/spec/models/broadcast_event/pool_released_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe BroadcastEvent::PoolReleased, broadcast_event: true do +RSpec.describe BroadcastEvent::PoolReleased, :broadcast_event do let(:source_plate) do pl = create :full_stock_plate pl.wells.first.aliquots << (create :aliquot, sample: tube.samples.first) diff --git a/spec/models/broadcast_event/qc_assay_spec.rb b/spec/models/broadcast_event/qc_assay_spec.rb index 46e8eb39cc..a611892d5c 100644 --- a/spec/models/broadcast_event/qc_assay_spec.rb +++ b/spec/models/broadcast_event/qc_assay_spec.rb @@ -4,7 +4,7 @@ require 'rails_helper' -RSpec.describe BroadcastEvent::QcAssay, broadcast_event: true do +RSpec.describe BroadcastEvent::QcAssay, :broadcast_event do subject do described_class.create!( seed: qc_assay, diff --git a/spec/models/broadcast_event/sequencing_complete_spec.rb b/spec/models/broadcast_event/sequencing_complete_spec.rb index 61be5fcda8..b7e7690b1a 100644 --- a/spec/models/broadcast_event/sequencing_complete_spec.rb +++ b/spec/models/broadcast_event/sequencing_complete_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe BroadcastEvent::SequencingComplete, broadcast_event: true do +RSpec.describe BroadcastEvent::SequencingComplete, :broadcast_event do let(:user) { create(:user) } let(:study) { create(:study) } let(:project) { create(:project) } diff --git a/spec/models/illumina_htp/requests/heron_request_spec.rb b/spec/models/illumina_htp/requests/heron_request_spec.rb index 42cdb89877..8f38925810 100644 --- a/spec/models/illumina_htp/requests/heron_request_spec.rb +++ b/spec/models/illumina_htp/requests/heron_request_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe IlluminaHtp::Requests::HeronRequest, heron: true do +describe IlluminaHtp::Requests::HeronRequest, :heron do subject(:request) { create :heron_request } describe '#request_metadata' do diff --git a/spec/models/illumina_htp/requests/heron_tailed_request_spec.rb b/spec/models/illumina_htp/requests/heron_tailed_request_spec.rb index cb4f48ab68..8cc8468612 100644 --- a/spec/models/illumina_htp/requests/heron_tailed_request_spec.rb +++ b/spec/models/illumina_htp/requests/heron_tailed_request_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe IlluminaHtp::Requests::HeronTailedRequest, heron: true do +describe IlluminaHtp::Requests::HeronTailedRequest, :heron do subject(:request) { build :heron_tailed_request } describe '#request_metadata' do diff --git a/spec/models/labware_spec.rb b/spec/models/labware_spec.rb index 4d3bf663e5..5db0d34af9 100644 --- a/spec/models/labware_spec.rb +++ b/spec/models/labware_spec.rb @@ -18,19 +18,19 @@ let(:plate_fluidigm_2) { fluidigm_plates_list[1] } it 'correctly finds a single ean13 barcode' do - expect(described_class.with_barcode(plate_ean13_1.machine_barcode)).to match_array([plate_ean13_1]) + expect(described_class.with_barcode(plate_ean13_1.machine_barcode)).to contain_exactly(plate_ean13_1) end it 'does not find anything when sent a non-valid ean13 barcode' do - expect(described_class.with_barcode('1234567890123')).to match_array([]) + expect(described_class.with_barcode('1234567890123')).to be_empty end it 'correctly finds a plate with a single fluidigm barcode' do - expect(described_class.with_barcode(plate_fluidigm_1.fluidigm_barcode)).to match_array([plate_fluidigm_1]) + expect(described_class.with_barcode(plate_fluidigm_1.fluidigm_barcode)).to contain_exactly(plate_fluidigm_1) end it 'does not find anything when sent any other string' do - expect(described_class.with_barcode('INVALID123ABC')).to match_array([]) + expect(described_class.with_barcode('INVALID123ABC')).to be_empty end context 'with valid barcodes' do diff --git a/spec/models/linear_submission_spec.rb b/spec/models/linear_submission_spec.rb index 2b5bf1ab91..502d9b2cd0 100644 --- a/spec/models/linear_submission_spec.rb +++ b/spec/models/linear_submission_spec.rb @@ -57,9 +57,10 @@ mpx_submission.requests.each do |request| assert request.qc_metrics.include?(expected_metric), "Metric not included in #{request.request_type.name}: #{request.qc_metrics.inspect}" - assert_equal true, - request.request_metadata.customer_accepts_responsibility, - "Customer doesn't accept responsibility" + expect(request.request_metadata.customer_accepts_responsibility).to( + be(true), + "Customer doesn't accept responsibility" + ) end end end @@ -181,7 +182,7 @@ end it "save a comment if there's one passed in" do - assert_equal ['This is a comment'], submission.comments + expect(submission.comments).to eq(['This is a comment']) end describe '#process!' do @@ -197,7 +198,7 @@ let(:sequencing_request) { submission.requests.find_by!(request_type_id: sequencing_request_type.id) } it 'assign submission ids to the requests' do - assert_equal submission, submission.requests.first.submission + expect(submission.requests.first.submission).to eq(submission) end it 'sets metadata on library creation requests' do diff --git a/spec/models/location_report_form_spec.rb b/spec/models/location_report_form_spec.rb index 3f4d6026c2..830e90742a 100644 --- a/spec/models/location_report_form_spec.rb +++ b/spec/models/location_report_form_spec.rb @@ -193,7 +193,7 @@ expect(location_report_form.location_report).to be_valid end - it 'correctly records the form object information in the location report', aggregate_failures: true do + it 'correctly records the form object information in the location report', :aggregate_failures do expect(location_report_form.location_report.name).to eq('Test_name') expect(location_report_form.location_report.report_type).to eq('type_selection') expect(location_report_form.location_report.faculty_sponsor_ids).to eq([study_1_sponsor.id]) @@ -261,7 +261,7 @@ expect(location_report_form.location_report).to be_valid end - it 'correctly records the form object information in the location report', aggregate_failures: true do + it 'correctly records the form object information in the location report', :aggregate_failures do expect(location_report_form.location_report.name).to eq('Test_name') expect(location_report_form.location_report.report_type).to eq('type_labwhere') expect(location_report_form.location_report.location_barcode).to eq('1001') diff --git a/spec/models/lot_type_spec.rb b/spec/models/lot_type_spec.rb index 0842c73da4..d2a76a4121 100644 --- a/spec/models/lot_type_spec.rb +++ b/spec/models/lot_type_spec.rb @@ -29,8 +29,8 @@ end it 'set the lot properties' do - assert_equal user, lot.user - assert_equal '123456789', lot.lot_number + expect(lot.user).to eq(user) + expect(lot.lot_number).to eq('123456789') end end end diff --git a/spec/models/orders/order_spec.rb b/spec/models/orders/order_spec.rb index accbb56ea7..2953056178 100644 --- a/spec/models/orders/order_spec.rb +++ b/spec/models/orders/order_spec.rb @@ -80,9 +80,9 @@ yielded = false order.duplicates_within(1.month) do |samples, orders, submissions| yielded = true - assert_equal [asset_a.samples.first], samples - assert_equal [@secondary_order], orders - assert_equal [@secondary_submission], submissions + expect(samples).to eq([asset_a.samples.first]) + expect(orders).to eq([@secondary_order]) + expect(submissions).to eq([@secondary_submission]) end assert yielded, 'duplicates_within failed to yield' end diff --git a/spec/models/phi_x/spiked_buffer_spec.rb b/spec/models/phi_x/spiked_buffer_spec.rb index b5b885f2a1..260178d970 100644 --- a/spec/models/phi_x/spiked_buffer_spec.rb +++ b/spec/models/phi_x/spiked_buffer_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe PhiX::SpikedBuffer, phi_x: true do +RSpec.describe PhiX::SpikedBuffer, :phi_x do subject { build :phi_x_spiked_buffer, custom_options } context 'with suitable options' do diff --git a/spec/models/phi_x/stock_spec.rb b/spec/models/phi_x/stock_spec.rb index 93588e3fe4..51a0a54097 100644 --- a/spec/models/phi_x/stock_spec.rb +++ b/spec/models/phi_x/stock_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe PhiX::Stock, phi_x: true do +RSpec.describe PhiX::Stock, :phi_x do subject { build :phi_x_stock, custom_options } context 'with suitable options' do diff --git a/spec/models/pick_list_spec.rb b/spec/models/pick_list_spec.rb index 160e98414f..b2c6524d37 100644 --- a/spec/models/pick_list_spec.rb +++ b/spec/models/pick_list_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'rails_helper' -RSpec.describe PickList, pick_list: true do +RSpec.describe PickList, :pick_list do subject(:pick_list) { described_class.new(pick_attributes: picks, asynchronous: asynchronous) } let(:wells) { create_list :untagged_well, 2 } diff --git a/spec/models/plate_purpose_spec.rb b/spec/models/plate_purpose_spec.rb index 3fce2781d4..f2a7fabf6e 100644 --- a/spec/models/plate_purpose_spec.rb +++ b/spec/models/plate_purpose_spec.rb @@ -7,7 +7,6 @@ let(:plate_purpose) { create :plate_purpose, target_type: target_type, size: size } shared_examples 'a plate factory' do - # rubocop:todo RSpec/ExpectInHook before { expect(PlateBarcode).to receive(:create_barcode).and_return(build(:plate_barcode)) } # rubocop:enable RSpec/ExpectInHook diff --git a/spec/models/plate_volume_spec.rb b/spec/models/plate_volume_spec.rb index 61b948ac12..c80793bad0 100644 --- a/spec/models/plate_volume_spec.rb +++ b/spec/models/plate_volume_spec.rb @@ -100,7 +100,7 @@ plate_with_barcodes_in_csv .wells .includes(:well_attribute, :map) - .each do |well| + .find_each do |well| expect(well.qc_results).to be_one expect(well.qc_results.first.key).to eq('volume') expect(well.qc_results.first.assay_type).to eq('Volume Check') diff --git a/spec/models/pooling_spec.rb b/spec/models/pooling_spec.rb index fa1624aad1..955bd4eb46 100644 --- a/spec/models/pooling_spec.rb +++ b/spec/models/pooling_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe Pooling, poolings: true do +describe Pooling, :poolings do let(:empty_lb_tube) { create :empty_library_tube, barcode: 1 } let(:untagged_lb_tube1) { create :library_tube, barcode: 2 } let(:untagged_lb_tube2) { create :library_tube, barcode: 3 } @@ -94,7 +94,7 @@ ) end - it 'sets up child relationships', aggregate_failures: true do + it 'sets up child relationships', :aggregate_failures do expect(pooling.execute).to be true input_tubes = Labware.with_barcode(barcodes) expect(input_tubes.all? { |l| l.children.include?(pooling.stock_mx_tube) }).to be true diff --git a/spec/models/qc_result/qc_result_factory_spec.rb b/spec/models/qc_result/qc_result_factory_spec.rb index fa99a579aa..f65b592697 100644 --- a/spec/models/qc_result/qc_result_factory_spec.rb +++ b/spec/models/qc_result/qc_result_factory_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe QcResultFactory, qc_result: true do +RSpec.describe QcResultFactory, :qc_result do describe 'multiple resources' do let(:asset_1) { attributes_for(:qc_result).merge(uuid: create(:receptacle).uuid) } let(:asset_2) { attributes_for(:qc_result).merge(uuid: create(:receptacle).uuid) } @@ -26,9 +26,9 @@ factory = described_class.new([asset_1, asset_2, asset_3]) expect(factory).to be_valid expect(factory.save).to be_truthy - expect(QcResult.all.count).to eq(3) - expect(QcAssay.all.count).to eq(1) - QcResult.all.each { |qc_result| expect(qc_result.qc_assay).to eq QcAssay.last } + expect(QcResult.count).to eq(3) + expect(QcAssay.count).to eq(1) + QcResult.find_each { |qc_result| expect(qc_result.qc_assay).to eq QcAssay.last } end it 'produces sensible error messages if the resource is not valid' do @@ -67,9 +67,9 @@ factory = described_class.new(qc_results: [asset_1, asset_2, asset_3], lot_number: 'LN1234567') expect(factory).to be_valid expect(factory.save).to be_truthy - expect(QcResult.all.count).to eq(3) - expect(QcAssay.all.count).to eq(1) - QcResult.all.each { |qc_result| expect(qc_result.qc_assay).to eq QcAssay.last } + expect(QcResult.count).to eq(3) + expect(QcAssay.count).to eq(1) + QcResult.find_each { |qc_result| expect(qc_result.qc_assay).to eq QcAssay.last } end end @@ -93,7 +93,7 @@ it 'will save all of the assets with valid wells' do expect(factory.save).to be_truthy - expect(QcResult.all.count).to eq(2) + expect(QcResult.count).to eq(2) end end end diff --git a/spec/models/qc_result/qc_result_spec.rb b/spec/models/qc_result/qc_result_spec.rb index 2f68744670..68143b16cd 100644 --- a/spec/models/qc_result/qc_result_spec.rb +++ b/spec/models/qc_result/qc_result_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe QcResult, qc_result: true do +RSpec.describe QcResult, :qc_result do it 'is not valid without a key' do expect(build(:qc_result, key: nil)).not_to be_valid end @@ -60,7 +60,7 @@ end end -describe QcResult, warren: true do +describe QcResult, :warren do let(:warren) { Warren.handler } before { warren.clear_messages } diff --git a/spec/models/request_spec.rb b/spec/models/request_spec.rb index be8f089ca1..394700e974 100644 --- a/spec/models/request_spec.rb +++ b/spec/models/request_spec.rb @@ -85,7 +85,7 @@ before { @request2 = create :request, submission: @submission, request_type: @genotyping_request_type } it 'return the correct next request' do - assert_equal [@request2], @request1.next_requests + expect(@request1.next_requests).to eq([@request2]) end end @@ -95,7 +95,7 @@ end it 'return the correct next request' do - assert_equal [@request2], @request1.next_requests + expect(@request1.next_requests).to eq([@request2]) end end end @@ -243,7 +243,7 @@ @request.request_metadata.attributes.merge('id' => nil, 'request_id' => nil, 'updated_at' => nil) copied_attributes = @new_request.request_metadata.attributes.merge('id' => nil, 'request_id' => nil, 'updated_at' => nil) - assert_equal original_attributes, copied_attributes + expect(copied_attributes).to eq(original_attributes) end it 'remove target_asset' do @@ -279,7 +279,7 @@ context 'when a new request is created' do it "return the default state 'pending'" do - assert_equal 'pending', @request.state + expect(@request.state).to eq('pending') end end @@ -324,19 +324,19 @@ end it "return status of 'passed'" do - assert_equal 'passed', @request.state + expect(@request.state).to eq('passed') end it 'not be pending' do - assert_equal false, @request.pending? + expect(@request.pending?).to be(false) end it 'not be failed' do - assert_equal false, @request.failed? + expect(@request.failed?).to be(false) end it 'not be started' do - assert_equal false, @request.started? + expect(@request.started?).to be(false) end it 'be passed' do @@ -360,19 +360,19 @@ end it "return status of 'failed'" do - assert_equal 'failed', @request.state + expect(@request.state).to eq('failed') end it 'not be pending' do - assert_equal false, @request.pending? + expect(@request.pending?).to be(false) end it 'not be passed' do - assert_equal false, @request.passed? + expect(@request.passed?).to be(false) end it 'not be started' do - assert_equal false, @request.started? + expect(@request.started?).to be(false) end it 'be failed' do @@ -412,18 +412,18 @@ @all_states.each { |state| create :request, state: state } - assert_equal @all_states.size, described_class.count + expect(described_class.count).to eq(@all_states.size) end context 'open requests' do it 'total right number' do - assert_equal @open_states.size, described_class.opened.count + expect(described_class.opened.count).to eq(@open_states.size) end end context 'closed requests' do it 'total right number' do - assert_equal @closed_states.size, described_class.closed.count + expect(described_class.closed.count).to eq(@closed_states.size) end end end @@ -432,7 +432,7 @@ before { @library_creation_request = create(:library_creation_request_for_testing_sequencing_requests) } it 'check any non-sequencing request is always ready' do - assert_equal true, @library_creation_request.ready? + expect(@library_creation_request.ready?).to be(true) end end diff --git a/spec/models/request_type_spec.rb b/spec/models/request_type_spec.rb index e575fe6e46..fa008faaee 100644 --- a/spec/models/request_type_spec.rb +++ b/spec/models/request_type_spec.rb @@ -38,7 +38,7 @@ it 'set purpose on request' do request = @nrequest_type.create! - assert_equal 'internal', request.request_purpose + expect(request.request_purpose).to eq('internal') end end diff --git a/spec/models/robot/pick_data_spec.rb b/spec/models/robot/pick_data_spec.rb index 81157bbd76..b5518b3c2d 100644 --- a/spec/models/robot/pick_data_spec.rb +++ b/spec/models/robot/pick_data_spec.rb @@ -3,10 +3,10 @@ require 'rails_helper' require './spec/models/robot/pick_hash_tester_helper' -RSpec.describe Robot::PickData, robot_verification: true do +RSpec.describe Robot::PickData, :robot_verification do subject(:pick_data) { described_class.new(batch, max_beds: 2) } - around { |example| travel_to(time) { example.run } } + before { travel_to(time) } describe '#picking_data_hash' do let(:time) { Time.zone.local(2010, 7, 12, 10, 25, 0) } diff --git a/spec/models/robot/verification/source_dest_beds_spec.rb b/spec/models/robot/verification/source_dest_beds_spec.rb index 97ec98ddf9..03b030c91b 100644 --- a/spec/models/robot/verification/source_dest_beds_spec.rb +++ b/spec/models/robot/verification/source_dest_beds_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'broadcast_event/lab_event' -RSpec.describe Robot::Verification::SourceDestBeds, robot_verification: true do +RSpec.describe Robot::Verification::SourceDestBeds, :robot_verification do subject(:verifier) { described_class.new } # We test pick_number_to_expected_layout and pick_numbers with shared contexts @@ -33,6 +33,7 @@ end end end + let(:source_plate_1) { create :plate, well_count: 2 } let(:source_plate_3) { create :plate, well_count: 2 } let(:destination_plate) { create :plate, well_count: 9 } @@ -126,7 +127,7 @@ end it 'does not add extra plates' do - assert_equal plate_index_lookup.length, barcodes.length + expect(barcodes.length).to eq(plate_index_lookup.length) end end @@ -155,7 +156,7 @@ end it 'order source plates by destination well barcode to match the way the robot picks' do - assert_equal expected_order, source_index + expect(source_index).to eq(expected_order) end end diff --git a/spec/models/robot/verification/source_dest_control_beds_spec.rb b/spec/models/robot/verification/source_dest_control_beds_spec.rb index 0d9b34626e..8785f6f502 100644 --- a/spec/models/robot/verification/source_dest_control_beds_spec.rb +++ b/spec/models/robot/verification/source_dest_control_beds_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'broadcast_event/lab_event' -RSpec.describe Robot::Verification::SourceDestControlBeds, robot_verification: true do +RSpec.describe Robot::Verification::SourceDestControlBeds, :robot_verification do subject(:verifier) { described_class.new } describe '#pick_number_to_expected_layout' do diff --git a/spec/models/sample_compound_component_spec.rb b/spec/models/sample_compound_component_spec.rb index 579c841036..3ed7acfd51 100644 --- a/spec/models/sample_compound_component_spec.rb +++ b/spec/models/sample_compound_component_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe SampleCompoundComponent, cardinal: true do +RSpec.describe SampleCompoundComponent, :cardinal do describe '#validate' do let(:compound_sample) { create(:sample) } let(:component_sample) { create(:sample) } diff --git a/spec/models/sample_manifest/generator_spec.rb b/spec/models/sample_manifest/generator_spec.rb index 28d36c4eb1..dea5c17c3e 100644 --- a/spec/models/sample_manifest/generator_spec.rb +++ b/spec/models/sample_manifest/generator_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SampleManifest::Generator, sample_manifest: true, sample_manifest_excel: true do +RSpec.describe SampleManifest::Generator, :sample_manifest, :sample_manifest_excel do before(:all) do SampleManifestExcel.configure do |config| config.folder = File.join('spec', 'data', 'sample_manifest_excel') diff --git a/spec/models/sample_manifest/uploader_spec.rb b/spec/models/sample_manifest/uploader_spec.rb index 92718af728..7487f6f7ba 100644 --- a/spec/models/sample_manifest/uploader_spec.rb +++ b/spec/models/sample_manifest/uploader_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'pry' -RSpec.describe SampleManifest::Uploader, sample_manifest: true, sample_manifest_excel: true do +RSpec.describe SampleManifest::Uploader, :sample_manifest, :sample_manifest_excel do before(:all) do SampleManifestExcel.configure do |config| config.folder = File.join('spec', 'data', 'sample_manifest_excel') @@ -161,7 +161,7 @@ expect(uploader.upload.sample_manifest).to be_completed end - it 'will generate sample accessions', accessioning_enabled: true do + it 'will generate sample accessions', :accessioning_enabled do number_of_plates = 2 samples_per_plate = 2 download = diff --git a/spec/models/sample_manifest_spec.rb b/spec/models/sample_manifest_spec.rb index 5d28213792..a03fa5cd9c 100644 --- a/spec/models/sample_manifest_spec.rb +++ b/spec/models/sample_manifest_spec.rb @@ -5,7 +5,7 @@ # Rubocop doesn't like the .and change {}.by bits and will # result in repeatedly indenting them to the level of the last call in the previous chain -RSpec.describe SampleManifest, sample_manifest: true do +RSpec.describe SampleManifest, :sample_manifest do let(:user) { create :user } let(:study) { create :study } @@ -83,7 +83,7 @@ before { manifest.generate } it 'create a plate of the correct purpose' do - assert_equal purpose, Plate.last.purpose + expect(Plate.last.purpose).to eq(purpose) end end end @@ -142,7 +142,7 @@ before { manifest.generate } it 'create a plate of the correct purpose' do - assert_equal purpose, Plate.last.purpose + expect(Plate.last.purpose).to eq(purpose) end end end @@ -174,7 +174,7 @@ it 'create sample manifest asset' do expect { manifest.generate }.to change(SampleManifestAsset, :count).by(count) - expect(manifest.assets).to contain_exactly(*LibraryTube.with_barcode(manifest.barcodes).map(&:receptacle)) + expect(manifest.assets).to match_array(LibraryTube.with_barcode(manifest.barcodes).map(&:receptacle)) end context 'after generation' do diff --git a/spec/models/sample_spec.rb b/spec/models/sample_spec.rb index 8518fc8757..08042600fa 100644 --- a/spec/models/sample_spec.rb +++ b/spec/models/sample_spec.rb @@ -4,7 +4,7 @@ require 'support/barcode_helper' require 'sample_accessioning_job' -RSpec.describe Sample, accession: true, cardinal: true do +RSpec.describe Sample, :accession, :cardinal do include MockAccession context 'accessioning' do @@ -174,12 +174,12 @@ end it 'compound samples are able to query their component samples' do - expect(compound_sample.component_samples).to match_array [component_sample1, component_sample2] + expect(compound_sample.component_samples).to contain_exactly(component_sample1, component_sample2) end it 'component samples are able to query their compound samples' do - expect(component_sample1.compound_samples).to match_array [compound_sample] - expect(component_sample2.compound_samples).to match_array [compound_sample] + expect(component_sample1.compound_samples).to contain_exactly(compound_sample) + expect(component_sample2.compound_samples).to contain_exactly(compound_sample) end it 'removing a component sample removes both sides of the relationship' do @@ -187,8 +187,8 @@ compound_sample.save component_sample2.reload - expect(compound_sample.component_samples).to match_array [component_sample1] - expect(component_sample1.compound_samples).to match_array [compound_sample] + expect(compound_sample.component_samples).to contain_exactly(component_sample1) + expect(component_sample1.compound_samples).to contain_exactly(compound_sample) expect(component_sample2.compound_samples).to be_empty end @@ -196,18 +196,18 @@ component_sample1.compound_samples.delete(compound_sample) compound_sample.reload - expect(compound_sample.component_samples).to match_array [component_sample2] + expect(compound_sample.component_samples).to contain_exactly(component_sample2) expect(component_sample1.compound_samples).to be_empty - expect(component_sample2.compound_samples).to match_array [compound_sample] + expect(component_sample2.compound_samples).to contain_exactly(compound_sample) end it 'component samples can belong to many compound samples' do other_compound_sample = create(:sample, component_samples: [component_sample1]) component_sample1.reload - expect(other_compound_sample.component_samples).to match_array [component_sample1] - expect(component_sample1.compound_samples).to match_array [compound_sample, other_compound_sample] - expect(component_sample2.compound_samples).to match_array [compound_sample] + expect(other_compound_sample.component_samples).to contain_exactly(component_sample1) + expect(component_sample1.compound_samples).to contain_exactly(compound_sample, other_compound_sample) + expect(component_sample2.compound_samples).to contain_exactly(compound_sample) end context 'changing associations modifies the updated_at time of affected samples' do @@ -264,7 +264,7 @@ context '(DPL-148) on updating sample metadata' do let(:sample) { create :sample } - it 'triggers warehouse update', warren: true do + it 'triggers warehouse update', :warren do expect do # We try with a valid update sample.sample_metadata.update(gender: 'Male') diff --git a/spec/models/state_changer/initial_stock_tube_spec.rb b/spec/models/state_changer/initial_stock_tube_spec.rb index c099cc5297..60aa04bc01 100644 --- a/spec/models/state_changer/initial_stock_tube_spec.rb +++ b/spec/models/state_changer/initial_stock_tube_spec.rb @@ -44,7 +44,7 @@ let(:target_state) { 'started' } let(:request_state) { 'pending' } - it 'updates the tube to "started" with "started" requests', aggregate_failures: true do + it 'updates the tube to "started" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('started') end @@ -54,7 +54,7 @@ let(:target_state) { 'started' } let(:request_state) { 'started' } - it 'updates the tube to "started" with "started" requests', aggregate_failures: true do + it 'updates the tube to "started" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('started') end @@ -64,7 +64,7 @@ let(:target_state) { 'started' } let(:request_state) { 'failed' } - it 'updates the tube to "started" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "started" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('failed') end @@ -74,7 +74,7 @@ let(:target_state) { 'started' } let(:request_state) { 'passed' } - it 'updates the tube to "started" with "passed" requests', aggregate_failures: true do + it 'updates the tube to "started" with "passed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('passed') end @@ -84,7 +84,7 @@ let(:target_state) { 'started' } let(:request_state) { 'cancelled' } - it 'updates the tube to "started" with "cancelled" requests', aggregate_failures: true do + it 'updates the tube to "started" with "cancelled" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('cancelled') end @@ -94,7 +94,7 @@ let(:target_state) { 'processed_1' } let(:request_state) { 'pending' } - it 'updates the tube to "processed_1" with "started" requests', aggregate_failures: true do + it 'updates the tube to "processed_1" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('processed_1') expect(request.reload.state).to eq('started') end @@ -104,7 +104,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'pending' } - it 'updates the tube to "passed" with "started" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('started') end @@ -114,7 +114,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'cancelled' } - it 'updates the tube to "passed" with "cancelled" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "cancelled" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('cancelled') end @@ -124,7 +124,7 @@ let(:target_state) { 'failed' } let(:request_state) { 'started' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -134,7 +134,7 @@ let(:target_state) { 'failed' } let(:request_state) { 'passed' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -144,7 +144,7 @@ let(:target_state) { 'cancelled' } let(:request_state) { 'pending' } - it 'updates the tube to "cancelled" with "pending" requests', aggregate_failures: true do + it 'updates the tube to "cancelled" with "pending" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('cancelled') expect(request.reload.state).to eq('pending') end @@ -158,7 +158,7 @@ let(:target_state) { 'processed_2' } let(:request_state) { 'started' } - it 'updates the tube to "processed_2" with "started" requests', aggregate_failures: true do + it 'updates the tube to "processed_2" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('processed_2') expect(request.reload.state).to eq('started') end @@ -172,7 +172,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'started' } - it 'updates the tube to "passed" with "started" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('started') end @@ -182,7 +182,7 @@ let(:target_state) { 'failed' } let(:request_state) { 'started' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -192,7 +192,7 @@ let(:target_state) { 'failed' } let(:request_state) { 'passed' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -213,7 +213,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'pending' } - it 'updates the tube to "failed" with "started" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('pending') end @@ -227,7 +227,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'started' } - it 'updates the tube to "passed" with "started" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('started') end @@ -241,7 +241,7 @@ let(:target_state) { 'failed' } let(:request_state) { 'started' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -251,7 +251,7 @@ let(:target_state) { 'failed' } let(:request_state) { 'passed' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -261,7 +261,7 @@ let(:target_state) { 'qc_complete' } let(:request_state) { 'started' } - it 'updates the tube to "qc_complete" with "started" requests', aggregate_failures: true do + it 'updates the tube to "qc_complete" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('qc_complete') expect(request.reload.state).to eq('started') end @@ -276,7 +276,7 @@ let(:target_state) { 'cancelled' } let(:request_state) { 'started' } - it 'updates the tube to "cancelled" with "started" requests', aggregate_failures: true do + it 'updates the tube to "cancelled" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('cancelled') expect(request.reload.state).to eq('started') end diff --git a/spec/models/state_changer/mx_tube_spec.rb b/spec/models/state_changer/mx_tube_spec.rb index 2945b91dc5..41b73e874a 100644 --- a/spec/models/state_changer/mx_tube_spec.rb +++ b/spec/models/state_changer/mx_tube_spec.rb @@ -38,7 +38,7 @@ def create_requests_and_transfers let(:target_state) { 'started' } let(:request_state) { 'pending' } - it 'updates the tube to "started" with "pending" requests', aggregate_failures: true do + it 'updates the tube to "started" with "pending" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('pending') end @@ -48,7 +48,7 @@ def create_requests_and_transfers let(:target_state) { 'started' } let(:request_state) { 'started' } - it 'updates the tube to "started" with "started" requests', aggregate_failures: true do + it 'updates the tube to "started" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('started') end @@ -58,7 +58,7 @@ def create_requests_and_transfers let(:target_state) { 'started' } let(:request_state) { 'failed' } - it 'updates the tube to "started" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "started" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('failed') end @@ -68,7 +68,7 @@ def create_requests_and_transfers let(:target_state) { 'started' } let(:request_state) { 'passed' } - it 'updates the tube to "started" with "passed" requests', aggregate_failures: true do + it 'updates the tube to "started" with "passed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('passed') end @@ -78,7 +78,7 @@ def create_requests_and_transfers let(:target_state) { 'started' } let(:request_state) { 'cancelled' } - it 'updates the tube to "started" with "cancelled" requests', aggregate_failures: true do + it 'updates the tube to "started" with "cancelled" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('cancelled') end @@ -88,7 +88,7 @@ def create_requests_and_transfers let(:target_state) { 'processed_1' } let(:request_state) { 'pending' } - it 'updates the tube to "processed_1" with "pending" requests', aggregate_failures: true do + it 'updates the tube to "processed_1" with "pending" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('processed_1') expect(request.reload.state).to eq('pending') end @@ -98,7 +98,7 @@ def create_requests_and_transfers let(:target_state) { 'passed' } let(:request_state) { 'failed' } - it 'updates the tube to "passed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('failed') end @@ -108,7 +108,7 @@ def create_requests_and_transfers let(:target_state) { 'passed' } let(:request_state) { 'passed' } - it 'updates the tube to "passed" with "passed" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "passed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('passed') end @@ -118,7 +118,7 @@ def create_requests_and_transfers let(:target_state) { 'passed' } let(:request_state) { 'cancelled' } - it 'updates the tube to "passed" with "cancelled" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "cancelled" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('cancelled') end @@ -128,7 +128,7 @@ def create_requests_and_transfers let(:target_state) { 'failed' } let(:request_state) { 'started' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -138,7 +138,7 @@ def create_requests_and_transfers let(:target_state) { 'failed' } let(:request_state) { 'passed' } - it 'updates the tube to "failed" with "passed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "passed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('passed') end @@ -148,7 +148,7 @@ def create_requests_and_transfers let(:target_state) { 'cancelled' } let(:request_state) { 'pending' } - it 'updates the tube to "cancelled" with "pending" requests', aggregate_failures: true do + it 'updates the tube to "cancelled" with "pending" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('cancelled') expect(request.reload.state).to eq('pending') end @@ -162,7 +162,7 @@ def create_requests_and_transfers let(:target_state) { 'processed_2' } let(:request_state) { 'started' } - it 'updates the tube to "processed_2" with "started" requests', aggregate_failures: true do + it 'updates the tube to "processed_2" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('processed_2') expect(request.reload.state).to eq('started') end @@ -176,7 +176,7 @@ def create_requests_and_transfers let(:target_state) { 'passed' } let(:request_state) { 'started' } - it 'updates the tube to "passed" with "passed" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "passed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('passed') end @@ -186,7 +186,7 @@ def create_requests_and_transfers let(:target_state) { 'passed' } let(:request_state) { 'failed' } - it 'updates the tube to "passed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('failed') end @@ -196,7 +196,7 @@ def create_requests_and_transfers let(:target_state) { 'passed' } let(:request_state) { 'cancelled' } - it 'updates the tube to "passed" with "cancelled" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "cancelled" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('cancelled') end @@ -206,7 +206,7 @@ def create_requests_and_transfers let(:target_state) { 'failed' } let(:request_state) { 'started' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -216,7 +216,7 @@ def create_requests_and_transfers let(:target_state) { 'failed' } let(:request_state) { 'passed' } - it 'updates the tube to "failed" with "passed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "passed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('passed') end @@ -226,7 +226,7 @@ def create_requests_and_transfers let(:target_state) { 'cancelled' } let(:request_state) { 'pending' } - it 'updates the tube to "cancelled" with "pending" requests', aggregate_failures: true do + it 'updates the tube to "cancelled" with "pending" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('cancelled') expect(request.reload.state).to eq('pending') end @@ -242,7 +242,7 @@ def create_requests_and_transfers let(:target_state) { 'passed' } let(:request_state) { 'started' } - it 'updates the tube to "passed" with "passed" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "passed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('passed') end @@ -253,7 +253,7 @@ def create_requests_and_transfers let(:target_state) { 'passed' } let(:request_state) { 'failed' } - it 'updates the tube to "passed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('failed') end @@ -267,7 +267,7 @@ def create_requests_and_transfers let(:target_state) { 'passed' } let(:request_state) { 'started' } - it 'updates the tube to "passed" with "passed" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "passed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('passed') end @@ -281,7 +281,7 @@ def create_requests_and_transfers let(:target_state) { 'failed' } let(:request_state) { 'started' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -291,7 +291,7 @@ def create_requests_and_transfers let(:target_state) { 'failed' } let(:request_state) { 'passed' } - it 'updates the tube to "failed" with "passed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "passed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('passed') end @@ -301,7 +301,7 @@ def create_requests_and_transfers let(:target_state) { 'qc_complete' } let(:request_state) { 'started' } - it 'updates the tube to "qc_complete" with "started" requests', aggregate_failures: true do + it 'updates the tube to "qc_complete" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('qc_complete') expect(request.reload.state).to eq('started') end @@ -311,7 +311,7 @@ def create_requests_and_transfers let(:target_state) { 'qc_complete' } let(:request_state) { 'passed' } - it 'updates the tube to "qc_complete" with "passed" requests', aggregate_failures: true do + it 'updates the tube to "qc_complete" with "passed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('qc_complete') expect(request.reload.state).to eq('passed') end @@ -325,7 +325,7 @@ def create_requests_and_transfers let(:target_state) { 'cancelled' } let(:request_state) { 'started' } - it 'updates the tube to "cancelled" with "started" requests', aggregate_failures: true do + it 'updates the tube to "cancelled" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('cancelled') expect(request.reload.state).to eq('started') end diff --git a/spec/models/state_changer/qcable_library_plate_spec.rb b/spec/models/state_changer/qcable_library_plate_spec.rb index e5a122071c..1fd755cd82 100644 --- a/spec/models/state_changer/qcable_library_plate_spec.rb +++ b/spec/models/state_changer/qcable_library_plate_spec.rb @@ -30,8 +30,8 @@ def save! it 'sets library type on aliquots' do state_changer.update_labware_state - assert_equal aliquot.library, well - assert_equal aliquot.library_type, 'QA1' - assert_equal aliquot.insert_size.from, 100 + expect(well).to eq(aliquot.library) + expect(aliquot.library_type).to eq('QA1') + expect(aliquot.insert_size.from).to eq(100) end end diff --git a/spec/models/state_changer/stock_tube_spec.rb b/spec/models/state_changer/stock_tube_spec.rb index 55c81050e8..b3d6f517a1 100644 --- a/spec/models/state_changer/stock_tube_spec.rb +++ b/spec/models/state_changer/stock_tube_spec.rb @@ -31,7 +31,7 @@ let(:target_state) { 'started' } let(:request_state) { 'pending' } - it 'updates the tube to "started" with "pending" requests', aggregate_failures: true do + it 'updates the tube to "started" with "pending" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('pending') end @@ -41,7 +41,7 @@ let(:target_state) { 'started' } let(:request_state) { 'started' } - it 'updates the tube to "started" with "started" requests', aggregate_failures: true do + it 'updates the tube to "started" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('started') end @@ -51,7 +51,7 @@ let(:target_state) { 'started' } let(:request_state) { 'failed' } - it 'updates the tube to "started" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "started" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('failed') end @@ -61,7 +61,7 @@ let(:target_state) { 'started' } let(:request_state) { 'passed' } - it 'updates the tube to "started" with "passed" requests', aggregate_failures: true do + it 'updates the tube to "started" with "passed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('passed') end @@ -71,7 +71,7 @@ let(:target_state) { 'started' } let(:request_state) { 'cancelled' } - it 'updates the tube to "started" with "cancelled" requests', aggregate_failures: true do + it 'updates the tube to "started" with "cancelled" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('started') expect(request.reload.state).to eq('cancelled') end @@ -81,7 +81,7 @@ let(:target_state) { 'processed_1' } let(:request_state) { 'pending' } - it 'updates the tube to "processed_1" with "pending" requests', aggregate_failures: true do + it 'updates the tube to "processed_1" with "pending" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('processed_1') expect(request.reload.state).to eq('pending') end @@ -91,7 +91,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'failed' } - it 'updates the tube to "passed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('failed') end @@ -101,7 +101,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'passed' } - it 'updates the tube to "passed" with "passed" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "passed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('passed') end @@ -111,7 +111,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'cancelled' } - it 'updates the tube to "passed" with "cancelled" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "cancelled" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('cancelled') end @@ -122,7 +122,7 @@ let(:target_state) { 'failed' } let(:request_state) { 'started' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -132,7 +132,7 @@ let(:target_state) { 'failed' } let(:request_state) { 'passed' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -142,7 +142,7 @@ let(:target_state) { 'cancelled' } let(:request_state) { 'pending' } - it 'updates the tube to "cancelled" with "pending" requests', aggregate_failures: true do + it 'updates the tube to "cancelled" with "pending" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('cancelled') expect(request.reload.state).to eq('pending') end @@ -156,7 +156,7 @@ let(:target_state) { 'processed_2' } let(:request_state) { 'started' } - it 'updates the tube to "processed_2" with "started" requests', aggregate_failures: true do + it 'updates the tube to "processed_2" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('processed_2') expect(request.reload.state).to eq('started') end @@ -170,7 +170,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'started' } - it 'updates the tube to "passed" with "started" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('started') end @@ -180,7 +180,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'failed' } - it 'updates the tube to "passed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('failed') end @@ -190,7 +190,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'cancelled' } - it 'updates the tube to "passed" with "cancelled" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "cancelled" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('cancelled') end @@ -200,7 +200,7 @@ let(:target_state) { 'failed' } let(:request_state) { 'started' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -210,7 +210,7 @@ let(:target_state) { 'failed' } let(:request_state) { 'passed' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -220,7 +220,7 @@ let(:target_state) { 'cancelled' } let(:request_state) { 'pending' } - it 'updates the tube to "cancelled" with "pending" requests', aggregate_failures: true do + it 'updates the tube to "cancelled" with "pending" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('cancelled') expect(request.reload.state).to eq('pending') end @@ -234,7 +234,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'pending' } - it 'updates the tube to "passed" with "pending" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "pending" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('pending') end @@ -244,7 +244,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'started' } - it 'updates the tube to "passed" with "started" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('started') end @@ -254,7 +254,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'failed' } - it 'updates the tube to "passed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -268,7 +268,7 @@ let(:target_state) { 'passed' } let(:request_state) { 'started' } - it 'updates the tube to "passed" with "started" requests', aggregate_failures: true do + it 'updates the tube to "passed" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('passed') expect(request.reload.state).to eq('started') end @@ -282,7 +282,7 @@ let(:target_state) { 'failed' } let(:request_state) { 'started' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -292,7 +292,7 @@ let(:target_state) { 'failed' } let(:request_state) { 'passed' } - it 'updates the tube to "failed" with "failed" requests', aggregate_failures: true do + it 'updates the tube to "failed" with "failed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('failed') expect(request.reload.state).to eq('failed') end @@ -302,7 +302,7 @@ let(:target_state) { 'qc_complete' } let(:request_state) { 'started' } - it 'updates the tube to "qc_complete" with "started" requests', aggregate_failures: true do + it 'updates the tube to "qc_complete" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('qc_complete') expect(request.reload.state).to eq('started') end @@ -312,7 +312,7 @@ let(:target_state) { 'qc_complete' } let(:request_state) { 'passed' } - it 'updates the tube to "qc_complete" with "passed" requests', aggregate_failures: true do + it 'updates the tube to "qc_complete" with "passed" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('qc_complete') expect(request.reload.state).to eq('passed') end @@ -326,7 +326,7 @@ let(:target_state) { 'cancelled' } let(:request_state) { 'started' } - it 'updates the tube to "cancelled" with "started" requests', aggregate_failures: true do + it 'updates the tube to "cancelled" with "started" requests', :aggregate_failures do expect(transfer_request.reload.state).to eq('cancelled') expect(request.reload.state).to eq('started') end diff --git a/spec/models/study_spec.rb b/spec/models/study_spec.rb index c7b5555f55..9828d84086 100644 --- a/spec/models/study_spec.rb +++ b/spec/models/study_spec.rb @@ -704,7 +704,7 @@ let(:study) { create :study } let(:user) { create :user } - it 'triggers warehouse update', warren: true do + it 'triggers warehouse update', :warren do expect { user.grant_follower(study) }.to change(Warren.handler.messages, :count).from(0) end end diff --git a/spec/models/tag2_layout_template_spec.rb b/spec/models/tag2_layout_template_spec.rb index 739299ba70..618d69597a 100644 --- a/spec/models/tag2_layout_template_spec.rb +++ b/spec/models/tag2_layout_template_spec.rb @@ -33,6 +33,6 @@ expect(Tag2Layout::TemplateSubmission.where(submission_id: submissions)).to be_present Tag2Layout::TemplateSubmission .where(submission_id: submissions) - .each { |t2lts| expect(t2lts.tag2_layout_template).to eq(tag2_layout_template) } + .find_each { |t2lts| expect(t2lts.tag2_layout_template).to eq(tag2_layout_template) } end end diff --git a/spec/models/tag_layout_template_spec.rb b/spec/models/tag_layout_template_spec.rb index 6e05728bac..65473dc58c 100644 --- a/spec/models/tag_layout_template_spec.rb +++ b/spec/models/tag_layout_template_spec.rb @@ -46,7 +46,7 @@ expect(TagLayout::TemplateSubmission.where(submission_id: submissions)).to be_present TagLayout::TemplateSubmission .where(submission_id: submissions) - .each do |tlts| + .find_each do |tlts| expect(tlts.tag_layout_template).to eq(template) expect(tlts.enforce_uniqueness).to eq(enforce_uniqueness) end @@ -71,7 +71,7 @@ expect(TagLayout::TemplateSubmission.where(submission_id: submissions)).to be_present TagLayout::TemplateSubmission .where(submission_id: submissions) - .each do |tlts| + .find_each do |tlts| expect(tlts.tag_layout_template).to eq(template) expect(tlts.enforce_uniqueness).to eq(enforce_uniqueness) end @@ -99,7 +99,7 @@ expect(TagLayout::TemplateSubmission.where(submission_id: submissions)).to be_present TagLayout::TemplateSubmission .where(submission_id: submissions) - .each do |tlts| + .find_each do |tlts| expect(tlts.tag_layout_template).to eq(template) expect(tlts.enforce_uniqueness).to eq(enforce_uniqueness) end diff --git a/spec/models/tag_substitutions_spec.rb b/spec/models/tag_substitutions_spec.rb index 4329d601b3..af24e4729f 100644 --- a/spec/models/tag_substitutions_spec.rb +++ b/spec/models/tag_substitutions_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe TagSubstitution, warren: true do +describe TagSubstitution, :warren do # Works for: Library manifests, old tube pipelines # We have two samples, each with unique tags, which only exist # in aliquots identified by the library id. We don't need to consider: @@ -294,7 +294,7 @@ it 'return false and an error of the details don\'t match' do expect(subject.save).to be false - assert_includes subject.errors.full_messages, 'Substitution Matching aliquots could not be found' + assert_includes subject.errors.full_messages, 'Substitution ["Matching aliquots could not be found"]' end end @@ -333,9 +333,9 @@ it 'also update allow update of other attributes' do [library_aliquot_a, library_aliquot_b, mx_aliquot_a, mx_aliquot_b].each do |aliquot| aliquot.reload - assert_equal aliquot.library_type, library_type.name - assert_equal 20, aliquot.insert_size_from - assert_equal 400, aliquot.insert_size_to + expect(library_type.name).to eq(aliquot.library_type) + expect(aliquot.insert_size_from).to eq(20) + expect(aliquot.insert_size_to).to eq(400) end end end diff --git a/spec/models/transfer_request_collection_spec.rb b/spec/models/transfer_request_collection_spec.rb index 78ab920e41..e357ec1de5 100644 --- a/spec/models/transfer_request_collection_spec.rb +++ b/spec/models/transfer_request_collection_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe TransferRequestCollection, transfer_request_collection: true do +RSpec.describe TransferRequestCollection, :transfer_request_collection do subject { described_class.new(creation_attributes) } let(:user) { create :user } diff --git a/spec/models/well_attribute_spec.rb b/spec/models/well_attribute_spec.rb index 7ced37b697..d09f8755e9 100644 --- a/spec/models/well_attribute_spec.rb +++ b/spec/models/well_attribute_spec.rb @@ -17,7 +17,7 @@ expect(described_class.last.current_volume).to eq 1.0 end - it 'triggers warehouse message on well attribute update', warren: true do + it 'triggers warehouse message on well attribute update', :warren do current_message_count = Warren.handler.messages.count expect { well_attribute.update(concentration: 200) }.to change(Warren.handler.messages, :count).from( current_message_count diff --git a/spec/models/well_spec.rb b/spec/models/well_spec.rb index 9efdc52f58..2cd6989c94 100644 --- a/spec/models/well_spec.rb +++ b/spec/models/well_spec.rb @@ -181,62 +181,62 @@ result = described_class.hash_stock_with_targets(stock_plate.wells, purposes.map(&:name)) - assert_equal result.count, 3 - assert_equal result[stock_plate.wells[1].id].count, 1 - assert_equal result[stock_plate.wells[2].id].count, 1 - assert_equal result[stock_plate.wells[0].id].count, 3 + expect(result.count).to eq(3) + expect(result[stock_plate.wells[1].id].count).to eq(1) + expect(result[stock_plate.wells[2].id].count).to eq(1) + expect(result[stock_plate.wells[0].id].count).to eq(3) end it 'have pico pass' do well.well_attribute.pico_pass = 'Yes' - assert_equal 'Yes', well.get_pico_pass + expect(well.get_pico_pass).to eq('Yes') end it 'have gel pass' do well.well_attribute.gel_pass = 'Pass' - assert_equal 'Pass', well.get_gel_pass + expect(well.get_gel_pass).to eq('Pass') assert well.get_gel_pass.is_a?(String) end it 'have picked volume' do well.set_picked_volume(3.6) - assert_equal 3.6, well.get_picked_volume + expect(well.get_picked_volume).to eq(3.6) end it 'allow concentration to be set' do well.set_concentration(1.0) concentration = well.get_concentration - assert_equal 1.0, concentration + expect(concentration).to eq(1.0) assert concentration.is_a?(Float) end it 'allow volume to be set' do well.set_current_volume(2.5) vol = well.get_volume - assert_equal 2.5, vol + expect(vol).to eq(2.5) assert vol.is_a?(Float) end it 'allow current volume to be set' do well.set_current_volume(3.5) vol = well.get_current_volume - assert_equal 3.5, vol + expect(vol).to eq(3.5) assert vol.is_a?(Float) end it 'record the initial volume as initial_volume' do well.well_attribute.measured_volume = 3.5 vol = well.well_attribute.initial_volume - assert_equal 3.5, vol + expect(vol).to eq(3.5) well.well_attribute.measured_volume = 2.5 orig_vol = well.well_attribute.initial_volume - assert_equal 3.5, orig_vol + expect(orig_vol).to eq(3.5) end it 'allow buffer volume to be set' do well.set_buffer_volume(4.5) vol = well.get_buffer_volume - assert_equal 4.5, vol + expect(vol).to eq(4.5) assert vol.is_a?(Float) end @@ -249,14 +249,14 @@ it 'have a parent plate' do parent = well.plate assert parent.is_a?(Plate) - assert_equal parent.id, @plate.id + expect(@plate.id).to eq(parent.id) end context 'for a tecan' do it 'have a parent plate' do parent = well.plate assert parent.is_a?(Plate) - assert_equal parent.id, @plate.id + expect(@plate.id).to eq(parent.id) end end end @@ -298,14 +298,14 @@ # rubocop:disable Layout/LineLength it "output stock_to_pick #{stock_to_pick} for a target of #{target_ng} with vol #{measured_volume} and conc #{measured_concentration}" do - assert_equal stock_to_pick, @target_well.well_attribute.picked_volume + expect(@target_well.well_attribute.picked_volume).to eq(stock_to_pick) end # rubocop:enable Layout/LineLength # rubocop:disable Layout/LineLength it "output buffer #{buffer_added} for a target of #{target_ng} with vol #{measured_volume} and conc #{measured_concentration}" do - assert_equal buffer_added, @target_well.well_attribute.buffer_volume + expect(@target_well.well_attribute.buffer_volume).to eq(buffer_added) end # rubocop:enable Layout/LineLength end @@ -336,8 +336,8 @@ @source_well, robot_minimum_picking_volume ) - assert_equal stock_to_pick, @target_well.get_picked_volume - assert_equal buffer_added, @target_well.well_attribute.buffer_volume + expect(@target_well.get_picked_volume).to eq(stock_to_pick) + expect(@target_well.well_attribute.buffer_volume).to eq(buffer_added) end it "get correct buffer volume when it's above robot minimum picking volume" do @@ -352,8 +352,8 @@ @source_well, robot_minimum_picking_volume ) - assert_equal stock_to_pick, @target_well.get_picked_volume - assert_equal buffer_added, @target_well.well_attribute.buffer_volume + expect(@target_well.get_picked_volume).to eq(stock_to_pick) + expect(@target_well.well_attribute.buffer_volume).to eq(buffer_added) end it 'get no buffer volume if the minimum picking volume exceeds the minimum volume' do @@ -368,8 +368,8 @@ @source_well, robot_minimum_picking_volume ) - assert_equal stock_to_pick, @target_well.get_picked_volume - assert_equal buffer_added, @target_well.well_attribute.buffer_volume + expect(@target_well.get_picked_volume).to eq(stock_to_pick) + expect(@target_well.well_attribute.buffer_volume).to eq(buffer_added) end it 'get robot minimum picking volume if the correct buffer volume is below this value' do @@ -384,8 +384,8 @@ @source_well, robot_minimum_picking_volume ) - assert_equal stock_to_pick, @target_well.get_picked_volume - assert_equal buffer_added, @target_well.well_attribute.buffer_volume + expect(@target_well.get_picked_volume).to eq(stock_to_pick) + expect(@target_well.well_attribute.buffer_volume).to eq(buffer_added) end end end @@ -401,22 +401,22 @@ end it 'return volume to pick' do - assert_equal 1.25, well.volume_to_cherrypick_by_nano_grams_per_micro_litre(5.0, 50.0, 200.0, 20) - assert_equal 3.9, well.volume_to_cherrypick_by_nano_grams_per_micro_litre(13.0, 30.0, 100.0, 20) - assert_equal 9.1, well.get_buffer_volume + expect(well.volume_to_cherrypick_by_nano_grams_per_micro_litre(5.0, 50.0, 200.0, 20)).to eq(1.25) + expect(well.volume_to_cherrypick_by_nano_grams_per_micro_litre(13.0, 30.0, 100.0, 20)).to eq(3.9) + expect(well.get_buffer_volume).to eq(9.1) end it 'sets the buffer volume' do well.volume_to_cherrypick_by_nano_grams_per_micro_litre(5.0, 50.0, 200.0, 20) - assert_equal 3.75, well.get_buffer_volume + expect(well.get_buffer_volume).to eq(3.75) well.volume_to_cherrypick_by_nano_grams_per_micro_litre(13.0, 30.0, 100.0, 20) - assert_equal 9.1, well.get_buffer_volume + expect(well.get_buffer_volume).to eq(9.1) end it 'sets buffer and volume_to_pick correctly' do vol_to_pick = well.volume_to_cherrypick_by_nano_grams_per_micro_litre(5.0, 50.0, 200.0, 20) - assert_equal well.get_picked_volume, vol_to_pick - assert_equal 5.0, well.get_buffer_volume + vol_to_pick + expect(vol_to_pick).to eq(well.get_picked_volume) + expect(well.get_buffer_volume + vol_to_pick).to eq(5.0) end [ @@ -458,11 +458,11 @@ end it 'gets correct volume quantity' do - assert_equal source_volume_obtained, @result_volume + expect(@result_volume).to eq(source_volume_obtained) end it 'gets correct buffer volume measures' do - assert_equal buffer_volume_obtained, @result_buffer_volume + expect(@result_buffer_volume).to eq(buffer_volume_obtained) end end end @@ -502,7 +502,7 @@ end it 'report appropriate metrics' do - assert_equal [@expected_metric], well.latest_stock_metrics(@our_product_criteria.product) + expect(well.latest_stock_metrics(@our_product_criteria.product)).to eq([@expected_metric]) end end @@ -568,7 +568,7 @@ context '(DPL-148) on updating well attribute' do let(:well) { create :well } - it 'triggers warehouse update', warren: true do + it 'triggers warehouse update', :warren do expect do # We try a valid update well.well_attribute.update(concentration: 200) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index ad34daa5a1..4c85f7ed6a 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -32,7 +32,7 @@ # directory. Alternatively, in the individual `*_spec.rb` files, manually # require only the support files necessary. # -Dir[Rails.root.join('spec/support/**/*.rb')].sort.each { |f| require f } +Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } # Added with rails 6 update, the problem almost certainly exists elsewhere. ActiveRecord::Base.connection.reconnect! diff --git a/spec/requests/api/v2/heron/plates_spec.rb b/spec/requests/api/v2/heron/plates_spec.rb index b21ce30189..d10ce771c4 100644 --- a/spec/requests/api/v2/heron/plates_spec.rb +++ b/spec/requests/api/v2/heron/plates_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Plates Heron API', heron: true, heron_events: true, lighthouse: true, with: :api_v2 do +describe 'Plates Heron API', :heron, :heron_events, :lighthouse, with: :api_v2 do describe '#create' do include BarcodeHelper @@ -13,13 +13,13 @@ let(:purpose) { create(:plate_purpose, target_type: 'Plate', name: 'Stock Plate', size: '96') } let(:plate) do request - uuid = JSON.parse(response.body).dig('data', 'attributes', 'uuid') + uuid = response.parsed_body.dig('data', 'attributes', 'uuid') Plate.with_uuid(uuid).first end - let(:url_for_plate) { JSON.parse(response.body).dig('data', 'links', 'self') } + let(:url_for_plate) { response.parsed_body.dig('data', 'links', 'self') } let(:error_messages) do request - JSON.parse(response.body).dig('errors') + response.parsed_body.dig('errors') end shared_examples_for 'a successful plate creation' do @@ -151,8 +151,8 @@ it 'displays the error' do expect(error_messages).to eq( [ - 'Content a1 Asdf Unexisting field for sample or sample_metadata', - 'Content b1 Phenotype No other params can be added when sample uuid specified' + 'Content a1 ["Asdf Unexisting field for sample or sample_metadata"]', + 'Content b1 ["Phenotype No other params can be added when sample uuid specified"]' ] ) end @@ -175,12 +175,12 @@ it_behaves_like 'a failed plate creation' it 'displays the error' do - expect(error_messages).to eq(["Content a1 Study can't be blank"]) + expect(error_messages).to eq(["Content a1 [\"Study can't be blank\"]"]) end end context 'when there is an exception during plate creation' do - before { allow(::Sample).to receive(:with_uuid).with(sample.uuid).and_raise('BOOM!!') } + before { allow(Sample).to receive(:with_uuid).with(sample.uuid).and_raise('BOOM!!') } it 'does not create any plates' do expect(Plate.count).to eq(0) diff --git a/spec/requests/api/v2/heron/tube_racks_spec.rb b/spec/requests/api/v2/heron/tube_racks_spec.rb index 3c836a3860..4df9dd827d 100644 --- a/spec/requests/api/v2/heron/tube_racks_spec.rb +++ b/spec/requests/api/v2/heron/tube_racks_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'support/barcode_helper' -RSpec.describe 'TubeRacks Heron API', heron: true, lighthouse: true, with: :api_v2 do +RSpec.describe 'TubeRacks Heron API', :heron, :lighthouse, with: :api_v2 do let(:size) { 96 } let(:purpose) { create(:purpose, type: 'TubeRack::Purpose', target_type: 'TubeRack', size: 96) } @@ -17,10 +17,10 @@ let(:supplier_sample_ids) { %w[PHEC-nnnnnnn1 PHEC-nnnnnnn2] } let(:purpose_uuid) { purpose.uuid } let(:rack) do - uuid = JSON.parse(response.body).dig('data', 'attributes', 'uuid') + uuid = response.parsed_body.dig('data', 'attributes', 'uuid') TubeRack.with_uuid(uuid).first end - let(:url_for_rack) { JSON.parse(response.body).dig('data', 'links', 'self') } + let(:url_for_rack) { response.parsed_body.dig('data', 'links', 'self') } let(:tubes) do { @@ -64,7 +64,7 @@ it 'contains errors in the response' do request - expect(!JSON.parse(response.body)['errors'].empty?).to be_truthy + expect(!response.parsed_body['errors'].empty?).to be_truthy end end @@ -96,7 +96,7 @@ it 'writes the supplier name' do request expect( - ::Sample::Metadata + Sample::Metadata .joins(sample: { aliquots: { receptacle: :barcodes } }) .where(barcodes: { barcode: tubes_barcodes }) .map(&:supplier_name) @@ -130,7 +130,7 @@ it 'writes the control' do request expect( - ::Sample + Sample .joins(aliquots: { receptacle: :barcodes }) .where(barcodes: { barcode: tubes_barcodes }) .map(&:control) @@ -140,7 +140,7 @@ it 'writes the control type' do request expect( - ::Sample + Sample .joins(aliquots: { receptacle: :barcodes }) .where(barcodes: { barcode: tubes_barcodes }) .map(&:control_type) diff --git a/spec/requests/api/v2/pick_lists_spec.rb b/spec/requests/api/v2/pick_lists_spec.rb index 918d48ffbf..d4558a4a29 100644 --- a/spec/requests/api/v2/pick_lists_spec.rb +++ b/spec/requests/api/v2/pick_lists_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require './spec/requests/api/v2/shared_examples/api_key_authenticatable' -describe 'PickLists API', pick_list: true, with: :api_v2 do +describe 'PickLists API', :pick_list, with: :api_v2 do let(:base_endpoint) { '/api/v2/pick_lists' } it_behaves_like 'ApiKeyAuthenticatable' diff --git a/spec/requests/api/v2/plates_spec.rb b/spec/requests/api/v2/plates_spec.rb index 4b8a8afc19..1c14967345 100644 --- a/spec/requests/api/v2/plates_spec.rb +++ b/spec/requests/api/v2/plates_spec.rb @@ -17,7 +17,7 @@ let(:request) { api_post base_endpoint, payload } let(:plate) do request - uuid = JSON.parse(response.body).dig('data', 'attributes', 'uuid') + uuid = json.dig('data', 'attributes', 'uuid') Plate.with_uuid(uuid).first end @@ -99,7 +99,7 @@ context 'when the ancestor is a tube rack' do let(:purpose) { create(:plate_purpose, target_type: 'Plate', name: 'Stock Plate', size: '96') } let(:rack) { create :tube_rack } - let(:plate_factory) { ::Heron::Factories::PlateFromRack.new(tube_rack: rack, plate_purpose: purpose) } + let(:plate_factory) { Heron::Factories::PlateFromRack.new(tube_rack: rack, plate_purpose: purpose) } let(:tubes) { create_list(:sample_tube, 2) } include BarcodeHelper diff --git a/spec/requests/api/v2/qc_assays_spec.rb b/spec/requests/api/v2/qc_assays_spec.rb index 5051cb7dc4..a52268b506 100644 --- a/spec/requests/api/v2/qc_assays_spec.rb +++ b/spec/requests/api/v2/qc_assays_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require './spec/requests/api/v2/shared_examples/api_key_authenticatable' -RSpec.describe Api::V2::QcAssaysController, qc_result: true, with: :api_v2 do +RSpec.describe Api::V2::QcAssaysController, :qc_result, with: :api_v2 do let(:asset_1) { attributes_for(:qc_result).merge(uuid: create(:receptacle).uuid) } let(:asset_2) { attributes_for(:qc_result).merge(uuid: create(:receptacle).uuid) } let(:asset_3) { attributes_for(:qc_result).merge(uuid: create(:receptacle).uuid) } diff --git a/spec/requests/api/v2/qc_results_spec.rb b/spec/requests/api/v2/qc_results_spec.rb index 8a291b8b87..7936893685 100644 --- a/spec/requests/api/v2/qc_results_spec.rb +++ b/spec/requests/api/v2/qc_results_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require './spec/requests/api/v2/shared_examples/api_key_authenticatable' -RSpec.describe Api::V2::QcResultsController, qc_result: true, with: :api_v2 do +RSpec.describe Api::V2::QcResultsController, :qc_result, with: :api_v2 do let(:asset_invalid) { attributes_for(:qc_result) } let(:base_endpoint) { '/api/v2/qc_results' } diff --git a/spec/requests/plate_picks_request_spec.rb b/spec/requests/plate_picks_request_spec.rb index 437488e1f6..ebaa591159 100644 --- a/spec/requests/plate_picks_request_spec.rb +++ b/spec/requests/plate_picks_request_spec.rb @@ -58,7 +58,7 @@ get "/plate_picks/plates/#{plate.machine_barcode}", headers: headers expect(response.media_type).to eq('application/json') expect(response).to have_http_status(:success) - expect(JSON.parse(response.body)).to eq(found_plate) + expect(response.parsed_body).to eq(found_plate) end it 'returns 404 if the plate is missing', :aggregate_failures do @@ -81,7 +81,7 @@ get "/plate_picks/batches/#{released_cherrypick_batch.id}", headers: headers expect(response.media_type).to eq('application/json') expect(response).to have_http_status(:success) - expect(JSON.parse(response.body)).to eq(found_batch) + expect(response.parsed_body).to eq(found_batch) end it 'returns an error if the batch has no pick info', :aggregate_failures do diff --git a/spec/resources/api/v2/pick_list_resource_spec.rb b/spec/resources/api/v2/pick_list_resource_spec.rb index 987941c815..b3e2cfd4d6 100644 --- a/spec/resources/api/v2/pick_list_resource_spec.rb +++ b/spec/resources/api/v2/pick_list_resource_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require './app/resources/api/v2/pick_list_resource' -RSpec.describe Api::V2::PickListResource, pick_list: true, type: :resource do +RSpec.describe Api::V2::PickListResource, :pick_list, type: :resource do subject(:resource) { described_class.new(resource_model, {}) } let(:resource_model) { build_stubbed :pick_list } diff --git a/spec/resources/api/v2/tube_resource_spec.rb b/spec/resources/api/v2/tube_resource_spec.rb index 5f7f87eccf..ab049b52c1 100644 --- a/spec/resources/api/v2/tube_resource_spec.rb +++ b/spec/resources/api/v2/tube_resource_spec.rb @@ -9,7 +9,7 @@ let(:resource_model) { build_stubbed :tube, barcode_number: 1 } # Test attributes - it 'exposes the expected data', aggregate_failures: true do + it 'exposes the expected data', :aggregate_failures do expect(subject).to have_attribute :uuid expect(subject).to have_attribute :name expect(subject).not_to have_updatable_field(:id) diff --git a/spec/sample_manifest_excel/configuration_spec.rb b/spec/sample_manifest_excel/configuration_spec.rb index 81913d0a3b..a5df5ea5db 100644 --- a/spec/sample_manifest_excel/configuration_spec.rb +++ b/spec/sample_manifest_excel/configuration_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SampleManifestExcel::Configuration, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SampleManifestExcel::Configuration, :sample_manifest, :sample_manifest_excel, type: :model do let(:configuration) { described_class.new } it 'is comparable' do diff --git a/spec/sample_manifest_excel/download_spec.rb b/spec/sample_manifest_excel/download_spec.rb index 2d6d6c7842..bf634bd64f 100644 --- a/spec/sample_manifest_excel/download_spec.rb +++ b/spec/sample_manifest_excel/download_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SampleManifestExcel::Download, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SampleManifestExcel::Download, :sample_manifest, :sample_manifest_excel, type: :model do attr_reader :download, :spreadsheet let(:test_file) { 'test.xlsx' } diff --git a/spec/sample_manifest_excel/manifest_type_list_spec.rb b/spec/sample_manifest_excel/manifest_type_list_spec.rb index 756f2f586e..456deb8459 100644 --- a/spec/sample_manifest_excel/manifest_type_list_spec.rb +++ b/spec/sample_manifest_excel/manifest_type_list_spec.rb @@ -2,10 +2,7 @@ require 'rails_helper' -RSpec.describe SampleManifestExcel::ManifestTypeList, - sample_manifest: true, - sample_manifest_excel: true, - type: :model do +RSpec.describe SampleManifestExcel::ManifestTypeList, :sample_manifest, :sample_manifest_excel, type: :model do include SequencescapeExcel::Helpers let(:folder) { File.join('spec', 'data', 'sample_manifest_excel', 'extract') } diff --git a/spec/sample_manifest_excel/sample_manifest_excel_spec.rb b/spec/sample_manifest_excel/sample_manifest_excel_spec.rb index 028a4b36b4..15c698dbfc 100644 --- a/spec/sample_manifest_excel/sample_manifest_excel_spec.rb +++ b/spec/sample_manifest_excel/sample_manifest_excel_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SampleManifestExcel, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SampleManifestExcel, :sample_manifest, :sample_manifest_excel, type: :model do before do described_class.configure do |config| config.folder = File.join('spec', 'data', 'sample_manifest_excel') diff --git a/spec/sample_manifest_excel/tags_spec.rb b/spec/sample_manifest_excel/tags_spec.rb index 4e9e2d127e..4c85c3701e 100644 --- a/spec/sample_manifest_excel/tags_spec.rb +++ b/spec/sample_manifest_excel/tags_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SampleManifestExcel::Tags, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SampleManifestExcel::Tags, :sample_manifest, :sample_manifest_excel, type: :model do describe 'example_data' do let(:data) { SampleManifestExcel::Tags::ExampleData.new } diff --git a/spec/sample_manifest_excel/test_download_spec.rb b/spec/sample_manifest_excel/test_download_spec.rb index 6e4ba24323..12ee3fb207 100644 --- a/spec/sample_manifest_excel/test_download_spec.rb +++ b/spec/sample_manifest_excel/test_download_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SampleManifestExcel::TestDownload, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SampleManifestExcel::TestDownload, :sample_manifest, :sample_manifest_excel, type: :model do attr_reader :spreadsheet let(:test_file) { 'test.xlsx' } diff --git a/spec/sample_manifest_excel/upload/data_spec.rb b/spec/sample_manifest_excel/upload/data_spec.rb index e9a44bc43f..46e911bdc7 100644 --- a/spec/sample_manifest_excel/upload/data_spec.rb +++ b/spec/sample_manifest_excel/upload/data_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SampleManifestExcel::Upload::Data, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SampleManifestExcel::Upload::Data, :sample_manifest, :sample_manifest_excel, type: :model do before(:all) do SampleManifestExcel.configure do |config| config.folder = File.join('spec', 'data', 'sample_manifest_excel') diff --git a/spec/sample_manifest_excel/upload/processor_spec.rb b/spec/sample_manifest_excel/upload/processor_spec.rb index 70787e25d3..6decb49b75 100644 --- a/spec/sample_manifest_excel/upload/processor_spec.rb +++ b/spec/sample_manifest_excel/upload/processor_spec.rb @@ -904,7 +904,7 @@ def cell(row, column) .first(no_of_racks) .map { |scan_result| scan_result['layout'].keys } .flatten - tube_barcodes.reject! { |key| ::CsvParserClient.no_read?(key) } + tube_barcodes.reject! { |key| CsvParserClient.no_read?(key) } expect(barcodes.size).to eq(no_of_rows) expect(barcodes.map(&:barcode)).to eq(tube_barcodes) @@ -938,7 +938,7 @@ def cell(row, column) layout = mock_microservice_responses[tube_rack_barcode]['layout'] layout.each_key do |tube_barcode| - next if ::CsvParserClient.no_read?(tube_barcode) + next if CsvParserClient.no_read?(tube_barcode) tube = Barcode.find_by(barcode: tube_barcode).asset expect(tube.tube_rack).to eq(tube_rack) diff --git a/spec/sample_manifest_excel/upload/row_spec.rb b/spec/sample_manifest_excel/upload/row_spec.rb index bfd23604ce..3ab56dcdb6 100644 --- a/spec/sample_manifest_excel/upload/row_spec.rb +++ b/spec/sample_manifest_excel/upload/row_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SampleManifestExcel::Upload::Row, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SampleManifestExcel::Upload::Row, :sample_manifest, :sample_manifest_excel, type: :model do before do create(:library_type, name: 'My New Library Type') create(:reference_genome, name: 'My reference genome') diff --git a/spec/sample_manifest_excel/upload/rows_spec.rb b/spec/sample_manifest_excel/upload/rows_spec.rb index 4779ee2d8d..8d3ef7fa08 100644 --- a/spec/sample_manifest_excel/upload/rows_spec.rb +++ b/spec/sample_manifest_excel/upload/rows_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SampleManifestExcel::Upload::Rows, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SampleManifestExcel::Upload::Rows, :sample_manifest, :sample_manifest_excel, type: :model do before(:all) do SampleManifestExcel.configure do |config| config.folder = File.join('spec', 'data', 'sample_manifest_excel') diff --git a/spec/sample_manifest_excel/upload/upload_spec.rb b/spec/sample_manifest_excel/upload/upload_spec.rb index ef53fedf97..4833e3b5d5 100644 --- a/spec/sample_manifest_excel/upload/upload_spec.rb +++ b/spec/sample_manifest_excel/upload/upload_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SampleManifestExcel::Upload, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SampleManifestExcel::Upload, :sample_manifest, :sample_manifest_excel, type: :model do before(:all) do SampleManifestExcel.configure do |config| config.folder = File.join('spec', 'data', 'sample_manifest_excel') @@ -326,7 +326,7 @@ expect(upload).to be_processed end - context 'when accessioning is enabled', accessioning_enabled: true do + context 'when accessioning is enabled', :accessioning_enabled do it 'suppresses accessioning to allow explicit triggering after upload' do expect { upload.process(nil) }.not_to change(Delayed::Job, :count) end diff --git a/spec/sample_manifest_excel/worksheet_spec.rb b/spec/sample_manifest_excel/worksheet_spec.rb index 45b09d45f4..0c0b7bd512 100644 --- a/spec/sample_manifest_excel/worksheet_spec.rb +++ b/spec/sample_manifest_excel/worksheet_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SampleManifestExcel::Worksheet, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SampleManifestExcel::Worksheet, :sample_manifest, :sample_manifest_excel, type: :model do attr_reader :sample_manifest, :spreadsheet let(:xls) { Axlsx::Package.new } diff --git a/spec/sequencescape_excel/cell_spec.rb b/spec/sequencescape_excel/cell_spec.rb index c19b0530aa..e951e3ea52 100644 --- a/spec/sequencescape_excel/cell_spec.rb +++ b/spec/sequencescape_excel/cell_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SequencescapeExcel::Cell, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SequencescapeExcel::Cell, :sample_manifest, :sample_manifest_excel, type: :model do it 'creates a row' do expect(described_class.new(1, 4).row).to eq(1) end diff --git a/spec/sequencescape_excel/column_list_spec.rb b/spec/sequencescape_excel/column_list_spec.rb index a67b581ee0..cd2bd3affb 100644 --- a/spec/sequencescape_excel/column_list_spec.rb +++ b/spec/sequencescape_excel/column_list_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SequencescapeExcel::ColumnList, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SequencescapeExcel::ColumnList, :sample_manifest, :sample_manifest_excel, type: :model do include SequencescapeExcel::Helpers let(:folder) { File.join('spec', 'data', 'sample_manifest_excel', 'extract') } diff --git a/spec/sequencescape_excel/column_spec.rb b/spec/sequencescape_excel/column_spec.rb index 1b95ec69d2..9453a9c737 100644 --- a/spec/sequencescape_excel/column_spec.rb +++ b/spec/sequencescape_excel/column_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SequencescapeExcel::Column, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SequencescapeExcel::Column, :sample_manifest, :sample_manifest_excel, type: :model do let(:range_list) do build(:range_list, ranges_data: { attributes_for(:validation)[:range_name] => attributes_for(:range) }) end diff --git a/spec/sequencescape_excel/conditional_formatting_default_list_spec.rb b/spec/sequencescape_excel/conditional_formatting_default_list_spec.rb index 3d82f67963..c5a106a5cf 100644 --- a/spec/sequencescape_excel/conditional_formatting_default_list_spec.rb +++ b/spec/sequencescape_excel/conditional_formatting_default_list_spec.rb @@ -3,8 +3,8 @@ require 'rails_helper' RSpec.describe SequencescapeExcel::ConditionalFormattingDefaultList, - sample_manifest: true, - sample_manifest_excel: true, + :sample_manifest, + :sample_manifest_excel, type: :model do include SequencescapeExcel::Helpers diff --git a/spec/sequencescape_excel/conditional_formatting_default_spec.rb b/spec/sequencescape_excel/conditional_formatting_default_spec.rb index 0fda896a35..a6aa64603a 100644 --- a/spec/sequencescape_excel/conditional_formatting_default_spec.rb +++ b/spec/sequencescape_excel/conditional_formatting_default_spec.rb @@ -3,8 +3,8 @@ require 'rails_helper' RSpec.describe SequencescapeExcel::ConditionalFormattingDefault, - sample_manifest: true, - sample_manifest_excel: true, + :sample_manifest, + :sample_manifest_excel, type: :model do context 'basic' do let(:options) do diff --git a/spec/sequencescape_excel/conditional_formatting_list_spec.rb b/spec/sequencescape_excel/conditional_formatting_list_spec.rb index bee9d74b10..01dfe3d623 100644 --- a/spec/sequencescape_excel/conditional_formatting_list_spec.rb +++ b/spec/sequencescape_excel/conditional_formatting_list_spec.rb @@ -2,10 +2,7 @@ require 'rails_helper' -RSpec.describe SequencescapeExcel::ConditionalFormattingList, - sample_manifest: true, - sample_manifest_excel: true, - type: :model do +RSpec.describe SequencescapeExcel::ConditionalFormattingList, :sample_manifest, :sample_manifest_excel, type: :model do include SequencescapeExcel::Helpers let(:folder) { File.join('spec', 'data', 'sample_manifest_excel', 'extract') } diff --git a/spec/sequencescape_excel/conditional_formatting_spec.rb b/spec/sequencescape_excel/conditional_formatting_spec.rb index 58357f1c78..bfa5c1920d 100644 --- a/spec/sequencescape_excel/conditional_formatting_spec.rb +++ b/spec/sequencescape_excel/conditional_formatting_spec.rb @@ -2,10 +2,7 @@ require 'rails_helper' -RSpec.describe SequencescapeExcel::ConditionalFormatting, - sample_manifest: true, - sample_manifest_excel: true, - type: :model do +RSpec.describe SequencescapeExcel::ConditionalFormatting, :sample_manifest, :sample_manifest_excel, type: :model do let(:worksheet) { Axlsx::Workbook.new.add_worksheet } let(:rule) do { diff --git a/spec/sequencescape_excel/configuration_spec.rb b/spec/sequencescape_excel/configuration_spec.rb index 81913d0a3b..a5df5ea5db 100644 --- a/spec/sequencescape_excel/configuration_spec.rb +++ b/spec/sequencescape_excel/configuration_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SampleManifestExcel::Configuration, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SampleManifestExcel::Configuration, :sample_manifest, :sample_manifest_excel, type: :model do let(:configuration) { described_class.new } it 'is comparable' do diff --git a/spec/sequencescape_excel/formula_spec.rb b/spec/sequencescape_excel/formula_spec.rb index d39730f82c..3762d4a2a3 100644 --- a/spec/sequencescape_excel/formula_spec.rb +++ b/spec/sequencescape_excel/formula_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SequencescapeExcel::Formula, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SequencescapeExcel::Formula, :sample_manifest, :sample_manifest_excel, type: :model do let(:references) { build(:range).references } let(:options) { { type: :smooth, operator: '>', operand: 30 } } let(:formula) { described_class.new(options) } diff --git a/spec/sequencescape_excel/list_spec.rb b/spec/sequencescape_excel/list_spec.rb index e7120af627..8cc5f7657d 100644 --- a/spec/sequencescape_excel/list_spec.rb +++ b/spec/sequencescape_excel/list_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SequencescapeExcel::List, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SequencescapeExcel::List, :sample_manifest, :sample_manifest_excel, type: :model do class ListItem attr_reader :attr_a, :attr_b, :attr_c, :attr_d diff --git a/spec/sequencescape_excel/range_list_spec.rb b/spec/sequencescape_excel/range_list_spec.rb index d92704d9f4..e4fe5b5c59 100644 --- a/spec/sequencescape_excel/range_list_spec.rb +++ b/spec/sequencescape_excel/range_list_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SequencescapeExcel::RangeList, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SequencescapeExcel::RangeList, :sample_manifest, :sample_manifest_excel, type: :model do include SequencescapeExcel::Helpers let(:folder) { File.join('spec', 'data', 'sample_manifest_excel') } diff --git a/spec/sequencescape_excel/range_spec.rb b/spec/sequencescape_excel/range_spec.rb index ca2c8d5aad..49acf82e95 100644 --- a/spec/sequencescape_excel/range_spec.rb +++ b/spec/sequencescape_excel/range_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SequencescapeExcel::Range, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SequencescapeExcel::Range, :sample_manifest, :sample_manifest_excel, type: :model do let(:options) { %w[option1 option2 option3] } it 'is comparable' do @@ -88,51 +88,50 @@ it 'has identifier, scope, options' do assert range.identifier assert range.scope - assert_equal original_option_size, range.options.count + expect(range.options.count).to eq(original_option_size) end it 'has a first row' do - assert_equal 4, range.first_row + expect(range.first_row).to eq(4) end it 'sets the first column' do - assert_equal 1, range.first_column + expect(range.first_column).to eq(1) end it 'sets the last column' do - assert_equal original_option_size, range.last_column - assert_equal 3 + original_option_size, described_class.new(attributes.merge(first_column: 4)).last_column + expect(range.last_column).to eq(original_option_size) + expect(described_class.new(attributes.merge(first_column: 4)).last_column).to eq(3 + original_option_size) end it 'has a first_cell' do - assert_equal SequencescapeExcel::Cell.new(range.first_row, range.first_column), range.first_cell + expect(range.first_cell).to eq(SequencescapeExcel::Cell.new(range.first_row, range.first_column)) end it 'has a last_cell' do - assert_equal SequencescapeExcel::Cell.new(range.last_row, range.last_column), range.last_cell + expect(range.last_cell).to eq(SequencescapeExcel::Cell.new(range.last_row, range.last_column)) end it 'has a first cell reference' do - assert_equal range.first_cell.reference, range.first_cell_reference + expect(range.first_cell_reference).to eq(range.first_cell.reference) end it 'sets the reference' do - assert_equal "#{range.first_cell.reference}:#{range.last_cell.reference}", range.reference + expect(range.reference).to eq("#{range.first_cell.reference}:#{range.last_cell.reference}") end it 'sets the fixed reference' do - assert_equal "#{range.first_cell.fixed}:#{range.last_cell.fixed}", range.fixed_reference + expect(range.fixed_reference).to eq("#{range.first_cell.fixed}:#{range.last_cell.fixed}") end it '#references should return first_cell reference, reference, fixed_reference and absolute_reference' do - assert_equal( + expect(range.references).to eq( { first_cell_reference: range.first_cell_reference, reference: range.reference, fixed_reference: range.fixed_reference, absolute_reference: range.absolute_reference - }, - range.references + } ) end @@ -144,8 +143,8 @@ it 'adjusts to changes in option number' do previous_last_cell = range.last_cell.column create :library_type, name: 'Other' - assert_equal original_option_size + 1, range.last_column - assert_equal previous_last_cell.next, range.last_cell.column + expect(range.last_column).to eq(original_option_size + 1) + expect(range.last_cell.column).to eq(previous_last_cell.next) end end diff --git a/spec/sequencescape_excel/specialised_field_spec.rb b/spec/sequencescape_excel/specialised_field_spec.rb index 542828a9a4..5a1ff3e311 100644 --- a/spec/sequencescape_excel/specialised_field_spec.rb +++ b/spec/sequencescape_excel/specialised_field_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SequencescapeExcel::SpecialisedField, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SequencescapeExcel::SpecialisedField, :sample_manifest, :sample_manifest_excel, type: :model do let(:map) { create(:map) } let(:asset) { create(:untagged_well, map: map) } let(:asset2) { create(:untagged_well, map: map) } @@ -61,7 +61,7 @@ def self.name it 'will produce the correct error message' do my_perfect_class = class_with_base_and_value_required.new(value: nil) my_perfect_class.valid? - expect(my_perfect_class.errors.full_messages).to include('My perfect class can\'t be blank') + expect(my_perfect_class.errors.full_messages.join).to include('My perfect class can\'t be blank') end end @@ -688,7 +688,7 @@ def self.name it 'will not be valid if value does not match enum' do sf = described_class.new(value: '5', sample_manifest_asset: sample_manifest_asset) expect(sf).not_to be_valid - expect(sf.errors.full_messages).to include('the priority 5 was not recognised.') + expect(sf.errors.full_messages.join).to include('the priority 5 was not recognised.') end it 'will update the priority on the sample when present' do @@ -881,7 +881,7 @@ def self.name sf = described_class.new(value: nil, sample_manifest_asset: sample_manifest_asset) expect(sf).not_to be_valid - expect(sf.errors.full_messages).to include('Retention instruction can\'t be blank') + expect(sf.errors.full_messages.join).to include('Retention instruction can\'t be blank') end it 'will be valid if the value matches one of the expected values' do diff --git a/spec/sequencescape_excel/validation_spec.rb b/spec/sequencescape_excel/validation_spec.rb index 7f6c6c0bf0..2aa5248d56 100644 --- a/spec/sequencescape_excel/validation_spec.rb +++ b/spec/sequencescape_excel/validation_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe SequencescapeExcel::Validation, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SequencescapeExcel::Validation, :sample_manifest, :sample_manifest_excel, type: :model do let(:options) { { option1: 'value1', option2: 'value2', type: :whole, formula1: 'smth' }.freeze } let(:range) { build(:range) } let(:worksheet) { instance_double(Axlsx::Worksheet, add_data_validation: true) } diff --git a/spec/sequencescape_excel/worksheet_spec.rb b/spec/sequencescape_excel/worksheet_spec.rb index bdc9c166e5..16ba4e6cca 100644 --- a/spec/sequencescape_excel/worksheet_spec.rb +++ b/spec/sequencescape_excel/worksheet_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' require 'pry' -RSpec.describe SequencescapeExcel::Worksheet, sample_manifest: true, sample_manifest_excel: true, type: :model do +RSpec.describe SequencescapeExcel::Worksheet, :sample_manifest, :sample_manifest_excel, type: :model do attr_reader :sample_manifest, :spreadsheet let(:xls) { Axlsx::Package.new } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d865751e60..6a82929a29 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -59,6 +59,12 @@ the_driver end +Capybara.register_driver :selenium_chrome do |app| + driver = Capybara::Selenium::Driver.new(app, browser: :chrome) + driver.browser.download_path = DownloadHelpers::PATH.to_s + driver +end + Capybara.javascript_driver = ENV.fetch('JS_DRIVER', 'headless_chrome').to_sym Capybara.default_max_wait_time = 10 @@ -149,7 +155,7 @@ config.include UserLogin - config.around(:each, warren: true) do |ex| + config.around(:each, :warren) do |ex| Warren.handler.enable! ex.run Warren.handler.disable! @@ -166,7 +172,7 @@ # expect { upload.process(nil) }.not_to change(Delayed::Job, :count) # end # end - config.around(:each, accessioning_enabled: true) do |ex| + config.around(:each, :accessioning_enabled) do |ex| original_value = configatron.accession_samples original_config = Accession.configuration Accession.configure do |accession| @@ -185,9 +191,9 @@ FactoryBot.rewind_sequences end - config.before(:each, js: true) { page.driver.browser.manage.window.resize_to(1024, 1024) } + config.before(:each, :js) { page.driver.browser.manage.window.resize_to(1024, 1024) } - config.after(:each, js: true) do |example| + config.after(:each, :js) do |example| if example.exception name = example.full_description.gsub(/\s/, '_') CapybaraFailureLogger.log_failure(name, page) diff --git a/spec/tasks/create_mbrave_tags_spec.rb b/spec/tasks/create_mbrave_tags_spec.rb index 4713dd7962..9533765a6b 100644 --- a/spec/tasks/create_mbrave_tags_spec.rb +++ b/spec/tasks/create_mbrave_tags_spec.rb @@ -146,7 +146,7 @@ xit 'creates the right content in the yaml file' do run_task - contents = YAML.safe_load(File.read('mbrave.yml'), aliases: true) + contents = YAML.safe_load_file('mbrave.yml', aliases: true) expect(contents[Rails.env].keys).to eq( %w[Bioscan_forward_96_v1 Bioscan_reverse_4_1_v1 Bioscan_reverse_4_2_v1] ) diff --git a/spec/uat_actions/generate_project_spec.rb b/spec/uat_actions/generate_project_spec.rb index 8fe4142460..8d99d25a59 100644 --- a/spec/uat_actions/generate_project_spec.rb +++ b/spec/uat_actions/generate_project_spec.rb @@ -12,7 +12,7 @@ describe '#perform' do context 'when generating a project' do it 'generates a project' do - expect { uat_action.perform }.to(change { Project.all.count }.by(1)) + expect { uat_action.perform }.to(change(Project, :count).by(1)) end it 'creates the project with the correct data' do diff --git a/spec/uat_actions/generate_sample_manifest_spec.rb b/spec/uat_actions/generate_sample_manifest_spec.rb index 146022df02..b34ba1400e 100644 --- a/spec/uat_actions/generate_sample_manifest_spec.rb +++ b/spec/uat_actions/generate_sample_manifest_spec.rb @@ -29,11 +29,11 @@ let(:with_samples) { '1' } it 'generates tubes' do - expect { uat_action.perform }.to(change { Tube.all.count }.by(2)) + expect { uat_action.perform }.to(change(Tube, :count).by(2)) end it 'generates samples' do - expect { uat_action.perform }.to(change { Sample.all.count }.by(2)) + expect { uat_action.perform }.to(change(Sample, :count).by(2)) end it 'links to those samples' do @@ -46,11 +46,11 @@ let(:with_samples) { '0' } it 'generates tubes' do - expect { uat_action.perform }.to(change { Tube.all.count }.by(2)) + expect { uat_action.perform }.to(change(Tube, :count).by(2)) end it 'does not generate samples' do - expect { uat_action.perform }.not_to(change { Sample.all.count }) + expect { uat_action.perform }.not_to(change(Sample, :count)) end end end diff --git a/spec/uat_actions/generate_study_spec.rb b/spec/uat_actions/generate_study_spec.rb index 8a608ef256..9f4e302fa9 100644 --- a/spec/uat_actions/generate_study_spec.rb +++ b/spec/uat_actions/generate_study_spec.rb @@ -11,7 +11,7 @@ describe '#perform' do context 'when generating a study' do it 'generates a study' do - expect { uat_action.perform }.to(change { Study.all.count }.by(1)) + expect { uat_action.perform }.to(change(Study, :count).by(1)) end it 'creates the study with the correct data' do diff --git a/test/controllers/plates_controller_test.rb b/test/controllers/plates_controller_test.rb index c30b7a896d..18c8ae6eaa 100644 --- a/test/controllers/plates_controller_test.rb +++ b/test/controllers/plates_controller_test.rb @@ -106,7 +106,7 @@ class PlatesControllerTest < ActionController::TestCase @missing_barcode_create_params = { plates: { creator_id: @dilution_plates_creator.id, - source_plates: @plate_barcodes.concat(['missing']).join(','), + source_plates: @plate_barcodes.push('missing').join(','), barcode_printer: @barcode_printer.id, user_barcode: '1234567', create_asset_group: 'Yes' diff --git a/test/factories/location_report_factories.rb b/test/factories/location_report_factories.rb index 33f2b65e25..b20a02ea4a 100644 --- a/test/factories/location_report_factories.rb +++ b/test/factories/location_report_factories.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true FactoryBot.define do - factory :location_report, class: LocationReport do + factory :location_report, class: 'LocationReport' do user sequence(:name) { |n| "Location Report #{n}" } report_type { :type_selection } @@ -14,7 +14,7 @@ end end - factory(:location_report_form, class: LocationReport::LocationReportForm) do + factory(:location_report_form, class: 'LocationReport::LocationReportForm') do skip_create user diff --git a/test/shoulda_macros/sanger_macros/resource_test.rb b/test/shoulda_macros/sanger_macros/resource_test.rb index 17b50e2073..9e33d2163e 100644 --- a/test/shoulda_macros/sanger_macros/resource_test.rb +++ b/test/shoulda_macros/sanger_macros/resource_test.rb @@ -6,7 +6,6 @@ # elsewhere. # rubocop:disable Metrics/MethodLength # rubocop:disable Metrics/AbcSize -# rubocop:disable Metrics/ParameterLists module Sanger module Testing module Controller @@ -14,21 +13,20 @@ module Macros # rubocop:todo Metrics/ModuleLength RESTFUL_ACTIONS = %w[index new create show update destroy edit].freeze # rubocop:todo Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity - def resource_test( - resource_name, - ignore_actions: [], - actions: (RESTFUL_ACTIONS - ignore_actions), - with_prefix: '', - other_actions: [], - formats: %w[html xml json], - defaults: {}, - protect_on_update: [], - extra_on_update: {}, - parent: nil, - setup_with: nil, - teardown_with: nil, - user: :user - ) + def resource_test(resource_name, kwords) + ignore_actions = kwords[:ignore_actions] || [] + actions = kwords[:actions] || (RESTFUL_ACTIONS - ignore_actions) + with_prefix = kwords[:with_prefix] || '' + other_actions = kwords[:other_actions] || [] + formats = kwords[:formats] || %w[html xml json] + defaults = kwords[:defaults] || {} + protect_on_update = kwords[:protect_on_update] || [] + extra_on_update = kwords[:extra_on_update] || {} + parent = kwords[:parent] || nil + setup_with = kwords[:setup_with] || nil + teardown_with = kwords[:teardown_with] || nil + user = kwords[:user] || :user + resource_name = resource_name.to_sym untested_actions = (RESTFUL_ACTIONS - ignore_actions) - actions @@ -233,4 +231,4 @@ def resource_test( end end end -# rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Metrics/ParameterLists +# rubocop:enable Metrics/MethodLength, Metrics/AbcSize diff --git a/test/test_helper.rb b/test/test_helper.rb index d1dacdb0c8..f486ad20e8 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -22,10 +22,10 @@ end Dir.glob(File.expand_path(File.join(Rails.root, %w[spec factories ** *.rb]))) # rubocop:disable Rails/RootPathnameMethods - .sort.each { |factory_filename| require factory_filename } + .each { |factory_filename| require factory_filename } Dir.glob(File.expand_path(File.join(Rails.root, %w[test shoulda_macros *.rb]))) # rubocop:disable Rails/RootPathnameMethods - .sort.each { |macro_filename| require macro_filename } + .each { |macro_filename| require macro_filename } require "#{Rails.root}/test/unit/task_test_base" diff --git a/test/unit/cherrypick_task_test.rb b/test/unit/cherrypick_task_test.rb index b896d7499c..de5921fb2f 100644 --- a/test/unit/cherrypick_task_test.rb +++ b/test/unit/cherrypick_task_test.rb @@ -148,9 +148,9 @@ def maps_for(num, from = 0, order = 'column') (1..4).inject([]) do |plate, row| plate.tap do request = @requests[row - 1] - plate.concat([CherrypickTask::TEMPLATE_EMPTY_WELL]) + plate.push(CherrypickTask::TEMPLATE_EMPTY_WELL) plate.push([request.id, request.asset.plate.human_barcode, request.asset.map.description]) - plate.concat([CherrypickTask::EMPTY_WELL]) + plate.push(CherrypickTask::EMPTY_WELL) end end diff --git a/test/unit/request_factory_test.rb b/test/unit/request_factory_test.rb index 76c1febf28..5339e13433 100644 --- a/test/unit/request_factory_test.rb +++ b/test/unit/request_factory_test.rb @@ -51,7 +51,7 @@ class RequestcreateTest < ActiveSupport::TestCase context '.create_assets_requests' do setup do @study = create(:study) - @assets = [create(:sample_tube, study: nil, project: nil), create(:sample_tube, study: nil, project: nil)] + @assets = create_list(:sample_tube, 2, study: nil, project: nil) RequestFactory.create_assets_requests(@assets, @study) end