diff --git a/.github/workflows/automated_release.yml b/.github/workflows/automated_release.yml index 89d02913..db17c0d1 100644 --- a/.github/workflows/automated_release.yml +++ b/.github/workflows/automated_release.yml @@ -10,7 +10,7 @@ jobs: build-and-release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: nelonoel/branch-name@v1.0.1 diff --git a/.github/workflows/check_release_version.yml b/.github/workflows/check_release_version.yml index bd49a9ec..6dcdd828 100644 --- a/.github/workflows/check_release_version.yml +++ b/.github/workflows/check_release_version.yml @@ -7,21 +7,5 @@ on: - master jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Get specific changed files - id: changed-files-specific - uses: tj-actions/changed-files@v41 - with: - files: | - .release-version - - - name: Run step looking for change in the release version - run: >- - if ! "${{ steps.changed-files-specific.outputs.any_changed }}"; then - echo "Please change the release version number" - exit 1; - fi + check-release-version: + uses: sanger/.github/.github/workflows/check-release-version.yml@master diff --git a/.github/workflows/ruby_ci.yml b/.github/workflows/ruby_ci.yml index 14257ba2..479af512 100644 --- a/.github/workflows/ruby_ci.yml +++ b/.github/workflows/ruby_ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest env: TZ: Europe/London - DISPLAY: ':99.0' + #DISPLAY: ':99.0' # Services # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idservices services: @@ -17,36 +17,51 @@ jobs: # Use the Mysql docker image https://hub.docker.com/_/mysql image: mysql:8.0 ports: - - 3306:3306 # Default port mappings - # Monitor the health of the container to mesaure when it is ready + - 3306:3306 # Default port mappings + # Monitor the health of the container to mesaure when it is ready options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 env: - MYSQL_ROOT_PASSWORD: '' # Set root PW to nothing + MYSQL_ROOT_PASSWORD: "" # Set root PW to nothing MYSQL_ALLOW_EMPTY_PASSWORD: yes steps: - - uses: actions/checkout@v2 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 + - name: Checkout Repository + uses: sanger/.github/.github/actions/setup/checkout@master + + - name: Setup Ruby + uses: sanger/.github/.github/actions/setup/ruby@master + + - name: Setup stable Chrome + uses: sanger/.github/.github/actions/tests/setup-chrome@master with: - bundler-cache: true # Runs bundle install and caches gems. See the ruby_test.yml - # example if you need more control over bundler. - - name: Setup database - run: bundle exec rake db:setup - - name: Test & publish code coverage - uses: paambaati/codeclimate-action@v3.0.0 - env: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID || '5e399530a457db7a41cd5785ce0536b79e9022b3c2d4382f101310b3b166eb38' }} + chrome-version: 128 + install-chromedriver: true + install-dependencies: true + + - name: Additional setup + run: bin/setup + + - name: Run rspec + run: bundle exec rspec + + - name: Upload coverage reports to Codecov + uses: sanger/.github/.github/actions/tests/codecov@master with: - coverageCommand: bundle exec rspec + name: ${{ github.run_id }}_${{ github.job }}_${{ github.event_name }} + token: ${{ secrets.CODECOV_TOKEN }} + flags: ${{ github.event_name }} + disable-search: true + files: ${{ github.workspace }}/lcov.info + lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - bundler-cache: true # Runs bundle install and caches gems. See the ruby_test.yml - # example if you need more control over bundler. + bundler-cache: + true # Runs bundle install and caches gems. See the ruby_test.yml + # example if you need more control over bundler. - name: Lint run: bundle exec rubocop diff --git a/.release-version b/.release-version index 19811903..a5c4c763 100644 --- a/.release-version +++ b/.release-version @@ -1 +1 @@ -3.8.0 +3.9.0 diff --git a/.rubocop.yml b/.rubocop.yml index f6c69f84..6207239e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -9,10 +9,10 @@ # # See https://docs.rubocop.org/rubocop/configuration inherit_from: .rubocop_todo.yml -require: - - rubocop-performance - - rubocop-rails - - rubocop-rspec +plugins: + - rubocop-performance + - rubocop-rails + - rubocop-rspec AllCops: NewCops: enable SuggestExtensions: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4236bab3..098a2c5b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -9,27 +9,27 @@ # Offense count: 4 Lint/DuplicateMethods: Exclude: - - 'app/models/event.rb' - - 'app/models/report.rb' + - "app/models/event.rb" + - "app/models/report.rb" # Offense count: 7 Lint/MissingSuper: Exclude: - - 'app/presenters/asset_presenter/asset.rb' - - 'app/presenters/asset_presenter/index.rb' - - 'app/presenters/asset_type_presenter/asset_type.rb' - - 'app/presenters/batch_presenter/show.rb' - - 'app/presenters/report_presenter/new.rb' - - 'app/presenters/report_presenter/show.rb' - - 'app/presenters/workflow_presenter/show.rb' + - "app/presenters/asset_presenter/asset.rb" + - "app/presenters/asset_presenter/index.rb" + - "app/presenters/asset_type_presenter/asset_type.rb" + - "app/presenters/batch_presenter/show.rb" + - "app/presenters/report_presenter/new.rb" + - "app/presenters/report_presenter/show.rb" + - "app/presenters/workflow_presenter/show.rb" # Offense count: 6 Lint/UselessAssignment: Exclude: - - 'spec/models/batch_updater_spec.rb' - - 'spec/models/event_spec.rb' - - 'spec/models/report_spec.rb' - - 'spec/models/workflow_spec.rb' + - "spec/models/batch_updater_spec.rb" + - "spec/models/event_spec.rb" + - "spec/models/report_spec.rb" + - "spec/models/workflow_spec.rb" # Offense count: 4 # Configuration parameters: IgnoredMethods, CountRepeatedAttributes. @@ -57,14 +57,14 @@ Metrics/ParameterLists: # SupportedStylesForLeadingUnderscores: disallowed, required, optional Naming/MemoizedInstanceVariableName: Exclude: - - 'app/controllers/assets_controller.rb' + - "app/controllers/assets_controller.rb" # Offense count: 1 # Configuration parameters: EnforcedStyle, IgnoredPatterns. # SupportedStyles: snake_case, camelCase Naming/MethodName: Exclude: - - 'lib/client_side_validations.rb' + - "lib/client_side_validations.rb" # Offense count: 3 # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. @@ -72,10 +72,10 @@ Naming/MethodName: # ForbiddenPrefixes: is_, has_, have_ # AllowedMethods: is_a? # MethodDefinitionMacros: define_method, define_singleton_method -Naming/PredicateName: +Naming/PredicatePrefix: Exclude: - - 'app/presenters/asset/index.rb' - - 'app/presenters/asset_type/asset_type.rb' + - "app/presenters/asset/index.rb" + - "app/presenters/asset_type/asset_type.rb" # Offense count: 4 # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers. @@ -83,38 +83,38 @@ Naming/PredicateName: # AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339 Naming/VariableNumber: Exclude: - - 'spec/presenters/shared_presenter_behaviour.rb' + - "spec/support/shared_examples/shared_presenter_behaviour.rb" # Offense count: 1 # Cop supports --auto-correct. Performance/RangeInclude: Exclude: - - 'app/presenters/asset/asset.rb' + - "app/presenters/asset/asset.rb" # Offense count: 15 # Configuration parameters: Prefixes. # Prefixes: when, with, without RSpec/ContextWording: Exclude: - - 'spec/models/asset_spec.rb' - - 'spec/presenters/asset_index_presenter_spec.rb' - - 'spec/presenters/asset_presenter_spec.rb' - - 'spec/presenters/batch_new_presenter_spec.rb' - - 'spec/presenters/report_new_presenter_spec.rb' - - 'spec/presenters/report_show_presenter_spec.rb' + - "spec/models/asset_spec.rb" + - "spec/presenters/asset_index_presenter_spec.rb" + - "spec/presenters/asset_presenter_spec.rb" + - "spec/presenters/batch_new_presenter_spec.rb" + - "spec/presenters/report_new_presenter_spec.rb" + - "spec/presenters/report_show_presenter_spec.rb" # Offense count: 8 # Configuration parameters: IgnoredMetadata. RSpec/DescribeClass: Exclude: - - 'spec/features/create_and_edit_batch_spec.rb' - - 'spec/features/create_and_update_workflow_spec.rb' - - 'spec/features/create_complete_and_report_asset_standard_flow_spec.rb' - - 'spec/features/create_complete_and_report_assets_cherrypick_flow_spec.rb' - - 'spec/features/create_complete_and_report_assets_qc_flow_spec.rb' - - 'spec/features/create_pipeline_destination_spec.rb' - - 'spec/features/generate_report_spec.rb' - - 'spec/features/search_batch_and_assets_spec.rb' + - "spec/features/create_and_edit_batch_spec.rb" + - "spec/features/create_and_update_workflow_spec.rb" + - "spec/features/create_complete_and_report_asset_standard_flow_spec.rb" + - "spec/features/create_complete_and_report_assets_cherrypick_flow_spec.rb" + - "spec/features/create_complete_and_report_assets_qc_flow_spec.rb" + - "spec/features/create_pipeline_destination_spec.rb" + - "spec/features/generate_report_spec.rb" + - "spec/features/search_batch_and_assets_spec.rb" # Offense count: 44 # Cop supports --auto-correct. @@ -122,75 +122,77 @@ RSpec/DescribeClass: # SupportedStyles: described_class, explicit RSpec/DescribedClass: Exclude: - - 'spec/models/asset_spec.rb' - - 'spec/models/asset_type_spec.rb' - - 'spec/models/batch_creator_spec.rb' - - 'spec/models/batch_spec.rb' - - 'spec/models/batch_updater_spec.rb' - - 'spec/models/comment_spec.rb' - - 'spec/models/event_spec.rb' - - 'spec/models/report_spec.rb' - - 'spec/models/state_spec.rb' - - 'spec/models/workflow_spec.rb' - - 'spec/presenters/asset_index_presenter_spec.rb' - - 'spec/presenters/asset_presenter_spec.rb' - - 'spec/presenters/asset_type_presenter_spec.rb' - - 'spec/presenters/batch_new_presenter_spec.rb' - - 'spec/presenters/batch_show_presenter_spec.rb' - - 'spec/presenters/report_new_presenter_spec.rb' - - 'spec/presenters/report_show_presenter_spec.rb' + - "spec/models/asset_spec.rb" + - "spec/models/asset_type_spec.rb" + - "spec/models/batch_creator_spec.rb" + - "spec/models/batch_spec.rb" + - "spec/models/batch_updater_spec.rb" + - "spec/models/comment_spec.rb" + - "spec/models/event_spec.rb" + - "spec/models/report_spec.rb" + - "spec/models/state_spec.rb" + - "spec/models/workflow_spec.rb" + - "spec/presenters/asset_index_presenter_spec.rb" + - "spec/presenters/asset_presenter_spec.rb" + - "spec/presenters/asset_type_presenter_spec.rb" + - "spec/presenters/batch_new_presenter_spec.rb" + - "spec/presenters/batch_show_presenter_spec.rb" + - "spec/presenters/report_new_presenter_spec.rb" + - "spec/presenters/report_show_presenter_spec.rb" # Offense count: 36 # Configuration parameters: Max. RSpec/ExampleLength: Exclude: - - 'spec/features/create_and_edit_batch_spec.rb' - - 'spec/features/create_and_update_workflow_spec.rb' - - 'spec/features/create_complete_and_report_asset_standard_flow_spec.rb' - - 'spec/features/create_complete_and_report_assets_cherrypick_flow_spec.rb' - - 'spec/features/create_complete_and_report_assets_qc_flow_spec.rb' - - 'spec/features/create_pipeline_destination_spec.rb' - - 'spec/features/generate_report_spec.rb' - - 'spec/features/search_batch_and_assets_spec.rb' - - 'spec/models/asset_spec.rb' - - 'spec/models/asset_type_spec.rb' - - 'spec/models/batch_creator_spec.rb' - - 'spec/models/batch_spec.rb' - - 'spec/models/batch_updater_spec.rb' - - 'spec/models/event_spec.rb' - - 'spec/models/report_spec.rb' - - 'spec/models/workflow_spec.rb' - - 'spec/presenters/report_new_presenter_spec.rb' - - 'spec/presenters/report_show_presenter_spec.rb' - -# Offense count: 9 -# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. + - "spec/features/create_and_edit_batch_spec.rb" + - "spec/features/create_and_update_workflow_spec.rb" + - "spec/features/create_complete_and_report_asset_standard_flow_spec.rb" + - "spec/features/create_complete_and_report_assets_cherrypick_flow_spec.rb" + - "spec/features/create_complete_and_report_assets_qc_flow_spec.rb" + - "spec/features/create_pipeline_destination_spec.rb" + - "spec/features/generate_report_spec.rb" + - "spec/features/search_batch_and_assets_spec.rb" + - "spec/models/asset_spec.rb" + - "spec/models/asset_type_spec.rb" + - "spec/models/batch_creator_spec.rb" + - "spec/models/batch_spec.rb" + - "spec/models/batch_updater_spec.rb" + - "spec/models/event_spec.rb" + - "spec/models/report_spec.rb" + - "spec/models/workflow_spec.rb" + - "spec/presenters/report_new_presenter_spec.rb" + - "spec/presenters/report_show_presenter_spec.rb" + +# Offense count: 10 +# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly, EnforcedStyle. +# SupportedStyles: slashes, arguments # Include: **/*_spec*rb*, **/spec/**/* -RSpec/FilePath: - Exclude: - - 'spec/models/batch_creator_spec.rb' - - 'spec/models/batch_updater_spec.rb' - - 'spec/presenters/asset_index_presenter_spec.rb' - - 'spec/presenters/asset_presenter_spec.rb' - - 'spec/presenters/asset_type_presenter_spec.rb' - - 'spec/presenters/batch_new_presenter_spec.rb' - - 'spec/presenters/batch_show_presenter_spec.rb' - - 'spec/presenters/report_new_presenter_spec.rb' - - 'spec/presenters/report_show_presenter_spec.rb' +Rails/FilePath: + Exclude: + - "spec/models/batch_creator_spec.rb" + - "spec/models/batch_updater_spec.rb" + - "spec/presenters/asset_index_presenter_spec.rb" + - "spec/presenters/asset_presenter_spec.rb" + - "spec/presenters/asset_type_presenter_spec.rb" + - "spec/presenters/batch_new_presenter_spec.rb" + - "spec/presenters/batch_show_presenter_spec.rb" + - "spec/presenters/report_new_presenter_spec.rb" + - "spec/presenters/report_show_presenter_spec.rb" + - "config/application.rb" # Offense count: 59 RSpec/LetSetup: Exclude: - - 'spec/features/create_and_edit_batch_spec.rb' - - 'spec/features/create_complete_and_report_asset_standard_flow_spec.rb' - - 'spec/features/create_complete_and_report_assets_cherrypick_flow_spec.rb' - - 'spec/features/create_complete_and_report_assets_qc_flow_spec.rb' - - 'spec/features/generate_report_spec.rb' - - 'spec/features/search_batch_and_assets_spec.rb' - - 'spec/models/asset_spec.rb' - - 'spec/models/report_spec.rb' - - 'spec/presenters/report_show_presenter_spec.rb' - - 'spec/presenters/shared_presenter_behaviour.rb' + - "spec/features/create_and_edit_batch_spec.rb" + - "spec/features/create_complete_and_report_asset_standard_flow_spec.rb" + - "spec/features/create_complete_and_report_assets_cherrypick_flow_spec.rb" + - "spec/features/create_complete_and_report_assets_qc_flow_spec.rb" + - "spec/features/generate_report_spec.rb" + - "spec/features/search_batch_and_assets_spec.rb" + - "spec/models/asset_spec.rb" + - "spec/models/report_spec.rb" + - "spec/presenters/report_show_presenter_spec.rb" + - "spec/support/shared_examples/shared_presenter_behaviour.rb" # Offense count: 2 # Configuration parameters: . @@ -213,82 +215,82 @@ RSpec/MultipleMemoizedHelpers: # SupportedStyles: inflected, explicit RSpec/PredicateMatcher: Exclude: - - 'spec/models/asset_spec.rb' - - 'spec/models/batch_spec.rb' - - 'spec/presenters/asset_index_presenter_spec.rb' + - "spec/models/asset_spec.rb" + - "spec/models/batch_spec.rb" + - "spec/presenters/asset_index_presenter_spec.rb" # Offense count: 21 # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames. RSpec/VerifiedDoubles: Exclude: - - 'spec/presenters/asset_index_presenter_spec.rb' - - 'spec/presenters/asset_presenter_spec.rb' - - 'spec/presenters/batch_show_presenter_spec.rb' + - "spec/presenters/asset_index_presenter_spec.rb" + - "spec/presenters/asset_presenter_spec.rb" + - "spec/presenters/batch_show_presenter_spec.rb" # Offense count: 1 # Cop supports --auto-correct. Rails/ActiveRecordAliases: Exclude: - - 'db/migrate/20170306102500_update_states_and_workflows.rb' + - "db/migrate/20170306102500_update_states_and_workflows.rb" # Offense count: 2 # Configuration parameters: Include. # Include: db/migrate/*.rb Rails/CreateTableWithTimestamps: Exclude: - - 'db/migrate/20150528085213_add_pipeline_destination.rb' - - 'db/migrate/20150629160352_add_cost_code.rb' + - "db/migrate/20150528085213_add_pipeline_destination.rb" + - "db/migrate/20150629160352_add_cost_code.rb" # Offense count: 5 # Configuration parameters: EnforcedStyle. # SupportedStyles: strict, flexible Rails/Date: Exclude: - - 'spec/models/asset_spec.rb' - - 'spec/models/event_spec.rb' + - "spec/models/asset_spec.rb" + - "spec/models/event_spec.rb" -# Offense count: 1 -# Configuration parameters: EnforcedStyle. -# SupportedStyles: slashes, arguments -Rails/FilePath: - Exclude: - - 'config/application.rb' +# # Offense count: 1 +# # Configuration parameters: EnforcedStyle. +# # SupportedStyles: slashes, arguments +# Rails/FilePath: +# Exclude: +# - 'config/application.rb' # Offense count: 8 # Configuration parameters: Include. # Include: app/models/**/*.rb Rails/HasManyOrHasOneDependent: Exclude: - - 'app/models/asset_type.rb' - - 'app/models/batch.rb' - - 'app/models/comment.rb' - - 'app/models/cost_code.rb' - - 'app/models/pipeline_destination.rb' - - 'app/models/state.rb' - - 'app/models/workflow.rb' + - "app/models/asset_type.rb" + - "app/models/batch.rb" + - "app/models/comment.rb" + - "app/models/cost_code.rb" + - "app/models/pipeline_destination.rb" + - "app/models/state.rb" + - "app/models/workflow.rb" # Offense count: 1 # Configuration parameters: Include. # Include: app/controllers/**/*.rb Rails/LexicallyScopedActionFilter: Exclude: - - 'app/controllers/batches_controller.rb' + - "app/controllers/batches_controller.rb" # Offense count: 1 # Configuration parameters: Include. # Include: db/migrate/*.rb Rails/ReversibleMigration: Exclude: - - 'db/migrate/20190923141944_change_qc_flow_column_workflows_default.rb' + - "db/migrate/20190923141944_change_qc_flow_column_workflows_default.rb" # Offense count: 4 # Configuration parameters: Blacklist, Whitelist. # Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters Rails/SkipsModelValidations: Exclude: - - 'app/models/batch/updater.rb' - - 'db/migrate/20150624152208_migrate_begun_at.rb' - - 'db/migrate/20190923134849_update_qc_flow_column_workflows.rb' + - "app/models/batch/updater.rb" + - "db/migrate/20150624152208_migrate_begun_at.rb" + - "db/migrate/20190923134849_update_qc_flow_column_workflows.rb" # Offense count: 7 # Cop supports --auto-correct. @@ -296,31 +298,31 @@ Rails/SkipsModelValidations: # SupportedStyles: strict, flexible Rails/TimeZone: Exclude: - - 'spec/features/generate_report_spec.rb' - - 'spec/models/asset_spec.rb' - - 'spec/models/batch_creator_spec.rb' - - 'spec/models/batch_updater_spec.rb' - - 'spec/models/event_spec.rb' - - 'spec/models/report_spec.rb' - - 'spec/presenters/report_show_presenter_spec.rb' + - "spec/features/generate_report_spec.rb" + - "spec/models/asset_spec.rb" + - "spec/models/batch_creator_spec.rb" + - "spec/models/batch_updater_spec.rb" + - "spec/models/event_spec.rb" + - "spec/models/report_spec.rb" + - "spec/presenters/report_show_presenter_spec.rb" # Offense count: 5 # Configuration parameters: Include. # Include: app/models/**/*.rb Rails/UniqueValidationWithoutIndex: Exclude: - - 'app/models/asset_type.rb' - - 'app/models/cost_code.rb' - - 'app/models/pipeline_destination.rb' - - 'app/models/state.rb' - - 'app/models/workflow.rb' + - "app/models/asset_type.rb" + - "app/models/cost_code.rb" + - "app/models/pipeline_destination.rb" + - "app/models/state.rb" + - "app/models/workflow.rb" # Offense count: 1 # Cop supports --auto-correct. # Configuration parameters: AllowOnConstant. Style/CaseEquality: Exclude: - - 'config/initializers/01_proc.rb' + - "config/initializers/01_proc.rb" # Offense count: 9 # Cop supports --auto-correct. @@ -328,73 +330,73 @@ Style/CaseEquality: # SupportedStyles: nested, compact Style/ClassAndModuleChildren: Exclude: - - 'app/presenters/admin_presenter/index.rb' - - 'app/presenters/asset_presenter/asset.rb' - - 'app/presenters/asset_presenter/index.rb' - - 'app/presenters/asset_type_presenter/asset_type.rb' - - 'app/presenters/batch_presenter/new.rb' - - 'app/presenters/batch_presenter/show.rb' - - 'app/presenters/report_presenter/new.rb' - - 'app/presenters/report_presenter/show.rb' - - 'app/presenters/workflow_presenter/show.rb' + - "app/presenters/admin_presenter/index.rb" + - "app/presenters/asset_presenter/asset.rb" + - "app/presenters/asset_presenter/index.rb" + - "app/presenters/asset_type_presenter/asset_type.rb" + - "app/presenters/batch_presenter/new.rb" + - "app/presenters/batch_presenter/show.rb" + - "app/presenters/report_presenter/new.rb" + - "app/presenters/report_presenter/show.rb" + - "app/presenters/workflow_presenter/show.rb" # Offense count: 69 Style/Documentation: Exclude: - - 'app/controllers/admin_controller.rb' - - 'app/controllers/assets_controller.rb' - - 'app/controllers/batches_controller.rb' - - 'app/controllers/concerns/initial_state.rb' - - 'app/controllers/pipeline_destinations_controller.rb' - - 'app/controllers/reports_controller.rb' - - 'app/controllers/workflows_controller.rb' - - 'app/helpers/application_helper.rb' - - 'app/models/asset.rb' - - 'app/models/batch.rb' - - 'app/models/batch/creator.rb' - - 'app/models/batch/date_validator.rb' - - 'app/models/batch/updater.rb' - - 'app/models/comment.rb' - - 'app/models/concerns/state_machine.rb' - - 'app/models/event.rb' - - 'app/models/report.rb' - - 'app/models/workflow.rb' - - 'config/application.rb' - - 'config/data/asset_types.rb' - - 'config/data/pipeline_destinations.rb' - - 'config/data/states.rb' - - 'config/data/workflows.rb' - - 'db/migrate/20140527130308_create_asset_type_table.rb' - - 'db/migrate/20140527130314_create_asset_table.rb' - - 'db/migrate/20140527130320_create_batch_table.rb' - - 'db/migrate/20140527130331_create_workflow_types_table.rb' - - 'db/migrate/20140527130338_create_comments_table.rb' - - 'db/migrate/20140603152048_add_indexes_to_tables.rb' - - 'db/migrate/20140603152601_add_foreign_key_constraints.rb' - - 'db/migrate/20140807110338_add_reported_at_timestamp.rb' - - 'db/migrate/20140807111356_add_reportable_to_workflows.rb' - - 'db/migrate/20140807152237_add_data_type_to_asset_type.rb' - - 'db/migrate/20150528085213_add_pipeline_destination.rb' - - 'db/migrate/20150624152014_add_begun_at_timestamp.rb' - - 'db/migrate/20150624152208_migrate_begun_at.rb' - - 'db/migrate/20150624152719_add_constrains_on_begun_at.rb' - - 'db/migrate/20150629160352_add_cost_code.rb' - - 'db/migrate/20150630102003_add_turn_around_time_column_to_workflow.rb' - - 'db/migrate/20170302110500_create_state_table.rb' - - 'db/migrate/20170303130800_create_event_table.rb' - - 'db/migrate/20170305144300_add_initial_state_to_workflows.rb' - - 'db/migrate/20170306102500_update_states_and_workflows.rb' - - 'db/migrate/20170411114800_add_project_to_asset.rb' - - 'db/migrate/20190130131354_add_active_to_workflows.rb' - - 'db/migrate/20190801123806_add_labware_type_to_asset_types.rb' - - 'db/migrate/20190923133947_add_qc_flow_column_to_workflows.rb' - - 'db/migrate/20190923134849_update_qc_flow_column_workflows.rb' - - 'db/migrate/20190923135238_change_qc_flow_column_workflows_to_not_null.rb' - - 'db/migrate/20190923141944_change_qc_flow_column_workflows_default.rb' - - 'db/migrate/20190924154728_add_cherrypick_flow_to_workflows.rb' - - 'lib/client_side_validations.rb' - - 'lib/deployed_version.rb' - - 'lib/psd_formatter.rb' + - "app/controllers/admin_controller.rb" + - "app/controllers/assets_controller.rb" + - "app/controllers/batches_controller.rb" + - "app/controllers/concerns/initial_state.rb" + - "app/controllers/pipeline_destinations_controller.rb" + - "app/controllers/reports_controller.rb" + - "app/controllers/workflows_controller.rb" + - "app/helpers/application_helper.rb" + - "app/models/asset.rb" + - "app/models/batch.rb" + - "app/models/batch/creator.rb" + - "app/models/batch/date_validator.rb" + - "app/models/batch/updater.rb" + - "app/models/comment.rb" + - "app/models/concerns/state_machine.rb" + - "app/models/event.rb" + - "app/models/report.rb" + - "app/models/workflow.rb" + - "config/application.rb" + - "config/data/asset_types.rb" + - "config/data/pipeline_destinations.rb" + - "config/data/states.rb" + - "config/data/workflows.rb" + - "db/migrate/20140527130308_create_asset_type_table.rb" + - "db/migrate/20140527130314_create_asset_table.rb" + - "db/migrate/20140527130320_create_batch_table.rb" + - "db/migrate/20140527130331_create_workflow_types_table.rb" + - "db/migrate/20140527130338_create_comments_table.rb" + - "db/migrate/20140603152048_add_indexes_to_tables.rb" + - "db/migrate/20140603152601_add_foreign_key_constraints.rb" + - "db/migrate/20140807110338_add_reported_at_timestamp.rb" + - "db/migrate/20140807111356_add_reportable_to_workflows.rb" + - "db/migrate/20140807152237_add_data_type_to_asset_type.rb" + - "db/migrate/20150528085213_add_pipeline_destination.rb" + - "db/migrate/20150624152014_add_begun_at_timestamp.rb" + - "db/migrate/20150624152208_migrate_begun_at.rb" + - "db/migrate/20150624152719_add_constrains_on_begun_at.rb" + - "db/migrate/20150629160352_add_cost_code.rb" + - "db/migrate/20150630102003_add_turn_around_time_column_to_workflow.rb" + - "db/migrate/20170302110500_create_state_table.rb" + - "db/migrate/20170303130800_create_event_table.rb" + - "db/migrate/20170305144300_add_initial_state_to_workflows.rb" + - "db/migrate/20170306102500_update_states_and_workflows.rb" + - "db/migrate/20170411114800_add_project_to_asset.rb" + - "db/migrate/20190130131354_add_active_to_workflows.rb" + - "db/migrate/20190801123806_add_labware_type_to_asset_types.rb" + - "db/migrate/20190923133947_add_qc_flow_column_to_workflows.rb" + - "db/migrate/20190923134849_update_qc_flow_column_workflows.rb" + - "db/migrate/20190923135238_change_qc_flow_column_workflows_to_not_null.rb" + - "db/migrate/20190923141944_change_qc_flow_column_workflows_default.rb" + - "db/migrate/20190924154728_add_cherrypick_flow_to_workflows.rb" + - "lib/client_side_validations.rb" + - "lib/deployed_version.rb" + - "lib/psd_formatter.rb" # Offense count: 121 # Cop supports --auto-correct. @@ -402,144 +404,144 @@ Style/Documentation: # SupportedStyles: always, always_true, never Style/FrozenStringLiteralComment: Exclude: - - 'Gemfile' - - 'Rakefile' - - 'app/controllers/admin_controller.rb' - - 'app/controllers/application_controller.rb' - - 'app/controllers/assets_controller.rb' - - 'app/controllers/batches_controller.rb' - - 'app/controllers/concerns/initial_state.rb' - - 'app/controllers/pipeline_destinations_controller.rb' - - 'app/controllers/reports_controller.rb' - - 'app/controllers/workflows_controller.rb' - - 'app/helpers/application_helper.rb' - - 'app/models/asset.rb' - - 'app/models/asset_type.rb' - - 'app/models/batch.rb' - - 'app/models/batch/creator.rb' - - 'app/models/batch/date_validator.rb' - - 'app/models/batch/updater.rb' - - 'app/models/comment.rb' - - 'app/models/concerns/state_machine.rb' - - 'app/models/cost_code.rb' - - 'app/models/event.rb' - - 'app/models/pipeline_destination.rb' - - 'app/models/report.rb' - - 'app/models/state.rb' - - 'app/models/workflow.rb' - - 'app/presenters/report_presenter/show.rb' - - 'config.ru' - - 'config/application.rb' - - 'config/boot.rb' - - 'config/data/pipeline_destinations.rb' - - 'config/data/states.rb' - - 'config/data/workflows.rb' - - 'config/environment.rb' - - 'config/environments/development.rb' - - 'config/environments/production.rb' - - 'config/environments/test.rb' - - 'config/initializers/01_proc.rb' - - 'config/initializers/asset_types.rb' - - 'config/initializers/assets.rb' - - 'config/initializers/backtrace_silencers.rb' - - 'config/initializers/cookies_serializer.rb' - - 'config/initializers/filter_parameter_logging.rb' - - 'config/initializers/inflections.rb' - - 'config/initializers/mime_types.rb' - - 'config/initializers/pipeline_destinations.rb' - - 'config/initializers/session_store.rb' - - 'config/initializers/states.rb' - - 'config/initializers/workflows.rb' - - 'config/initializers/wrap_parameters.rb' - - 'config/routes.rb' - - 'db/migrate/20140527130308_create_asset_type_table.rb' - - 'db/migrate/20140527130314_create_asset_table.rb' - - 'db/migrate/20140527130320_create_batch_table.rb' - - 'db/migrate/20140527130331_create_workflow_types_table.rb' - - 'db/migrate/20140527130338_create_comments_table.rb' - - 'db/migrate/20140603152048_add_indexes_to_tables.rb' - - 'db/migrate/20140603152601_add_foreign_key_constraints.rb' - - 'db/migrate/20140807110338_add_reported_at_timestamp.rb' - - 'db/migrate/20140807111356_add_reportable_to_workflows.rb' - - 'db/migrate/20140807152237_add_data_type_to_asset_type.rb' - - 'db/migrate/20150528085213_add_pipeline_destination.rb' - - 'db/migrate/20150624152014_add_begun_at_timestamp.rb' - - 'db/migrate/20150624152208_migrate_begun_at.rb' - - 'db/migrate/20150624152719_add_constrains_on_begun_at.rb' - - 'db/migrate/20150629160352_add_cost_code.rb' - - 'db/migrate/20150630102003_add_turn_around_time_column_to_workflow.rb' - - 'db/migrate/20170302110500_create_state_table.rb' - - 'db/migrate/20170303130800_create_event_table.rb' - - 'db/migrate/20170305144300_add_initial_state_to_workflows.rb' - - 'db/migrate/20170306102500_update_states_and_workflows.rb' - - 'db/migrate/20170411114800_add_project_to_asset.rb' - - 'db/migrate/20190130131354_add_active_to_workflows.rb' - - 'db/migrate/20190801123806_add_labware_type_to_asset_types.rb' - - 'db/migrate/20190923133947_add_qc_flow_column_to_workflows.rb' - - 'db/migrate/20190923134849_update_qc_flow_column_workflows.rb' - - 'db/migrate/20190923135238_change_qc_flow_column_workflows_to_not_null.rb' - - 'db/migrate/20190923141944_change_qc_flow_column_workflows_default.rb' - - 'db/migrate/20190924154728_add_cherrypick_flow_to_workflows.rb' - - 'db/seeds.rb' - - 'lib/client_side_validations.rb' - - 'lib/tasks/build_assets.rake' - - 'lib/tasks/create_states.rake' - - 'lib/tasks/update_asset_types.rake' - - 'lib/utils/dependent_loader.rb' - - 'spec/factories/asset_factories.rb' - - 'spec/factories/asset_type_factories.rb' - - 'spec/factories/batch_factories.rb' - - 'spec/factories/cost_code_factories.rb' - - 'spec/factories/event_factories.rb' - - 'spec/factories/pipeline_destination_factories.rb' - - 'spec/factories/state_factories.rb' - - 'spec/factories/workflow_factories.rb' - - 'spec/models/asset_spec.rb' - - 'spec/models/asset_type_spec.rb' - - 'spec/models/batch_creator_spec.rb' - - 'spec/models/batch_spec.rb' - - 'spec/models/batch_updater_spec.rb' - - 'spec/models/comment_spec.rb' - - 'spec/models/event_spec.rb' - - 'spec/models/report_spec.rb' - - 'spec/models/state_spec.rb' - - 'spec/models/workflow_spec.rb' - - 'spec/presenters/asset_index_presenter_spec.rb' - - 'spec/presenters/asset_presenter_spec.rb' - - 'spec/presenters/asset_type_presenter_spec.rb' - - 'spec/presenters/batch_new_presenter_spec.rb' - - 'spec/presenters/batch_show_presenter_spec.rb' - - 'spec/presenters/report_new_presenter_spec.rb' - - 'spec/presenters/report_show_presenter_spec.rb' - - 'spec/presenters/shared_presenter_behaviour.rb' - - 'spec/rails_helper.rb' - - 'spec/spec_helper.rb' + - "Gemfile" + - "Rakefile" + - "app/controllers/admin_controller.rb" + - "app/controllers/application_controller.rb" + - "app/controllers/assets_controller.rb" + - "app/controllers/batches_controller.rb" + - "app/controllers/concerns/initial_state.rb" + - "app/controllers/pipeline_destinations_controller.rb" + - "app/controllers/reports_controller.rb" + - "app/controllers/workflows_controller.rb" + - "app/helpers/application_helper.rb" + - "app/models/asset.rb" + - "app/models/asset_type.rb" + - "app/models/batch.rb" + - "app/models/batch/creator.rb" + - "app/models/batch/date_validator.rb" + - "app/models/batch/updater.rb" + - "app/models/comment.rb" + - "app/models/concerns/state_machine.rb" + - "app/models/cost_code.rb" + - "app/models/event.rb" + - "app/models/pipeline_destination.rb" + - "app/models/report.rb" + - "app/models/state.rb" + - "app/models/workflow.rb" + - "app/presenters/report_presenter/show.rb" + - "config.ru" + - "config/application.rb" + - "config/boot.rb" + - "config/data/pipeline_destinations.rb" + - "config/data/states.rb" + - "config/data/workflows.rb" + - "config/environment.rb" + - "config/environments/development.rb" + - "config/environments/production.rb" + - "config/environments/test.rb" + - "config/initializers/01_proc.rb" + - "config/initializers/asset_types.rb" + - "config/initializers/assets.rb" + - "config/initializers/backtrace_silencers.rb" + - "config/initializers/cookies_serializer.rb" + - "config/initializers/filter_parameter_logging.rb" + - "config/initializers/inflections.rb" + - "config/initializers/mime_types.rb" + - "config/initializers/pipeline_destinations.rb" + - "config/initializers/session_store.rb" + - "config/initializers/states.rb" + - "config/initializers/workflows.rb" + - "config/initializers/wrap_parameters.rb" + - "config/routes.rb" + - "db/migrate/20140527130308_create_asset_type_table.rb" + - "db/migrate/20140527130314_create_asset_table.rb" + - "db/migrate/20140527130320_create_batch_table.rb" + - "db/migrate/20140527130331_create_workflow_types_table.rb" + - "db/migrate/20140527130338_create_comments_table.rb" + - "db/migrate/20140603152048_add_indexes_to_tables.rb" + - "db/migrate/20140603152601_add_foreign_key_constraints.rb" + - "db/migrate/20140807110338_add_reported_at_timestamp.rb" + - "db/migrate/20140807111356_add_reportable_to_workflows.rb" + - "db/migrate/20140807152237_add_data_type_to_asset_type.rb" + - "db/migrate/20150528085213_add_pipeline_destination.rb" + - "db/migrate/20150624152014_add_begun_at_timestamp.rb" + - "db/migrate/20150624152208_migrate_begun_at.rb" + - "db/migrate/20150624152719_add_constrains_on_begun_at.rb" + - "db/migrate/20150629160352_add_cost_code.rb" + - "db/migrate/20150630102003_add_turn_around_time_column_to_workflow.rb" + - "db/migrate/20170302110500_create_state_table.rb" + - "db/migrate/20170303130800_create_event_table.rb" + - "db/migrate/20170305144300_add_initial_state_to_workflows.rb" + - "db/migrate/20170306102500_update_states_and_workflows.rb" + - "db/migrate/20170411114800_add_project_to_asset.rb" + - "db/migrate/20190130131354_add_active_to_workflows.rb" + - "db/migrate/20190801123806_add_labware_type_to_asset_types.rb" + - "db/migrate/20190923133947_add_qc_flow_column_to_workflows.rb" + - "db/migrate/20190923134849_update_qc_flow_column_workflows.rb" + - "db/migrate/20190923135238_change_qc_flow_column_workflows_to_not_null.rb" + - "db/migrate/20190923141944_change_qc_flow_column_workflows_default.rb" + - "db/migrate/20190924154728_add_cherrypick_flow_to_workflows.rb" + - "db/seeds.rb" + - "lib/client_side_validations.rb" + - "lib/tasks/build_assets.rake" + - "lib/tasks/create_states.rake" + - "lib/tasks/update_asset_types.rake" + - "lib/utils/dependent_loader.rb" + - "spec/factories/asset_factories.rb" + - "spec/factories/asset_type_factories.rb" + - "spec/factories/batch_factories.rb" + - "spec/factories/cost_code_factories.rb" + - "spec/factories/event_factories.rb" + - "spec/factories/pipeline_destination_factories.rb" + - "spec/factories/state_factories.rb" + - "spec/factories/workflow_factories.rb" + - "spec/models/asset_spec.rb" + - "spec/models/asset_type_spec.rb" + - "spec/models/batch_creator_spec.rb" + - "spec/models/batch_spec.rb" + - "spec/models/batch_updater_spec.rb" + - "spec/models/comment_spec.rb" + - "spec/models/event_spec.rb" + - "spec/models/report_spec.rb" + - "spec/models/state_spec.rb" + - "spec/models/workflow_spec.rb" + - "spec/presenters/asset_index_presenter_spec.rb" + - "spec/presenters/asset_presenter_spec.rb" + - "spec/presenters/asset_type_presenter_spec.rb" + - "spec/presenters/batch_new_presenter_spec.rb" + - "spec/presenters/batch_show_presenter_spec.rb" + - "spec/presenters/report_new_presenter_spec.rb" + - "spec/presenters/report_show_presenter_spec.rb" + - "spec/support/shared_examples/shared_presenter_behaviour.rb" + - "spec/rails_helper.rb" + - "spec/spec_helper.rb" # Offense count: 3 # Configuration parameters: MinBodyLength. Style/GuardClause: Exclude: - - 'app/models/concerns/state_machine.rb' - - 'app/presenters/batch/show.rb' - - 'lib/utils/dependent_loader.rb' + - "app/models/concerns/state_machine.rb" + - "app/presenters/batch/show.rb" + - "lib/utils/dependent_loader.rb" # Offense count: 2 # Cop supports --auto-correct. Style/IfUnlessModifier: Exclude: - - 'app/presenters/asset/asset.rb' + - "app/presenters/asset/asset.rb" # Offense count: 19 # Cop supports --auto-correct. Style/LineEndConcatenation: Exclude: - - 'app/presenters/report/show.rb' - - 'spec/presenters/report_show_presenter_spec.rb' + - "app/presenters/report/show.rb" + - "spec/presenters/report_show_presenter_spec.rb" # Offense count: 1 Style/MissingRespondToMissing: Exclude: - - 'config/initializers/01_proc.rb' + - "config/initializers/01_proc.rb" # Offense count: 3 # Cop supports --auto-correct. @@ -547,8 +549,8 @@ Style/MissingRespondToMissing: # SupportedStyles: literals, strict Style/MutableConstant: Exclude: - - 'app/models/concerns/state_machine.rb' - - 'app/presenters/asset_type/asset_type.rb' + - "app/models/concerns/state_machine.rb" + - "app/presenters/asset_type/asset_type.rb" # Offense count: 6 # Cop supports --auto-correct. @@ -556,10 +558,10 @@ Style/MutableConstant: # SupportedStyles: predicate, comparison Style/NumericPredicate: Exclude: - - 'app/controllers/batches_controller.rb' - - 'app/presenters/asset/asset.rb' - - 'app/presenters/asset/index.rb' - - 'lib/deployed_version.rb' + - "app/controllers/batches_controller.rb" + - "app/presenters/asset/asset.rb" + - "app/presenters/asset/index.rb" + - "lib/deployed_version.rb" # Offense count: 1 # Cop supports --auto-correct. @@ -567,15 +569,15 @@ Style/NumericPredicate: # AllowedMethods: present?, blank?, presence, try, try! Style/SafeNavigation: Exclude: - - 'app/presenters/batch/show.rb' + - "app/presenters/batch/show.rb" # Offense count: 6 # Cop supports --auto-correct. Style/StringConcatenation: Exclude: - - 'app/presenters/asset/asset.rb' - - 'app/presenters/report/show.rb' - - 'spec/presenters/report_show_presenter_spec.rb' + - "app/presenters/asset/asset.rb" + - "app/presenters/report/show.rb" + - "spec/presenters/report_show_presenter_spec.rb" # Offense count: 3 # Cop supports --auto-correct. @@ -583,21 +585,32 @@ Style/StringConcatenation: # IgnoredMethods: respond_to, define_method Style/SymbolProc: Exclude: - - 'app/models/asset.rb' - - 'app/models/comment.rb' - - 'db/migrate/20140527130320_create_batch_table.rb' + - "app/models/asset.rb" + - "app/models/comment.rb" + - "db/migrate/20140527130320_create_batch_table.rb" # Offense count: 2 # Cop supports --auto-correct. Style/ZeroLengthPredicate: Exclude: - - 'app/controllers/batches_controller.rb' - - 'app/presenters/asset/index.rb' + - "app/controllers/batches_controller.rb" + - "app/presenters/asset/index.rb" Rails/ThreeStateBooleanColumn: Exclude: - - 'db/migrate/20190923133947_add_qc_flow_column_to_workflows.rb' + - "db/migrate/20190923133947_add_qc_flow_column_to_workflows.rb" Layout/LineLength: Exclude: - - 'config/initializers/new_framework_defaults_7_0.rb' + - "config/initializers/new_framework_defaults_7_0.rb" + +Naming/PredicateMethod: + Exclude: + - "app/controllers/assets_controller.rb" + - "app/models/asset.rb" + - "app/presenters/asset_type_presenter/asset_type.rb" + - "config/initializers/01_proc.rb" + +RSpec/IncludeExamples: + Exclude: + - "spec/presenters/asset_presenter_spec.rb" diff --git a/.ruby-version b/.ruby-version index 944880fa..2aa51319 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.0 +3.4.7 diff --git a/Gemfile b/Gemfile index 5d724ccd..d7bb6b5e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 7.0.8' +gem 'rails', '~> 7.2.2' # Use mysql2 as the database for Active Record gem 'mysql2' # Use SCSS for stylesheets @@ -11,6 +11,11 @@ gem 'net-imap', require: false gem 'net-pop', require: false gem 'net-smtp' +gem 'syslog' +gem 'syslog-logger' + +gem 'csv' + # Use jquery as the JavaScript library gem 'jquery-rails' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks @@ -45,7 +50,7 @@ end group :development do # Access an IRB console on exception pages or by using <%= console %> in views - gem 'web-console', '~> 4.0.4' + gem 'web-console', '~> 4.2.1' # displays speed badge for every html page gem 'rack-mini-profiler' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring @@ -63,8 +68,9 @@ group :test do gem 'factory_bot' gem 'launchy' gem 'rspec-collection_matchers' - gem 'rspec-rails', '~> 3.5.0' - gem 'selenium-webdriver', require: false + gem 'rspec-rails' + gem 'selenium-webdriver' gem 'simplecov', require: false + gem 'simplecov-lcov', require: false gem 'timecop' end diff --git a/Gemfile.lock b/Gemfile.lock index 77726f91..146951f8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,77 +1,87 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8.1) - actionpack (= 7.0.8.1) - activesupport (= 7.0.8.1) + actioncable (7.2.3) + actionpack (= 7.2.3) + activesupport (= 7.2.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8.1) - actionpack (= 7.0.8.1) - activejob (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.0.8.1) - actionpack (= 7.0.8.1) - actionview (= 7.0.8.1) - activejob (= 7.0.8.1) - activesupport (= 7.0.8.1) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.8.1) - actionview (= 7.0.8.1) - activesupport (= 7.0.8.1) - rack (~> 2.0, >= 2.2.4) + zeitwerk (~> 2.6) + actionmailbox (7.2.3) + actionpack (= 7.2.3) + activejob (= 7.2.3) + activerecord (= 7.2.3) + activestorage (= 7.2.3) + activesupport (= 7.2.3) + mail (>= 2.8.0) + actionmailer (7.2.3) + actionpack (= 7.2.3) + actionview (= 7.2.3) + activejob (= 7.2.3) + activesupport (= 7.2.3) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (7.2.3) + actionview (= 7.2.3) + activesupport (= 7.2.3) + cgi + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4, < 3.3) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.8.1) - actionpack (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (7.2.3) + actionpack (= 7.2.3) + activerecord (= 7.2.3) + activestorage (= 7.2.3) + activesupport (= 7.2.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8.1) - activesupport (= 7.0.8.1) + actionview (7.2.3) + activesupport (= 7.2.3) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.8.1) - activesupport (= 7.0.8.1) + cgi + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.2.3) + activesupport (= 7.2.3) globalid (>= 0.3.6) - activemodel (7.0.8.1) - activesupport (= 7.0.8.1) - activerecord (7.0.8.1) - activemodel (= 7.0.8.1) - activesupport (= 7.0.8.1) - activestorage (7.0.8.1) - actionpack (= 7.0.8.1) - activejob (= 7.0.8.1) - activerecord (= 7.0.8.1) - activesupport (= 7.0.8.1) + activemodel (7.2.3) + activesupport (= 7.2.3) + activerecord (7.2.3) + activemodel (= 7.2.3) + activesupport (= 7.2.3) + timeout (>= 0.4.0) + activestorage (7.2.3) + actionpack (= 7.2.3) + activejob (= 7.2.3) + activerecord (= 7.2.3) + activesupport (= 7.2.3) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.8.1) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (7.2.3) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) - ast (2.4.2) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + addressable (2.8.8) + public_suffix (>= 2.0.2, < 8.0) + ast (2.4.3) autoprefixer-rails (10.4.7.0) execjs (~> 2) - base64 (0.2.0) + base64 (0.3.0) + benchmark (0.5.0) + bigdecimal (3.3.1) bindex (0.8.1) bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) @@ -89,177 +99,203 @@ GEM capybara-selenium (0.0.6) capybara selenium-webdriver - childprocess (5.0.0) + cgi (0.5.0) + childprocess (5.1.0) + logger (~> 1.5) coderay (1.1.3) - concurrent-ruby (1.3.3) + concurrent-ruby (1.3.5) + connection_pool (3.0.2) crass (1.0.6) - database_cleaner (2.0.2) + csv (3.3.5) + database_cleaner (2.1.0) database_cleaner-active_record (>= 2, < 3) - database_cleaner-active_record (2.1.0) + database_cleaner-active_record (2.2.0) activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) - date (3.3.4) + date (3.5.0) diff-lcs (1.5.1) docile (1.4.0) - erubi (1.13.0) + drb (2.2.3) + erb (6.0.0) + erubi (1.13.1) exception_notification (4.5.0) actionmailer (>= 5.2, < 8) activesupport (>= 5.2, < 8) - execjs (2.8.1) - factory_bot (6.4.6) - activesupport (>= 5.0.0) + execjs (2.10.0) + factory_bot (6.5.6) + activesupport (>= 6.1.0) ffi (1.15.5) - globalid (1.2.1) + globalid (1.3.0) activesupport (>= 6.1) - i18n (1.14.5) + i18n (1.14.7) concurrent-ruby (~> 1.0) - jbuilder (2.12.0) + io-console (0.8.1) + irb (1.15.3) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + jbuilder (2.13.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) jquery-rails (4.6.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.7.2) - language_server-protocol (3.17.0.3) - launchy (3.0.0) + json (2.16.0) + language_server-protocol (3.17.0.5) + launchy (3.1.1) addressable (~> 2.8) childprocess (~> 5.0) - loofah (2.22.0) + logger (~> 1.6) + lint_roller (1.1.0) + logger (1.7.0) + loofah (2.24.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) - mail (2.8.1) + mail (2.9.0) + logger mini_mime (>= 0.1.1) net-imap net-pop net-smtp - marcel (1.0.4) - matrix (0.4.2) + marcel (1.1.0) + matrix (0.4.3) method_source (1.1.0) mini_mime (1.1.5) - mini_portile2 (2.8.7) - minitest (5.24.1) + mini_portile2 (2.8.9) + minitest (5.26.2) mysql2 (0.5.6) - net-imap (0.4.14) + net-imap (0.5.12) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol - nio4r (2.7.3) - nokogiri (1.16.6) + nio4r (2.7.5) + nokogiri (1.18.10) mini_portile2 (~> 2.8.2) racc (~> 1.4) - parallel (1.25.1) - parser (3.3.2.0) + parallel (1.27.0) + parser (3.3.10.0) ast (~> 2.4.1) racc - pry (0.14.2) + pp (0.6.3) + prettyprint + prettyprint (0.2.0) + prism (1.6.0) + pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) - psych (5.1.2) + psych (5.2.6) + date stringio - public_suffix (5.0.4) - puma (6.4.2) + public_suffix (7.0.0) + puma (7.1.0) nio4r (~> 2.0) - racc (1.8.0) - rack (2.2.9) + racc (1.8.1) + rack (3.2.4) rack-mini-profiler (3.3.1) rack (>= 1.2.0) - rack-test (2.1.0) + rack-session (2.1.1) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.2.0) rack (>= 1.3) - rails (7.0.8.1) - actioncable (= 7.0.8.1) - actionmailbox (= 7.0.8.1) - actionmailer (= 7.0.8.1) - actionpack (= 7.0.8.1) - actiontext (= 7.0.8.1) - actionview (= 7.0.8.1) - activejob (= 7.0.8.1) - activemodel (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + rackup (2.3.1) + rack (>= 3) + rails (7.2.3) + actioncable (= 7.2.3) + actionmailbox (= 7.2.3) + actionmailer (= 7.2.3) + actionpack (= 7.2.3) + actiontext (= 7.2.3) + actionview (= 7.2.3) + activejob (= 7.2.3) + activemodel (= 7.2.3) + activerecord (= 7.2.3) + activestorage (= 7.2.3) + activesupport (= 7.2.3) bundler (>= 1.15.0) - railties (= 7.0.8.1) - rails-dom-testing (2.2.0) + railties (= 7.2.3) + rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) + rails-html-sanitizer (1.6.2) loofah (~> 2.21) - nokogiri (~> 1.14) - railties (7.0.8.1) - actionpack (= 7.0.8.1) - activesupport (= 7.0.8.1) - method_source + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (7.2.3) + actionpack (= 7.2.3) + activesupport (= 7.2.3) + cgi + irb (~> 1.13) + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) + zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.2.1) - rdoc (6.6.3.1) + rake (13.3.1) + rdoc (6.17.0) + erb psych (>= 4.0.0) - regexp_parser (2.9.2) - rexml (3.2.8) - strscan (>= 3.0.9) + tsort + regexp_parser (2.11.3) + reline (0.6.3) + io-console (~> 0.5) + rexml (3.4.4) rspec-collection_matchers (1.2.1) rspec-expectations (>= 2.99.0.beta1) - rspec-core (3.5.4) - rspec-support (~> 3.5.0) - rspec-expectations (3.5.0) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-mocks (3.5.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-rails (3.5.2) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.5.0) - rspec-expectations (~> 3.5.0) - rspec-mocks (~> 3.5.0) - rspec-support (~> 3.5.0) - rspec-support (3.5.0) - rubocop (1.64.1) + rspec-support (~> 3.13.0) + rspec-rails (7.1.0) + actionpack (>= 7.0) + activesupport (>= 7.0) + railties (>= 7.0) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) + rspec-support (3.13.1) + rubocop (1.81.7) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.47.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) - parser (>= 3.3.1.0) - rubocop-capybara (2.21.0) - rubocop (~> 1.41) - rubocop-factory_bot (2.26.0) - rubocop (~> 1.41) - rubocop-performance (1.20.2) - rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.30.0, < 2.0) - rubocop-rails (2.24.1) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.48.0) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-performance (1.26.1) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) + rubocop-rails (2.34.0) activesupport (>= 4.2.0) + lint_roller (~> 1.1) rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rspec (2.31.0) - rubocop (~> 1.40) - rubocop-capybara (~> 2.17) - rubocop-factory_bot (~> 2.22) - rubocop-rspec_rails (~> 2.28) - rubocop-rspec_rails (2.29.0) - rubocop (~> 1.40) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) + rubocop-rspec (3.8.0) + lint_roller (~> 1.1) + rubocop (~> 1.81) ruby-progressbar (1.13.0) - rubyzip (2.3.2) + rubyzip (3.2.2) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) sassc (2.4.0) @@ -272,16 +308,19 @@ GEM tilt sdoc (2.4.0) rdoc (>= 5.0) - selenium-webdriver (4.18.1) + securerandom (0.4.1) + selenium-webdriver (4.38.0) base64 (~> 0.2) + logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2, < 3.0) + rubyzip (>= 1.2.2, < 4.0) websocket (~> 1.0) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) + simplecov-lcov (0.9.0) simplecov_json_formatter (0.1.4) spring (4.2.1) sprockets (4.2.1) @@ -291,32 +330,39 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - stringio (3.1.0) - strscan (3.1.0) - thor (1.3.1) + stringio (3.1.9) + syslog (0.3.0) + logger + syslog-logger (1.6.8) + thor (1.4.0) tilt (2.0.11) - timecop (0.9.8) - timeout (0.4.1) + timecop (0.9.10) + timeout (0.4.4) + tsort (0.2.0) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - uglifier (4.2.0) + uglifier (4.2.1) execjs (>= 0.3.0, < 3) - unicode-display_width (2.5.0) - web-console (4.0.4) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.1.0) + useragent (0.16.11) + web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - websocket (1.2.10) - websocket-driver (0.7.6) + websocket (1.2.11) + websocket-driver (0.8.0) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.16) + zeitwerk (2.7.3) PLATFORMS ruby @@ -325,6 +371,7 @@ DEPENDENCIES bootstrap-sass (= 3.4.1) capybara capybara-selenium + csv database_cleaner exception_notification factory_bot @@ -338,9 +385,9 @@ DEPENDENCIES pry puma rack-mini-profiler - rails (~> 7.0.8) + rails (~> 7.2.2) rspec-collection_matchers - rspec-rails (~> 3.5.0) + rspec-rails rubocop rubocop-performance rubocop-rails @@ -349,11 +396,14 @@ DEPENDENCIES sdoc (~> 2.4.0) selenium-webdriver simplecov + simplecov-lcov spring + syslog + syslog-logger timecop turbolinks uglifier (>= 1.3.0) - web-console (~> 4.0.4) + web-console (~> 4.2.1) BUNDLED WITH - 2.3.18 + 2.4.14 diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index c946f114..f6fe03f7 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb @@ -17,7 +17,7 @@ def update redirect_to("/assets?state=#{updater.redirect_state}") else flash[:error] = I18n.t('assets.errors.none_selected') - redirect_back(fallback_location: root_path) + redirect_back_or_to(root_path) end end diff --git a/app/controllers/batches_controller.rb b/app/controllers/batches_controller.rb index a667f094..87768405 100644 --- a/app/controllers/batches_controller.rb +++ b/app/controllers/batches_controller.rb @@ -28,7 +28,7 @@ def create redirect_to("/batches/#{@presenter.id}") else flash[:error] = batch_creator.errors.full_messages.join('; ') - redirect_back(fallback_location: root_path) + redirect_back_or_to(root_path) end end @@ -50,7 +50,7 @@ def update redirect_to("/batches/#{params[:id]}") else flash[:error] = batch_updater.errors.full_messages.join('; ') - redirect_back(fallback_location: root_path) + redirect_back_or_to(root_path) end end @@ -83,7 +83,7 @@ def batch @batch ||= Batch.find_by(id: params[:id]) else flash[:error] = I18n.t('batches.errors.none_selected') - redirect_back(fallback_location: root_path) + redirect_back_or_to(root_path) end end diff --git a/app/controllers/pipeline_destinations_controller.rb b/app/controllers/pipeline_destinations_controller.rb index 0b2110cb..c6689c39 100644 --- a/app/controllers/pipeline_destinations_controller.rb +++ b/app/controllers/pipeline_destinations_controller.rb @@ -7,7 +7,7 @@ def create redirect_to('/admin') else flash[:error] = @pipeline_destination.errors.full_messages.join('; ') - redirect_back(fallback_location: root_path) + redirect_back_or_to(root_path) end end end diff --git a/app/controllers/workflows_controller.rb b/app/controllers/workflows_controller.rb index ef9684bc..d4c8ccca 100644 --- a/app/controllers/workflows_controller.rb +++ b/app/controllers/workflows_controller.rb @@ -12,7 +12,7 @@ def create redirect_to('/admin') else flash[:error] = @workflow.errors.full_messages.join('; ') - redirect_back(fallback_location: root_path) + redirect_back_or_to(root_path) end end @@ -23,7 +23,7 @@ def update redirect_to('/admin') else flash[:error] = workflow.errors.full_messages.join('; ') - redirect_back(fallback_location: root_path) + redirect_back_or_to(root_path) end end @@ -43,11 +43,13 @@ def workflow_params end def workflow - @workflow ||= Workflow.find_by(id: params[:id]) + return @workflow if defined?(@workflow) + + @workflow = Workflow.find_by(id: params[:id]) end def turn_around_days - params[:turnAroundDays].to_i if params[:turnAroundDays].present? + params[:turnAroundDays].presence&.to_i end def initial_state_name diff --git a/app/models/asset.rb b/app/models/asset.rb index a073106a..24f1b1b2 100644 --- a/app/models/asset.rb +++ b/app/models/asset.rb @@ -16,6 +16,7 @@ class Asset < ApplicationRecord after_destroy :remove_comment, if: :comment include ClientSideValidations + validate_with_regexp :study, with: /^\w+$/ validates :identifier, presence: true diff --git a/app/models/report.rb b/app/models/report.rb index f38b5324..dc2f5bc7 100644 --- a/app/models/report.rb +++ b/app/models/report.rb @@ -51,11 +51,7 @@ def date_format private def create_rows - [].tap do |rows| - assets_data.each do |data| - rows << Row.new(data) - end - end + assets_data.map { |data| Row.new(data) } end def assets_data diff --git a/app/presenters/asset_presenter/asset.rb b/app/presenters/asset_presenter/asset.rb index f2c37b26..6820d0e1 100644 --- a/app/presenters/asset_presenter/asset.rb +++ b/app/presenters/asset_presenter/asset.rb @@ -5,6 +5,7 @@ module AssetPresenter class Asset include SharedBehaviour include DeploymentInfo + attr_reader :asset def initialize(asset) diff --git a/app/presenters/asset_presenter/index.rb b/app/presenters/asset_presenter/index.rb index 32cafa6f..5d95fc62 100644 --- a/app/presenters/asset_presenter/index.rb +++ b/app/presenters/asset_presenter/index.rb @@ -5,6 +5,7 @@ module AssetPresenter class Index include SharedBehaviour include DeploymentInfo + attr_reader :search, :assets, :total def initialize(found_assets, search = nil, state = nil) diff --git a/app/presenters/asset_type_presenter/asset_type.rb b/app/presenters/asset_type_presenter/asset_type.rb index 27f8383b..592e864e 100644 --- a/app/presenters/asset_type_presenter/asset_type.rb +++ b/app/presenters/asset_type_presenter/asset_type.rb @@ -5,6 +5,7 @@ module AssetTypePresenter class AssetType include SharedBehaviour include DeploymentInfo + attr_reader :asset_type ALPHANUMERIC_REGEX = '^[\w-]+$' diff --git a/app/presenters/batch_presenter/new.rb b/app/presenters/batch_presenter/new.rb index 5e1777b5..344a8368 100644 --- a/app/presenters/batch_presenter/new.rb +++ b/app/presenters/batch_presenter/new.rb @@ -5,6 +5,7 @@ module BatchPresenter class New include SharedBehaviour include DeploymentInfo + def each_asset; end def study diff --git a/app/presenters/batch_presenter/show.rb b/app/presenters/batch_presenter/show.rb index 84659965..cd9db98b 100644 --- a/app/presenters/batch_presenter/show.rb +++ b/app/presenters/batch_presenter/show.rb @@ -5,6 +5,7 @@ module BatchPresenter class Show include SharedBehaviour include DeploymentInfo + attr_reader :batch def initialize(batch) @@ -36,7 +37,7 @@ def project end def workflow - @workflow ||= (first_asset.workflow if first_asset.present?) || '' + @workflow ||= first_asset.presence&.workflow || '' end def prohibited_workflow(reportable, qc_flow, cherrypick_flow) @@ -48,7 +49,7 @@ def prohibited_workflow(reportable, qc_flow, cherrypick_flow) end def workflow_name - workflow.name if workflow.present? + workflow.presence&.name end def pipeline_destination diff --git a/app/presenters/report_presenter/new.rb b/app/presenters/report_presenter/new.rb index 4023108a..83f8a79f 100644 --- a/app/presenters/report_presenter/new.rb +++ b/app/presenters/report_presenter/new.rb @@ -5,6 +5,7 @@ module ReportPresenter class New include SharedBehaviour include DeploymentInfo + attr_reader :report def initialize(report = Report.new({})) @@ -24,15 +25,15 @@ def flash end def workflow - report.workflow.name if report.workflow.present? + report.workflow.presence&.name end def start_date - report.start_date.strftime(report.date_format) if report.start_date.present? + report.start_date.presence&.strftime(report.date_format) end def end_date - report.end_date.strftime(report.date_format) if report.end_date.present? + report.end_date.presence&.strftime(report.date_format) end end end diff --git a/app/presenters/report_presenter/show.rb b/app/presenters/report_presenter/show.rb index 2dd8328e..366dfc14 100644 --- a/app/presenters/report_presenter/show.rb +++ b/app/presenters/report_presenter/show.rb @@ -3,6 +3,7 @@ module ReportPresenter class Show include SharedBehaviour include DeploymentInfo + attr_reader :report def initialize(report) diff --git a/app/presenters/workflow_presenter/show.rb b/app/presenters/workflow_presenter/show.rb index 5f63a2d7..b37ff68d 100644 --- a/app/presenters/workflow_presenter/show.rb +++ b/app/presenters/workflow_presenter/show.rb @@ -5,6 +5,7 @@ module WorkflowPresenter class Show include SharedBehaviour include DeploymentInfo + attr_reader :workflow def initialize(workflow) diff --git a/config/application.rb b/config/application.rb index d1407928..34f3a37a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -22,19 +22,17 @@ class Application < Rails::Application config.load_defaults 7.0 - config.mailer = YAML.load_file("#{Rails.root}/config/mailer.yml")[Rails.env] + config.mailer = YAML.load_file(Rails.root.join('config/mailer.yml').to_s)[Rails.env] config.autoload_paths += %W[#{config.root}/lib/utils] config.disable_animations = false - config.autoload_paths += %W[#{Rails.root}/app/presenters] - config.eager_load_paths += %W[#{Rails.root}/app/presenters] + config.autoload_paths += %W[#{Rails.root.join('app/presenters')}] + config.eager_load_paths += %W[#{Rails.root.join('app/presenters')}] # Enabling the behaviour where 'belongs_to' associations are required by default. # (https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#active-record-belongs-to-required-by-default-option) config.active_record.belongs_to_required_by_default = true - config.active_record.legacy_connection_handling = false - config.action_controller.default_protect_from_forgery = false end end diff --git a/config/initializers/01_proc.rb b/config/initializers/01_proc.rb index e9b1cdfe..55c0602e 100644 --- a/config/initializers/01_proc.rb +++ b/config/initializers/01_proc.rb @@ -1,9 +1,9 @@ # www.mattsears.com/articles/2011/11/27ruby-blocks-as-dynamic-callbacks class Proc - def callback(callable, *args) + def callback(callable, *) self === Class.new do method_name = callable.to_sym - define_method(method_name) { |&block| block ? block.call(*args) : true } + define_method(method_name) { |&block| block ? block.call(*) : true } define_method(:"#{method_name}?") { true } def method_missing(*_args) false diff --git a/db/migrate/20140527130308_create_asset_type_table.rb b/db/migrate/20140527130308_create_asset_type_table.rb index 5bbd5f48..9ad388d2 100644 --- a/db/migrate/20140527130308_create_asset_type_table.rb +++ b/db/migrate/20140527130308_create_asset_type_table.rb @@ -1,4 +1,4 @@ -class CreateAssetTypeTable < ActiveRecord::Migration +class CreateAssetTypeTable < ActiveRecord::Migration[4.2] def change create_table(:asset_types) do |t| # id diff --git a/db/migrate/20140527130314_create_asset_table.rb b/db/migrate/20140527130314_create_asset_table.rb index 5f78ebb8..08df512e 100644 --- a/db/migrate/20140527130314_create_asset_table.rb +++ b/db/migrate/20140527130314_create_asset_table.rb @@ -1,4 +1,4 @@ -class CreateAssetTable < ActiveRecord::Migration +class CreateAssetTable < ActiveRecord::Migration[4.2] def change create_table(:assets) do |t| # id diff --git a/db/migrate/20140527130320_create_batch_table.rb b/db/migrate/20140527130320_create_batch_table.rb index 39d5143b..e9f7cc12 100644 --- a/db/migrate/20140527130320_create_batch_table.rb +++ b/db/migrate/20140527130320_create_batch_table.rb @@ -1,4 +1,4 @@ -class CreateBatchTable < ActiveRecord::Migration +class CreateBatchTable < ActiveRecord::Migration[4.2] def change create_table(:batches) do |t| # id diff --git a/db/migrate/20140527130331_create_workflow_types_table.rb b/db/migrate/20140527130331_create_workflow_types_table.rb index 1b17d8bd..9e0beeca 100644 --- a/db/migrate/20140527130331_create_workflow_types_table.rb +++ b/db/migrate/20140527130331_create_workflow_types_table.rb @@ -1,4 +1,4 @@ -class CreateWorkflowTypesTable < ActiveRecord::Migration +class CreateWorkflowTypesTable < ActiveRecord::Migration[4.2] def change create_table(:workflows) do |t| # id diff --git a/db/migrate/20140527130338_create_comments_table.rb b/db/migrate/20140527130338_create_comments_table.rb index a8dc2364..48036dd0 100644 --- a/db/migrate/20140527130338_create_comments_table.rb +++ b/db/migrate/20140527130338_create_comments_table.rb @@ -1,4 +1,4 @@ -class CreateCommentsTable < ActiveRecord::Migration +class CreateCommentsTable < ActiveRecord::Migration[4.2] def change create_table(:comments) do |t| # id diff --git a/db/migrate/20140603152048_add_indexes_to_tables.rb b/db/migrate/20140603152048_add_indexes_to_tables.rb index 8581e8cf..d4898296 100644 --- a/db/migrate/20140603152048_add_indexes_to_tables.rb +++ b/db/migrate/20140603152048_add_indexes_to_tables.rb @@ -1,4 +1,4 @@ -class AddIndexesToTables < ActiveRecord::Migration +class AddIndexesToTables < ActiveRecord::Migration[4.2] def change add_index :assets, :identifier add_index :assets, :asset_type_id diff --git a/db/migrate/20140603152601_add_foreign_key_constraints.rb b/db/migrate/20140603152601_add_foreign_key_constraints.rb index 89082e4d..ca984bac 100644 --- a/db/migrate/20140603152601_add_foreign_key_constraints.rb +++ b/db/migrate/20140603152601_add_foreign_key_constraints.rb @@ -1,4 +1,4 @@ -class AddForeignKeyConstraints < ActiveRecord::Migration +class AddForeignKeyConstraints < ActiveRecord::Migration[4.2] def change add_foreign_key :assets, :asset_types add_foreign_key :assets, :batches diff --git a/db/migrate/20140807110338_add_reported_at_timestamp.rb b/db/migrate/20140807110338_add_reported_at_timestamp.rb index 1b9a76f0..d95b3dce 100644 --- a/db/migrate/20140807110338_add_reported_at_timestamp.rb +++ b/db/migrate/20140807110338_add_reported_at_timestamp.rb @@ -1,4 +1,4 @@ -class AddReportedAtTimestamp < ActiveRecord::Migration +class AddReportedAtTimestamp < ActiveRecord::Migration[4.2] def change add_column :assets, :reported_at, :datetime end diff --git a/db/migrate/20140807111356_add_reportable_to_workflows.rb b/db/migrate/20140807111356_add_reportable_to_workflows.rb index fa9d8885..8c545e7f 100644 --- a/db/migrate/20140807111356_add_reportable_to_workflows.rb +++ b/db/migrate/20140807111356_add_reportable_to_workflows.rb @@ -1,4 +1,4 @@ -class AddReportableToWorkflows < ActiveRecord::Migration +class AddReportableToWorkflows < ActiveRecord::Migration[4.2] def change add_column :workflows, :reportable, :boolean, default: false, null: false end diff --git a/db/migrate/20140807152237_add_data_type_to_asset_type.rb b/db/migrate/20140807152237_add_data_type_to_asset_type.rb index 37c2c02e..f0ecb8b9 100644 --- a/db/migrate/20140807152237_add_data_type_to_asset_type.rb +++ b/db/migrate/20140807152237_add_data_type_to_asset_type.rb @@ -1,4 +1,4 @@ -class AddDataTypeToAssetType < ActiveRecord::Migration +class AddDataTypeToAssetType < ActiveRecord::Migration[4.2] def change add_column :asset_types, :identifier_data_type, :string, default: 'alphanumeric', null: false end diff --git a/db/migrate/20150528085213_add_pipeline_destination.rb b/db/migrate/20150528085213_add_pipeline_destination.rb index c98690bb..5f2a6a5a 100644 --- a/db/migrate/20150528085213_add_pipeline_destination.rb +++ b/db/migrate/20150528085213_add_pipeline_destination.rb @@ -1,4 +1,4 @@ -class AddPipelineDestination < ActiveRecord::Migration +class AddPipelineDestination < ActiveRecord::Migration[4.2] def up ActiveRecord::Base.transaction do create_table(:pipeline_destinations) do |t| diff --git a/db/migrate/20150624152014_add_begun_at_timestamp.rb b/db/migrate/20150624152014_add_begun_at_timestamp.rb index 4de24dc8..957f6b0b 100644 --- a/db/migrate/20150624152014_add_begun_at_timestamp.rb +++ b/db/migrate/20150624152014_add_begun_at_timestamp.rb @@ -1,4 +1,4 @@ -class AddBegunAtTimestamp < ActiveRecord::Migration +class AddBegunAtTimestamp < ActiveRecord::Migration[4.2] def change add_column :assets, :begun_at, :datetime end diff --git a/db/migrate/20150624152208_migrate_begun_at.rb b/db/migrate/20150624152208_migrate_begun_at.rb index 6df05996..5b990a7e 100644 --- a/db/migrate/20150624152208_migrate_begun_at.rb +++ b/db/migrate/20150624152208_migrate_begun_at.rb @@ -1,4 +1,4 @@ -class MigrateBegunAt < ActiveRecord::Migration +class MigrateBegunAt < ActiveRecord::Migration[4.2] def up ActiveRecord::Base.transaction do Asset.update_all('begun_at = created_at') diff --git a/db/migrate/20150624152719_add_constrains_on_begun_at.rb b/db/migrate/20150624152719_add_constrains_on_begun_at.rb index 7156b69d..74d39f24 100644 --- a/db/migrate/20150624152719_add_constrains_on_begun_at.rb +++ b/db/migrate/20150624152719_add_constrains_on_begun_at.rb @@ -1,4 +1,4 @@ -class AddConstrainsOnBegunAt < ActiveRecord::Migration +class AddConstrainsOnBegunAt < ActiveRecord::Migration[4.2] def change change_column_null :assets, :begun_at, false end diff --git a/db/migrate/20150629160352_add_cost_code.rb b/db/migrate/20150629160352_add_cost_code.rb index 8ced4696..d8ee0e60 100644 --- a/db/migrate/20150629160352_add_cost_code.rb +++ b/db/migrate/20150629160352_add_cost_code.rb @@ -1,4 +1,4 @@ -class AddCostCode < ActiveRecord::Migration +class AddCostCode < ActiveRecord::Migration[4.2] def up ActiveRecord::Base.transaction do create_table(:cost_codes) do |t| diff --git a/db/migrate/20150630102003_add_turn_around_time_column_to_workflow.rb b/db/migrate/20150630102003_add_turn_around_time_column_to_workflow.rb index 910061f1..c532534f 100644 --- a/db/migrate/20150630102003_add_turn_around_time_column_to_workflow.rb +++ b/db/migrate/20150630102003_add_turn_around_time_column_to_workflow.rb @@ -1,4 +1,4 @@ -class AddTurnAroundTimeColumnToWorkflow < ActiveRecord::Migration +class AddTurnAroundTimeColumnToWorkflow < ActiveRecord::Migration[4.2] def change add_column :workflows, :turn_around_days, :integer end diff --git a/db/migrate/20170302110500_create_state_table.rb b/db/migrate/20170302110500_create_state_table.rb index 286fc7df..0cdd79ea 100644 --- a/db/migrate/20170302110500_create_state_table.rb +++ b/db/migrate/20170302110500_create_state_table.rb @@ -1,4 +1,4 @@ -class CreateStateTable < ActiveRecord::Migration +class CreateStateTable < ActiveRecord::Migration[4.2] def change create_table(:states) do |t| # id diff --git a/db/migrate/20170303130800_create_event_table.rb b/db/migrate/20170303130800_create_event_table.rb index a3708d07..cd289f64 100644 --- a/db/migrate/20170303130800_create_event_table.rb +++ b/db/migrate/20170303130800_create_event_table.rb @@ -1,4 +1,4 @@ -class CreateEventTable < ActiveRecord::Migration +class CreateEventTable < ActiveRecord::Migration[4.2] def change create_table(:events) do |t| # id diff --git a/db/migrate/20170305144300_add_initial_state_to_workflows.rb b/db/migrate/20170305144300_add_initial_state_to_workflows.rb index 50f258c2..baaf3802 100644 --- a/db/migrate/20170305144300_add_initial_state_to_workflows.rb +++ b/db/migrate/20170305144300_add_initial_state_to_workflows.rb @@ -1,4 +1,4 @@ -class AddInitialStateToWorkflows < ActiveRecord::Migration +class AddInitialStateToWorkflows < ActiveRecord::Migration[4.2] def change add_reference :workflows, :initial_state add_index :workflows, :initial_state_id diff --git a/db/migrate/20170306102500_update_states_and_workflows.rb b/db/migrate/20170306102500_update_states_and_workflows.rb index 32cb1829..99413dc4 100644 --- a/db/migrate/20170306102500_update_states_and_workflows.rb +++ b/db/migrate/20170306102500_update_states_and_workflows.rb @@ -1,4 +1,4 @@ -class UpdateStatesAndWorkflows < ActiveRecord::Migration +class UpdateStatesAndWorkflows < ActiveRecord::Migration[4.2] def change ActiveRecord::Base.transaction do Workflow.where(initial_state: nil).find_each do |workflow| diff --git a/db/migrate/20170411114800_add_project_to_asset.rb b/db/migrate/20170411114800_add_project_to_asset.rb index 9b4ef4d0..f4a0407b 100644 --- a/db/migrate/20170411114800_add_project_to_asset.rb +++ b/db/migrate/20170411114800_add_project_to_asset.rb @@ -1,4 +1,4 @@ -class AddProjectToAsset < ActiveRecord::Migration +class AddProjectToAsset < ActiveRecord::Migration[4.2] def change add_column :assets, :project, :string end diff --git a/db/migrate/20190130131354_add_active_to_workflows.rb b/db/migrate/20190130131354_add_active_to_workflows.rb index 551564ff..312eb84b 100644 --- a/db/migrate/20190130131354_add_active_to_workflows.rb +++ b/db/migrate/20190130131354_add_active_to_workflows.rb @@ -1,4 +1,4 @@ -class AddActiveToWorkflows < ActiveRecord::Migration +class AddActiveToWorkflows < ActiveRecord::Migration[4.2] def change add_column :workflows, :active, :boolean, default: true, null: false end diff --git a/db/migrate/20190801123806_add_labware_type_to_asset_types.rb b/db/migrate/20190801123806_add_labware_type_to_asset_types.rb index 83b5ec7c..b7b9a0f9 100644 --- a/db/migrate/20190801123806_add_labware_type_to_asset_types.rb +++ b/db/migrate/20190801123806_add_labware_type_to_asset_types.rb @@ -1,4 +1,4 @@ -class AddLabwareTypeToAssetTypes < ActiveRecord::Migration +class AddLabwareTypeToAssetTypes < ActiveRecord::Migration[4.2] def change add_column :asset_types, :labware_type, :string end diff --git a/db/migrate/20190923133947_add_qc_flow_column_to_workflows.rb b/db/migrate/20190923133947_add_qc_flow_column_to_workflows.rb index 247882e1..749489d3 100644 --- a/db/migrate/20190923133947_add_qc_flow_column_to_workflows.rb +++ b/db/migrate/20190923133947_add_qc_flow_column_to_workflows.rb @@ -1,4 +1,4 @@ -class AddQcFlowColumnToWorkflows < ActiveRecord::Migration +class AddQcFlowColumnToWorkflows < ActiveRecord::Migration[4.2] def change add_column :workflows, :qc_flow, :boolean end diff --git a/db/migrate/20190923134849_update_qc_flow_column_workflows.rb b/db/migrate/20190923134849_update_qc_flow_column_workflows.rb index 194b0c5c..a805c9bf 100644 --- a/db/migrate/20190923134849_update_qc_flow_column_workflows.rb +++ b/db/migrate/20190923134849_update_qc_flow_column_workflows.rb @@ -1,4 +1,4 @@ -class UpdateQcFlowColumnWorkflows < ActiveRecord::Migration +class UpdateQcFlowColumnWorkflows < ActiveRecord::Migration[4.2] def up Workflow.includes(:initial_state).find_each do |workflow| workflow.qc_flow = workflow.initial_state.name != 'in_progress' diff --git a/db/migrate/20190923135238_change_qc_flow_column_workflows_to_not_null.rb b/db/migrate/20190923135238_change_qc_flow_column_workflows_to_not_null.rb index 0617b1e5..9ebd0a85 100644 --- a/db/migrate/20190923135238_change_qc_flow_column_workflows_to_not_null.rb +++ b/db/migrate/20190923135238_change_qc_flow_column_workflows_to_not_null.rb @@ -1,4 +1,4 @@ -class ChangeQcFlowColumnWorkflowsToNotNull < ActiveRecord::Migration +class ChangeQcFlowColumnWorkflowsToNotNull < ActiveRecord::Migration[4.2] def change change_column_null :workflows, :qc_flow, false end diff --git a/db/migrate/20190923141944_change_qc_flow_column_workflows_default.rb b/db/migrate/20190923141944_change_qc_flow_column_workflows_default.rb index 62a3660a..1f4767d9 100644 --- a/db/migrate/20190923141944_change_qc_flow_column_workflows_default.rb +++ b/db/migrate/20190923141944_change_qc_flow_column_workflows_default.rb @@ -1,4 +1,4 @@ -class ChangeQcFlowColumnWorkflowsDefault < ActiveRecord::Migration +class ChangeQcFlowColumnWorkflowsDefault < ActiveRecord::Migration[4.2] def change change_column_default :workflows, :qc_flow, false end diff --git a/db/migrate/20190924154728_add_cherrypick_flow_to_workflows.rb b/db/migrate/20190924154728_add_cherrypick_flow_to_workflows.rb index de714bd0..96988cd2 100644 --- a/db/migrate/20190924154728_add_cherrypick_flow_to_workflows.rb +++ b/db/migrate/20190924154728_add_cherrypick_flow_to_workflows.rb @@ -1,4 +1,4 @@ -class AddCherrypickFlowToWorkflows < ActiveRecord::Migration +class AddCherrypickFlowToWorkflows < ActiveRecord::Migration[4.2] def change add_column :workflows, :cherrypick_flow, :boolean, default: false, null: false end diff --git a/db/schema.rb b/db/schema.rb index b089a352..9198252e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,19 +10,18 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[6.1].define(version: 2019_09_24_154728) do - - create_table "asset_types", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| +ActiveRecord::Schema[7.2].define(version: 2019_09_24_154728) do + create_table "asset_types", id: :integer, charset: "utf8mb3", force: :cascade do |t| t.string "name", null: false t.string "identifier_type", null: false t.boolean "has_sample_count", default: false, null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "identifier_data_type", default: "alphanumeric", null: false t.string "labware_type" end - create_table "assets", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| + create_table "assets", id: :integer, charset: "utf8mb3", force: :cascade do |t| t.string "identifier", null: false t.integer "asset_type_id", null: false t.integer "workflow_id", null: false @@ -30,67 +29,69 @@ t.integer "batch_id", null: false t.string "study" t.integer "sample_count", default: 1, null: false - t.datetime "created_at" - t.datetime "updated_at" - t.datetime "completed_at" - t.datetime "reported_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil + t.datetime "completed_at", precision: nil + t.datetime "reported_at", precision: nil t.integer "pipeline_destination_id" - t.datetime "begun_at", null: false + t.datetime "begun_at", precision: nil, null: false t.integer "cost_code_id" t.string "project" - t.index ["asset_type_id"], name: "fk_assets_to_asset_types" + t.index ["asset_type_id"], name: "index_assets_on_asset_type_id" t.index ["batch_id"], name: "index_assets_on_batch_id" - t.index ["comment_id"], name: "fk_assets_to_comments" - t.index ["completed_at"], name: "index_assets_on_completed_at" + t.index ["comment_id"], name: "index_assets_on_comment_id" t.index ["identifier"], name: "index_assets_on_identifier" - t.index ["workflow_id"], name: "fk_assets_to_workflows" + t.index ["workflow_id"], name: "index_assets_on_workflow_id" end - create_table "batches", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| - t.datetime "created_at" - t.datetime "updated_at" + create_table "batches", id: :integer, charset: "utf8mb3", force: :cascade do |t| + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil end - create_table "comments", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| + create_table "comments", id: :integer, charset: "utf8mb3", force: :cascade do |t| t.text "comment" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil end - create_table "cost_codes", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| + create_table "cost_codes", id: :integer, charset: "utf8mb3", force: :cascade do |t| t.string "name", null: false end - create_table "events", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| + create_table "events", id: :integer, charset: "utf8mb3", force: :cascade do |t| t.integer "asset_id", null: false t.integer "state_id", null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil end - create_table "pipeline_destinations", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| + create_table "pipeline_destinations", id: :integer, charset: "utf8mb3", force: :cascade do |t| t.string "name" end - create_table "states", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| + create_table "states", id: :integer, charset: "utf8mb3", force: :cascade do |t| t.string "name", null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil end - create_table "workflows", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| + create_table "workflows", id: :integer, charset: "utf8mb3", force: :cascade do |t| t.string "name", null: false t.boolean "has_comment", default: false, null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.boolean "reportable", default: false, null: false t.integer "turn_around_days" t.integer "initial_state_id" t.boolean "active", default: true, null: false t.boolean "qc_flow", default: false, null: false t.boolean "cherrypick_flow", default: false, null: false - t.index ["initial_state_id"], name: "fk_rails_e3fad0d986" + t.index ["initial_state_id"], name: "index_workflows_on_initial_state_id" end - add_foreign_key "workflows", "states", column: "initial_state_id" + add_foreign_key "assets", "asset_types" + add_foreign_key "assets", "batches" + add_foreign_key "assets", "comments" + add_foreign_key "assets", "workflows" end diff --git a/lib/client_side_validations.rb b/lib/client_side_validations.rb index 16eda92b..526a4614 100644 --- a/lib/client_side_validations.rb +++ b/lib/client_side_validations.rb @@ -13,7 +13,7 @@ def html_validation_attributes(attr_name) { 'data-psg-regexp': @regexp[attr_name][:with].source.to_s, 'data-psg-input-optional': (@regexp[attr_name][:allow_blank] == true).to_s, - 'data-psg-validation-error-msg': (@regexp[attr_name][:error_msg]).to_s + 'data-psg-validation-error-msg': @regexp[attr_name][:error_msg].to_s }.tap do |obj| # For the moment, it's just for data-psg-validation-error-msg obj.delete_if { |_k, v| v.empty? } @@ -21,7 +21,8 @@ def html_validation_attributes(attr_name) end def validationErrorMsg(attr_name) - nil if @regexp[attr_name].nil? + return if @regexp[attr_name].nil? + @regexp[attr_name][:error_msg] end diff --git a/lib/psd_formatter.rb b/lib/psd_formatter.rb index da348517..39c8bd3a 100644 --- a/lib/psd_formatter.rb +++ b/lib/psd_formatter.rb @@ -6,6 +6,9 @@ class PsdFormatter < Syslog::Logger::Formatter LINE_FORMAT = "(thread-%s) [%s] %5s -- : %s\n" + # Severity label for logging (max 5 chars). + SEV_LABEL = %w[DEBUG INFO WARN ERROR FATAL ANY].each(&:freeze).freeze + def initialize(deployment_info) # deployment_info is set as DETAILS in deployed_version and called in deployment project @app_tag = deployment_info.values.compact.join(':').freeze @@ -19,9 +22,6 @@ def call(severity, _timestamp, _progname, msg) private - # Severity label for logging (max 5 chars). - SEV_LABEL = %w[DEBUG INFO WARN ERROR FATAL ANY].each(&:freeze).freeze - def format_severity(severity) if severity.is_a?(Integer) SEV_LABEL[severity] || 'ANY' diff --git a/spec/presenters/asset_index_presenter_spec.rb b/spec/presenters/asset_index_presenter_spec.rb index 6c99af99..2e8a831a 100644 --- a/spec/presenters/asset_index_presenter_spec.rb +++ b/spec/presenters/asset_index_presenter_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' -require './spec/presenters/shared_presenter_behaviour' describe 'AssetPresenter::Index' do shared_context 'shared mocks' do @@ -36,8 +35,8 @@ end shared_examples 'standard behaviour' do - include_examples('shared presenter behaviour') - include_examples('shared mocks') + it_behaves_like('shared presenter behaviour') + include_context('shared mocks') it 'returns a count of assets for total' do expect(presenter.total).to eq(2) @@ -54,7 +53,7 @@ context 'when returning search results' do let(:search) { "identifier matches 'Type'" } - include_examples 'standard behaviour' + include_context 'standard behaviour' it 'yields the search parameters on search_parameters' do expect { |b| presenter.search_parameters(&b) }.to yield_with_args(search) @@ -70,7 +69,7 @@ context 'when returning a complete index' do let(:search) { nil } - include_examples 'standard behaviour' + include_context 'standard behaviour' it 'does not yield on search_parameters' do expect { |b| presenter.search_parameters(&b) }.to yield_successive_args @@ -85,7 +84,7 @@ context 'when state is' do let(:search) { nil } - include_examples 'shared mocks' + include_context 'shared mocks' context 'all' do let(:state) { nil } diff --git a/spec/presenters/batch_new_presenter_spec.rb b/spec/presenters/batch_new_presenter_spec.rb index a4f25ca4..ef41e992 100644 --- a/spec/presenters/batch_new_presenter_spec.rb +++ b/spec/presenters/batch_new_presenter_spec.rb @@ -4,6 +4,6 @@ let(:presenter) { BatchPresenter::New.new } context 'always' do - include_examples('shared presenter behaviour') + it_behaves_like('shared presenter behaviour') end end diff --git a/spec/presenters/batch_show_presenter_spec.rb b/spec/presenters/batch_show_presenter_spec.rb index fc8d81ea..5a850570 100644 --- a/spec/presenters/batch_show_presenter_spec.rb +++ b/spec/presenters/batch_show_presenter_spec.rb @@ -24,7 +24,7 @@ let(:mock_workflow) { double('mock_wf', name: 'Work', has_comment: true) } let(:mock_type) { double('mock_type', name: 'Type', identifier_type: 'id', variable_samples: true) } - include_examples('shared presenter behaviour') + it_behaves_like('shared presenter behaviour') it 'yields each asset in the batch in turn for each_asset' do expect(AssetPresenter::Asset).to receive(:new).with(asset_first).and_call_original diff --git a/spec/presenters/report_new_presenter_spec.rb b/spec/presenters/report_new_presenter_spec.rb index 6858c9b1..a6fc52bd 100644 --- a/spec/presenters/report_new_presenter_spec.rb +++ b/spec/presenters/report_new_presenter_spec.rb @@ -4,7 +4,7 @@ let(:presenter) { ReportPresenter::New.new } context 'always' do - include_examples('shared presenter behaviour') + it_behaves_like('shared presenter behaviour') end context 'with empty report' do diff --git a/spec/presenters/report_show_presenter_spec.rb b/spec/presenters/report_show_presenter_spec.rb index 6c58d4af..852b216c 100644 --- a/spec/presenters/report_show_presenter_spec.rb +++ b/spec/presenters/report_show_presenter_spec.rb @@ -16,7 +16,7 @@ end context 'when always' do - include_examples('shared presenter behaviour') + it_behaves_like('shared presenter behaviour') end it 'generates correct html for report' do diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index ea500093..858e9799 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,6 +1,14 @@ # This file is copied to spec/ when you run 'rails generate rspec:install' ENV['RAILS_ENV'] ||= 'test' require 'simplecov' +require 'simplecov_json_formatter' +require 'simplecov-lcov' +SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true +SimpleCov::Formatter::LcovFormatter.config.single_report_path = 'lcov.info' +SimpleCov.formatters = + SimpleCov::Formatter::MultiFormatter.new( + [SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::JSONFormatter, SimpleCov::Formatter::LcovFormatter] + ) SimpleCov.start 'rails' require File.expand_path('../config/environment', __dir__) @@ -22,7 +30,7 @@ # directory. Alternatively, in the individual `*_spec.rb` files, manually # require only the support files necessary. # -# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } +Rails.root.glob('spec/support/**/*.rb').each { |f| require f } # Checks for pending migrations before tests are run. # If you are not using ActiveRecord, you can remove this line. diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0dad5843..3f922aed 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -26,20 +26,24 @@ Capybara.register_driver :chrome do |app| Capybara::Selenium::Driver.new(app, browser: :chrome) + options.add_argument('--disable_gpu') + options.add_argument('--window-size=1600,3200') + options.add_argument('--disable-search-engine-choice-screen') end Capybara.register_driver :headless_chrome do |app| options = Selenium::WebDriver::Chrome::Options.new - options.add_argument('--headless') options.add_argument('--disable_gpu') - # options.add_argument('--disable-popup-blocking') options.add_argument('--window-size=1600,3200') + options.add_argument('--disable-search-engine-choice-screen') + options.add_argument('--no-sandbox') + options.add_preference('profile.password_manager_leak_detection', false) Capybara::Selenium::Driver.new(app, browser: :chrome, options:) end Capybara.javascript_driver = :headless_chrome -Capybara.default_max_wait_time = 5 +Capybara.default_max_wait_time = 120 # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| diff --git a/spec/presenters/shared_presenter_behaviour.rb b/spec/support/shared_examples/shared_presenter_behaviour.rb similarity index 93% rename from spec/presenters/shared_presenter_behaviour.rb rename to spec/support/shared_examples/shared_presenter_behaviour.rb index 4f361f47..0a6ca255 100644 --- a/spec/presenters/shared_presenter_behaviour.rb +++ b/spec/support/shared_examples/shared_presenter_behaviour.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + shared_examples 'shared presenter behaviour' do let!(:asset_type_first) do create(:asset_type, @@ -18,7 +20,7 @@ reportable: true, turn_around_days: 1) end - let!(:workflow_2) { create(:workflow, name: 'wf2', active: false) } + let!(:workflow2) { create(:workflow, name: 'wf2', active: false) } it 'yields each asset_type and its identifier in turn for each_asset_type' do yielded = []