diff --git a/CHANGELOG.md b/CHANGELOG.md index 62f8ca0..f2caf9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,99 +1,182 @@ -# HMLR PPD explorer +# Changelog -This app allows the user to explore HMLR price-paid open linked data. +All notable changes to this project will be documented in this file. -## Changelog +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## [Unreleased] -## 2.2.2 - 2025-08 +## [2.2.3] - 2025-11 + +### Changed + +- Updated Ruby on Rails framework to latest version for improved security and + performance +- Modernised test suite assertions from deprecated spec-style to standard + Minitest patterns +- Upgraded Selenium WebDriver from 4.1.0 to 4.38.0 for better browser + compatibility +- Updated multiple dependencies including Puma, Faraday, JSON, and Sentry for + security fixes +- Improved test framework compatibility and removed legacy assertion helpers +- Adjusted test logging to respect log level and reduce logs displayed unless + debugging +- Simplified Sentry initialisation to always configure when DSN is available + +### Removed + +- Removed unused gems: `capybara-selenium`, `webdrivers`, `minitest-vcr`, and + `minitest-capybara` +- Cleaned up redundant test dependencies and VCR integration setup +- Removed deprecated `to_time_preserves_timezone` configuration for Rails 8.1+ + compatibility + +### Fixed + +- Resolved MiniTest compatibility issues with Capybara integration +- Fixed deprecated assertion syntax throughout test suite (replaced `assert_not` + with `refute`) +- Added explicit CSV gem dependency for Ruby 3.4.0 compatibility +- Improved test helper setup and gem loading order +- Updated Sentry logger configuration from `config.logger.level` to `config.sdk_logger.level` + +### Security + +- Updated dependencies to address security vulnerabilities in linting and + testing frameworks +- Upgraded core framework dependencies to resolve known security issues +- Refactored Sentry error reporting configuration for SDK v6 compatibility + +## [2.2.2] - 2025-08 + +### Changed - Updated LR Common Styles gem to continue to address security issues -## 2.2.1 - 2025-08 +## [2.2.1] - 2025-08 + +### Changed + +- Adjusted dependencies to new versions including rails +- Updated gems like rexml, jbuilder, and puma +- Modified lockfile to reflect dependency changes +- Modified CSV handling to add newline after headers +- Updated styles for download option layout -- Adjusts dependencies to new versions including rails -- Updates gems like rexml, jbuilder, and puma -- Modifies lockfile to reflect dependency changes -- Modify CSV handling to add newline after headers -- Update styles for download option layout -- Add documentation for Git hook automation tasks +### Added -### 2.2.0 - 2025-08 +- Added documentation for Git hook automation tasks -- Update several Ruby gems for better security and performance -- Fix Rubocop plugin configuration to resolve misconfiguration -- Enhance HTML with clickable footnotes and smooth scrolling -- Refactor Docker run commands to use Makefile targets -- Reorganise Makefile for clearer asset management +## [2.2.0] - 2025-08 -## 2.1.0 - 2025-07 +### Changed + +- Updated several Ruby gems for better security and performance +- Enhanced HTML with clickable footnotes and smooth scrolling +- Refactored Docker run commands to use Makefile targets +- Reorganised Makefile for clearer asset management + +### Fixed + +- Fixed Rubocop plugin configuration to resolve misconfiguration + +## [2.1.0] - 2025-07 + +### Changed - Updated the Ruby version from 3.3.5 to 3.4.4 and the Alpine version from 3.20 - to 3.22. -- Introduced EnvironmentHelper module to standardise environment-specific UI - display. + to 3.22 - Enhanced Docker setup by incorporating a more organised building process and - additional dependencies. + additional dependencies - Adjusted HTML structure for modal presentation and cleaned up modal-related - markup. + markup -## 2.0.4 - 2025-06 - HOTFIX +### Added + +- Introduced EnvironmentHelper module to standardise environment-specific UI + display + +## [2.0.4] - 2025-06 + +### Security - Introduced new method sanitise for HTML input sanitisation and replaced occurrences of sanitize with strip_tags in views to prevent potential XSS - vulnerabilities. + vulnerabilities [GH-280](https://github.com/epimorphics/ppd-explorer/issues/280) -- Refactor error handling for consistent status processing -- Update configuration to align comment patterns and quotes use -- Add development gems for improved tooling, adjust gem strategy -## 2.0.3 - 2025-04 +### Changed + +- Refactored error handling for consistent status processing +- Updated configuration to align comment patterns and quotes use +- Added development gems for improved tooling, adjusted gem strategy -- Updates dependencies for enhanced performance and security. -- Improved error handling with Sentry integration and clearer logging. -- Enhanced semantic meaning in modal footer markup. +## [2.0.3] - 2025-04 -## 2.0.2 - 2025-03 +### Changed + +- Updated dependencies for enhanced performance and security +- Improved error handling with Sentry integration and clearer logging +- Enhanced semantic meaning in modal footer markup + +## [2.0.2] - 2025-03 + +### Added + +- Added `rubocop-rails` plugin to `.rubocop.yml` +- Added logging helper for API requests +- Added ability to set log level config from environment variable +- Added pre-commit and pre-push hooks + +### Changed - Enhanced `Sentry` configuration setup - Enhanced `load_query_result` with logging - Enhanced error handling in `save_results` method -- Added `rubocop-rails` plugin to `.rubocop.yml` - Improved logging level where applicable - Updated logging methods for better clarity -- Added logging helper for API requests - Updated Gemfile dependencies - Updated timezone handling in config - Updated boot info logging for Rails compatibility -- Added ability to set log level config from environment variable -- Removed sunset google plusone reference - Updated GitHub workflow versions to v2 -- Added pre-commit and pre-push hooks -## 2.0.1 - 2024-12 +### Removed + +- Removed sunset google plusone reference + +## [2.0.1] - 2024-12 -- (Jon) Updated the error template path to use `Rails.public_path` as well as - contain the `html` extension to ensure the correct template is rendered -- (Jon) Improves error metrics reporting to ensure that logging always happens - with the appropriate severity depending on the exception status while reducing - the types of errors that can trigger a an error metric and therefore a +### Fixed + +- Updated the error template path to use `Rails.public_path` as well as contain + the `html` extension to ensure the correct template is rendered +- Improved error metrics reporting to ensure that logging always happens with + the appropriate severity depending on the exception status while reducing the + types of errors that can trigger a an error metric and therefore a notification in slack [GH-149](https://github.com/epimorphics/hmlr-linked-data/issues/149) -- (Jon) Added catch for missing `SENTRY_API_KEY` env var to `entrypoint.sh` for - docker build -- (Jon) Updated target status level to trigger internal error metrics to 500 - status codes only in the `search_controller` -- (Jon) Added `message`, `status`, and `type` arguments to be logged by the +- Updated target status level to trigger internal error metrics to 500 status + codes only in the `search_controller` + +### Added + +- Added catch for missing `SENTRY_API_KEY` env var to `entrypoint.sh` for docker + build +- Added `message`, `status`, and `type` arguments to be logged by the `json_rails_logger` gem for respective error responses in the `search_controller` -## 2.0.0 - 2024-11 +## [2.0.0] - 2024-11 + +### Changed + +- Updated all gems by regenerating `Gemfile.lock` + - Upgraded alpine to `3.20` + - Upgraded rails to `7.2.2` + - Upgraded ruby to `3.3.5` -- (Bogdan) Updated all gems by regenerating `Gemfile.lock` -- (Bogdan) Upgraded alpine to `3.20` -- (Bogdan) Upgraded rails to `7.2.2` -- (Bogdan) Upgraded ruby to `3.3.5` +--- ## 1.8.0 - 2024-10 diff --git a/Gemfile b/Gemfile index 21bb490..dc2faba 100644 --- a/Gemfile +++ b/Gemfile @@ -23,9 +23,9 @@ gem 'rubocop' gem 'rubocop-rails' gem 'faraday', '~> 2.13' -gem 'faraday-encoding', '~> 0.0.6' -gem 'faraday-follow_redirects', '~> 0.3.0' -gem 'faraday-retry', '~> 2.0' +gem 'faraday-encoding', '>= 0.0.6' +gem 'faraday-follow_redirects', '>= 0.3.0' +gem 'faraday-retry', '>= 2.0' gem 'font-awesome-rails' gem 'get_process_mem' @@ -60,17 +60,15 @@ gem 'dotenv', groups: %i[development test] group :test do gem 'capybara' - gem 'capybara_minitest_spec' - gem 'capybara-selenium' + gem 'csv' gem 'json_expressions' - gem 'minitest-rails' + gem 'minitest-rails', require: false gem 'minitest-reporters' - gem 'minitest-spec-rails' - gem 'minitest-vcr' + gem 'minitest-spec-rails', require: false gem 'mocha' + gem 'selenium-webdriver' gem 'simplecov', require: false gem 'vcr' - gem 'webdrivers' gem 'webmock' end diff --git a/Gemfile.lock b/Gemfile.lock index 476f44a..1307fe8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,29 +10,31 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (8.0.2.1) - actionpack (= 8.0.2.1) - activesupport (= 8.0.2.1) + action_text-trix (2.1.15) + railties + actioncable (8.1.1) + actionpack (= 8.1.1) + activesupport (= 8.1.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (8.0.2.1) - actionpack (= 8.0.2.1) - activejob (= 8.0.2.1) - activerecord (= 8.0.2.1) - activestorage (= 8.0.2.1) - activesupport (= 8.0.2.1) + actionmailbox (8.1.1) + actionpack (= 8.1.1) + activejob (= 8.1.1) + activerecord (= 8.1.1) + activestorage (= 8.1.1) + activesupport (= 8.1.1) mail (>= 2.8.0) - actionmailer (8.0.2.1) - actionpack (= 8.0.2.1) - actionview (= 8.0.2.1) - activejob (= 8.0.2.1) - activesupport (= 8.0.2.1) + actionmailer (8.1.1) + actionpack (= 8.1.1) + actionview (= 8.1.1) + activejob (= 8.1.1) + activesupport (= 8.1.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (8.0.2.1) - actionview (= 8.0.2.1) - activesupport (= 8.0.2.1) + actionpack (8.1.1) + actionview (= 8.1.1) + activesupport (= 8.1.1) nokogiri (>= 1.8.5) rack (>= 2.2.4) rack-session (>= 1.0.1) @@ -40,42 +42,43 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (8.0.2.1) - actionpack (= 8.0.2.1) - activerecord (= 8.0.2.1) - activestorage (= 8.0.2.1) - activesupport (= 8.0.2.1) + actiontext (8.1.1) + action_text-trix (~> 2.1.15) + actionpack (= 8.1.1) + activerecord (= 8.1.1) + activestorage (= 8.1.1) + activesupport (= 8.1.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (8.0.2.1) - activesupport (= 8.0.2.1) + actionview (8.1.1) + activesupport (= 8.1.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (8.0.2.1) - activesupport (= 8.0.2.1) + activejob (8.1.1) + activesupport (= 8.1.1) globalid (>= 0.3.6) - activemodel (8.0.2.1) - activesupport (= 8.0.2.1) - activerecord (8.0.2.1) - activemodel (= 8.0.2.1) - activesupport (= 8.0.2.1) + activemodel (8.1.1) + activesupport (= 8.1.1) + activerecord (8.1.1) + activemodel (= 8.1.1) + activesupport (= 8.1.1) timeout (>= 0.4.0) - activestorage (8.0.2.1) - actionpack (= 8.0.2.1) - activejob (= 8.0.2.1) - activerecord (= 8.0.2.1) - activesupport (= 8.0.2.1) + activestorage (8.1.1) + actionpack (= 8.1.1) + activejob (= 8.1.1) + activerecord (= 8.1.1) + activesupport (= 8.1.1) marcel (~> 1.0) - activesupport (8.0.2.1) + activesupport (8.1.1) base64 - benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + json logger (>= 1.4.2) minitest (>= 5.1) securerandom (>= 0.3) @@ -89,8 +92,8 @@ GEM execjs (~> 2) backport (1.2.0) base64 (0.3.0) - benchmark (0.4.1) - bigdecimal (3.2.2) + benchmark (0.5.0) + bigdecimal (3.3.1) bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) sassc (>= 2.0.0) @@ -105,27 +108,22 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - capybara-selenium (0.0.6) - capybara - selenium-webdriver - capybara_minitest_spec (1.0.7) - capybara (>= 2) - minitest (>= 4) concurrent-ruby (1.3.5) - connection_pool (2.5.3) - crack (1.0.0) + connection_pool (2.5.4) + crack (1.0.1) bigdecimal rexml crass (1.0.6) - date (3.4.1) + csv (3.3.5) + date (3.5.0) diff-lcs (1.6.2) docile (1.4.1) dotenv (3.1.8) drb (2.2.3) - erb (5.0.2) + erb (5.1.3) erubi (1.13.1) execjs (2.10.0) - faraday (2.13.4) + faraday (2.14.0) faraday-net_http (>= 2.0, < 3.5) json logger @@ -151,7 +149,7 @@ GEM get_process_mem (1.0.0) bigdecimal (>= 2.0) ffi (~> 1.0) - globalid (1.2.1) + globalid (1.3.0) activesupport (>= 6.1) govuk_elements_rails (3.0.2) govuk_frontend_toolkit (>= 5.2.0) @@ -161,21 +159,21 @@ GEM railties (>= 3.1.0) govuk_template (0.26.0) rails (>= 3.1) - haml (6.3.0) + haml (7.0.1) temple (>= 0.8.2) thor tilt - haml-rails (2.1.0) + haml-rails (3.0.0) actionpack (>= 5.1) activesupport (>= 5.1) haml (>= 4.0.6) railties (>= 5.1) - hashdiff (1.2.0) + hashdiff (1.2.1) htmlbeautifier (1.4.3) i18n (1.14.7) concurrent-ruby (~> 1.0) io-console (0.8.1) - irb (1.15.2) + irb (1.15.3) pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) @@ -183,13 +181,13 @@ GEM jbuilder (2.14.1) actionview (>= 7.0.0) activesupport (>= 7.0.0) - jquery-rails (4.6.0) + jquery-rails (4.6.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (8.0.0) railties (>= 3.2.16) - json (2.13.2) + json (2.15.2) json_expressions (0.9.0) kramdown (2.5.1) rexml (>= 3.3.9) @@ -214,21 +212,20 @@ GEM 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) + marcel (1.1.0) matrix (0.4.3) memory_profiler (1.1.0) mini_mime (1.1.5) - minispec-metadata (2.0.0) - minitest - minitest (5.25.5) - minitest-rails (8.0.0) + minitest (5.26.0) + minitest-rails (8.1.0) minitest (~> 5.20) - railties (>= 8.0.0, < 8.1.0) + railties (>= 8.1.0, < 8.2.0) minitest-reporters (1.7.1) ansi builder @@ -237,18 +234,14 @@ GEM minitest-spec-rails (7.4.1) minitest (>= 5.0) railties (>= 4.1) - minitest-vcr (1.4.0) - minispec-metadata (~> 2.0) - minitest (>= 4.7.5) - vcr (>= 2.9) mocha (2.7.1) ruby2_keywords (>= 0.0.5) modernizr-rails (2.7.1) modulejs-rails (2.2.0.0) railties (>= 4.0) - net-http (0.6.0) + net-http (0.7.0) uri - net-imap (0.5.9) + net-imap (0.5.12) date net-protocol net-pop (0.1.2) @@ -257,46 +250,46 @@ GEM timeout net-smtp (0.5.1) net-protocol - nio4r (2.7.4) - nokogiri (1.18.9-aarch64-linux-gnu) + nio4r (2.7.5) + nokogiri (1.18.10-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.18.9-aarch64-linux-musl) + nokogiri (1.18.10-aarch64-linux-musl) racc (~> 1.4) - nokogiri (1.18.9-arm-linux-gnu) + nokogiri (1.18.10-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.18.9-arm-linux-musl) + nokogiri (1.18.10-arm-linux-musl) racc (~> 1.4) - nokogiri (1.18.9-arm64-darwin) + nokogiri (1.18.10-arm64-darwin) racc (~> 1.4) - nokogiri (1.18.9-x86_64-darwin) + nokogiri (1.18.10-x86_64-darwin) racc (~> 1.4) - nokogiri (1.18.9-x86_64-linux-gnu) + nokogiri (1.18.10-x86_64-linux-gnu) racc (~> 1.4) - nokogiri (1.18.9-x86_64-linux-musl) + nokogiri (1.18.10-x86_64-linux-musl) racc (~> 1.4) observer (0.1.2) ostruct (0.6.3) parallel (1.27.0) - parser (3.3.9.0) + parser (3.3.10.0) ast (~> 2.4.1) racc - pp (0.6.2) + pp (0.6.3) prettyprint prettyprint (0.2.0) - prism (1.4.0) + prism (1.6.0) prometheus-client (4.2.5) base64 psych (5.2.6) date stringio public_suffix (6.0.2) - puma (6.6.1) + puma (7.1.0) nio4r (~> 2.0) - puma-metrics (1.4.0) + puma-metrics (1.4.2) prometheus-client (>= 0.10) - puma (>= 6.0) + puma (>= 6, != 7.0.0) racc (1.8.1) - rack (3.2.0) + rack (3.2.4) rack-contrib (2.5.0) rack (< 4) rack-session (2.1.1) @@ -306,20 +299,20 @@ GEM rack (>= 1.3) rackup (2.2.1) rack (>= 3) - rails (8.0.2.1) - actioncable (= 8.0.2.1) - actionmailbox (= 8.0.2.1) - actionmailer (= 8.0.2.1) - actionpack (= 8.0.2.1) - actiontext (= 8.0.2.1) - actionview (= 8.0.2.1) - activejob (= 8.0.2.1) - activemodel (= 8.0.2.1) - activerecord (= 8.0.2.1) - activestorage (= 8.0.2.1) - activesupport (= 8.0.2.1) + rails (8.1.1) + actioncable (= 8.1.1) + actionmailbox (= 8.1.1) + actionmailer (= 8.1.1) + actionpack (= 8.1.1) + actiontext (= 8.1.1) + actionview (= 8.1.1) + activejob (= 8.1.1) + activemodel (= 8.1.1) + activerecord (= 8.1.1) + activestorage (= 8.1.1) + activesupport (= 8.1.1) bundler (>= 1.15.0) - railties (= 8.0.2.1) + railties (= 8.1.1) rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest @@ -327,34 +320,36 @@ GEM rails-html-sanitizer (1.6.2) loofah (~> 2.21) 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 (8.0.2.1) - actionpack (= 8.0.2.1) - activesupport (= 8.0.2.1) + railties (8.1.1) + actionpack (= 8.1.1) + activesupport (= 8.1.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.3.0) + rake (13.3.1) rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) rb-readline (0.5.5) - rbs (3.6.1) + rbs (3.9.5) logger - rdoc (6.14.2) + rdoc (6.15.1) erb psych (>= 4.0.0) - regexp_parser (2.11.2) + tsort + regexp_parser (2.11.3) reline (0.6.2) io-console (~> 0.5) request_store (1.7.0) rack (>= 1.4) reverse_markdown (3.0.0) nokogiri - rexml (3.4.2) - rubocop (1.80.0) + rexml (3.4.4) + rubocop (1.81.7) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -362,25 +357,25 @@ GEM parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.46.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.46.0) + rubocop-ast (1.47.1) parser (>= 3.3.7.2) prism (~> 1.4) - rubocop-rails (2.33.3) + rubocop-rails (2.33.4) activesupport (>= 4.2.0) lint_roller (~> 1.1) rack (>= 1.1) rubocop (>= 1.75.0, < 2.0) rubocop-ast (>= 1.44.0, < 2.0) - ruby-lsp (0.26.1) + ruby-lsp (0.26.2) language_server-protocol (~> 3.17.0) prism (>= 1.2, < 2.0) rbs (>= 3, < 5) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - rubyzip (2.4.1) + rubyzip (3.2.2) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) @@ -396,17 +391,19 @@ GEM sprockets (> 3.0) sprockets-rails tilt - sdoc (2.6.1) + sdoc (2.6.5) rdoc (>= 5.0) securerandom (0.4.1) - selenium-webdriver (4.10.0) + 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) - sentry-rails (5.26.0) - railties (>= 5.0) - sentry-ruby (~> 5.26.0) - sentry-ruby (5.26.0) + sentry-rails (6.0.0) + railties (>= 5.2.0) + sentry-ruby (~> 6.0.0) + sentry-ruby (6.0.0) bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) simplecov (0.22.0) @@ -415,7 +412,7 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.13.2) simplecov_json_formatter (0.1.4) - solargraph (0.56.2) + solargraph (0.57.0) backport (~> 1.2) benchmark (~> 0.4) bundler (~> 2.0) @@ -428,12 +425,13 @@ GEM ostruct (~> 0.6) parser (~> 3.0) prism (~> 1.4) - rbs (~> 3.6.1) + rbs (>= 3.6.1, <= 4.0.0.dev.4) reverse_markdown (~> 3.0) - rubocop (~> 1.38) + rubocop (~> 1.76) thor (~> 1.0) tilt (~> 2.0) yard (~> 0.9, >= 0.9.24) + yard-activesupport-concern (~> 0.0) yard-solargraph (~> 0.1) sprockets (4.2.2) concurrent-ruby (~> 1.0) @@ -448,21 +446,18 @@ GEM temple (0.10.4) thor (1.4.0) tilt (2.6.1) - timeout (0.4.3) + timeout (0.4.4) + tsort (0.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (3.1.5) - unicode-emoji (~> 4.0, >= 4.0.4) - unicode-emoji (4.0.4) - uri (1.0.3) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.1.0) + uri (1.1.0) useragent (0.16.11) vcr (6.3.1) base64 - webdrivers (5.3.1) - nokogiri (~> 1.6) - rubyzip (>= 1.3.0) - selenium-webdriver (~> 4.0, < 4.11) - webmock (3.25.1) + webmock (3.26.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -475,6 +470,8 @@ GEM nokogiri (~> 1.8) yajl-ruby (1.4.3) yard (0.9.37) + yard-activesupport-concern (0.0.1) + yard (>= 0.8) yard-solargraph (0.1.0) yard (~> 0.9) zeitwerk (2.7.3) @@ -489,22 +486,22 @@ GEM faraday-retry (~> 2.0) json (~> 2.0) yajl-ruby (~> 1.4) - json_rails_logger (2.0.6) + json_rails_logger (2.2.0) json lograge railties - lr_common_styles (2.3.0) + lr_common_styles (2.3.1) bootstrap-sass (~> 3.4.1) font-awesome-rails (~> 4.7.0) govuk_elements_rails (= 3.0.2) govuk_frontend_toolkit (~> 9.0) govuk_template (~> 0.26.0) - haml-rails (~> 2.1) + haml-rails (~> 3.0) jquery-rails (~> 4.6) lodash-rails (~> 4.17) modernizr-rails (~> 2.7) modulejs-rails (~> 2.2.0) - rails (~> 8.0.0) + rails (~> 8.0) sass-rails (~> 6.0) PLATFORMS @@ -523,15 +520,14 @@ DEPENDENCIES bootstrap-sass byebug capybara - capybara-selenium - capybara_minitest_spec + csv data_services_api! dotenv execjs faraday (~> 2.13) - faraday-encoding (~> 0.0.6) - faraday-follow_redirects (~> 0.3.0) - faraday-retry (~> 2.0) + faraday-encoding (>= 0.0.6) + faraday-follow_redirects (>= 0.3.0) + faraday-retry (>= 2.0) flamegraph font-awesome-rails get_process_mem @@ -549,7 +545,6 @@ DEPENDENCIES minitest-rails minitest-reporters minitest-spec-rails - minitest-vcr mocha ostruct prometheus-client @@ -562,14 +557,14 @@ DEPENDENCIES ruby-lsp sass-rails sdoc + selenium-webdriver sentry-rails simplecov solargraph stackprof vcr - webdrivers webmock yajl-ruby BUNDLED WITH - 2.6.9 + 2.7.2 diff --git a/app/assets/stylesheets/ppd.scss b/app/assets/stylesheets/ppd.scss index e0d20ae..b11af3e 100644 --- a/app/assets/stylesheets/ppd.scss +++ b/app/assets/stylesheets/ppd.scss @@ -196,8 +196,7 @@ $lr-logo-grey: #a7a5a6; height: 20px; min-width: 30px; } - // .twitter { - // } + .facebook { margin-right: 20px; } diff --git a/app/lib/version.rb b/app/lib/version.rb index 033a607..c7fdb88 100644 --- a/app/lib/version.rb +++ b/app/lib/version.rb @@ -3,7 +3,7 @@ module Version MAJOR = 2 MINOR = 2 - PATCH = 2 + PATCH = 3 SUFFIX = nil VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}#{SUFFIX && ".#{SUFFIX}"}".freeze end diff --git a/config/application.rb b/config/application.rb index e25b24e..5c3d813 100644 --- a/config/application.rb +++ b/config/application.rb @@ -31,12 +31,6 @@ class Application < Rails::Application # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # config.time_zone = 'Central Time (US & Canada)' - # !DEPRECATION WARNING: `to_time` will always preserve the full system - # ! timezone offset rather than offset of the receiver in Rails 8.1. - # * To opt in to the new behavior and maintain system timezone, - # * set the value to :zone; otherwise, set to false - config.active_support.to_time_preserves_timezone = :zone - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de diff --git a/config/environments/test.rb b/config/environments/test.rb index 6c9115c..7167ded 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -36,15 +36,18 @@ # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + # Set the log level to the value of the LOG_LEVEL environment variable, or 'info' if not set + config.log_level = ENV.fetch('LOG_LEVEL', 'info').to_sym + # Tag rails logs with useful information config.log_tags = %i[subdomain request_id request_method] + # When sync mode is true, all output is immediately flushed to the underlying # operating system and is not buffered by Ruby internally. $stdout.sync = true + # Log the stdout output to the Epimorphics JSON logging gem - config.logger = JsonRailsLogger::Logger.new($stdout) - # Set the log level to the value of the LOG_LEVEL environment variable, or 'debug' by default - config.log_level = ENV.fetch('LOG_LEVEL', 'debug').to_sym + config.logger = JsonRailsLogger::Logger.new($stdout) if config.log_level == :debug # API location can be specified in the environment # But defaults to the dev service diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index 8a1e68f..d041c99 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -3,43 +3,44 @@ require 'version' Rails.application.reloader.to_prepare do - if ENV['SENTRY_API_KEY'] - Sentry.init do |config| - # https://docs.sentry.io/platforms/ruby/configuration/options/#breadcrumbs-logger - config.breadcrumbs_logger = %i[sentry_logger monotonic_active_support_logger http_logger] - # * The DSN tells the SDK where to send events. - config.dsn = ENV['SENTRY_API_KEY'] - # ! Only report errors in these environments: - config.enabled_environments = %w[production prod preprod dev] - # ! Ignore exceptions that are not useful to us - config.excluded_exceptions += [ - 'ActionController::BadRequest', - 'ActionController::RoutingError', - 'ActiveRecord::RecordNotFound' - ] - # * Set the environment name from the SENTRY_ENVIRONMENT instance configuration value - config.environment = ENV.fetch('SENTRY_ENVIRONMENT', Rails.env) - # ^ Default to only reporting info, warnings and errors to Sentry - config.logger.level = Rails.application.config.log_level || :info - # * Set the release version to the current version - config.release = Version::VERSION - # * Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing. - config.traces_sample_rate = Rails.env.development? ? 1.0 : 0.1 - # ! Sentry recommends adjusting this value in production hence the ternary operator. - # * Set profiles_sample_rate to profile 100% of sampled transactions. - config.profiles_sample_rate = Rails.env.production? ? 1.0 : 0.1 - # ! Sentry recommends adjusting this value in production hence the ternary operator. - end - - # * Set additional tags for the Sentry event to allow for better filtering in the Sentry UI - # ? These tags are set in either a local .env file or the instance configuration - # ! `.compact!` removes any nil values from the sentry_tags hash before setting the tags - sentry_tags = { - 'band' => ENV.fetch('SENTRY_BAND', nil), - 'enabled' => ENV.fetch('SENTRY_ENABLED', nil), - 'hostname' => ENV.fetch('SENTRY_HOSTNAME', nil) - }.compact! - # * Set the tags in the Sentry event with remaining values but only if there are any - sentry_tags&.each { |k, v| Sentry.set_tags(k.to_s => v) } + Sentry.init do |config| + # https://docs.sentry.io/platforms/ruby/configuration/options/#breadcrumbs-logger + config.breadcrumbs_logger = %i[sentry_logger monotonic_active_support_logger http_logger] + # * The DSN tells the SDK where to send events. + # ! By default, events will be sent to Sentry in all environments. + #! If you don't want to send events in a specific environment, + #! you can unset the SENTRY_DSN [SENTRY_API_KEY] variable in that environment. + config.dsn = ENV['SENTRY_API_KEY'] + # ! Only report errors in these environments: + config.enabled_environments = %w[production prod preprod dev] + # ! Ignore exceptions that are not useful to us + config.excluded_exceptions += [ + 'ActionController::BadRequest', + 'ActionController::RoutingError', + 'ActiveRecord::RecordNotFound' + ] + # * Set the environment name from the SENTRY_ENVIRONMENT instance configuration value + config.environment = ENV.fetch('SENTRY_ENVIRONMENT', Rails.env) + # ^ Default to only reporting info, warnings and errors to Sentry + config.sdk_logger.level = Rails.application.config.log_level || :info + # * Set the release version to the current version + config.release = Version::VERSION + # * Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing. + config.traces_sample_rate = Rails.env.development? ? 1.0 : 0.1 + # ! Sentry recommends adjusting this value in production hence the ternary operator. + # * Set profiles_sample_rate to profile 100% of sampled transactions. + config.profiles_sample_rate = Rails.env.production? ? 1.0 : 0.1 + # ! Sentry recommends adjusting this value in production hence the ternary operator. end + + # * Set additional tags for the Sentry event to allow for better filtering in the Sentry UI + # ? These tags are set in either a local .env file or the instance configuration + # ! `.compact!` removes any nil values from the sentry_tags hash before setting the tags + sentry_tags = { + 'band' => ENV.fetch('SENTRY_BAND', nil), + 'enabled' => ENV.fetch('SENTRY_ENABLED', nil), + 'hostname' => ENV.fetch('SENTRY_HOSTNAME', nil) + }.compact! + # * Set the tags in the Sentry event with remaining values but only if there are any + sentry_tags&.each { |k, v| Sentry.set_tags(k.to_s => v) } end diff --git a/test/controllers/ppd_controller_test.rb b/test/controllers/ppd_controller_test.rb index 5cce613..19ea95f 100644 --- a/test/controllers/ppd_controller_test.rb +++ b/test/controllers/ppd_controller_test.rb @@ -2,7 +2,7 @@ require 'test_helper' -class PpdControllerTest < ActionController::IntegrationTest +class PpdControllerTest < ActionDispatch::IntegrationTest # test "the truth" do # assert true # end diff --git a/test/controllers/ppd_data_controller_test.rb b/test/controllers/ppd_data_controller_test.rb index 952f8dd..8a4a75d 100644 --- a/test/controllers/ppd_data_controller_test.rb +++ b/test/controllers/ppd_data_controller_test.rb @@ -36,9 +36,9 @@ class PpdDataControllerTest < ActionDispatch::IntegrationTest download_file = File.new(DownloadHelpers.download) assert File.exist?(download_file) csv = CSV.read(download_file) - _(csv).must_be_kind_of Array - _(csv.first).must_be_kind_of Array - _(csv.length).must_be :>, 10 + assert_kind_of Array, csv + assert_kind_of Array, csv.first + assert_operator csv.length, :>, 10 end end @@ -53,12 +53,12 @@ class PpdDataControllerTest < ActionDispatch::IntegrationTest download_file = File.new(DownloadHelpers.download) assert File.exist?(download_file) csv = CSV.read(download_file) - _(csv).must_be_kind_of Array - _(csv.first).must_be_kind_of Array - _(csv.length).must_be :>, 10 + assert_kind_of Array, csv + assert_kind_of Array, csv.first + assert_operator csv.length, :>, 10 headers = csv.first - _(headers.first).must_equal 'unique_id' + assert_equal 'unique_id', headers.first end end @@ -76,9 +76,9 @@ class PpdDataControllerTest < ActionDispatch::IntegrationTest download_file = File.new(DownloadHelpers.download) csv = CSV.read(download_file) - _(csv).must_be_kind_of Array - _(csv.first).must_be_kind_of Array - _(csv.length).must_be :>, 1000 + assert_kind_of Array, csv + assert_kind_of Array, csv.first + assert_operator csv.length, :>, 1000 end end end diff --git a/test/controllers/search_controller_test.rb b/test/controllers/search_controller_test.rb index 8746227..ec6a20f 100644 --- a/test/controllers/search_controller_test.rb +++ b/test/controllers/search_controller_test.rb @@ -22,12 +22,12 @@ class SearchControllerTest < ActionDispatch::IntegrationTest .summarise .match(/Showing (\d+) transactions \(from (\d*) or more matching transactions\) for (\d+) properties/) - _(query_command.size).must_equal 10 + assert_equal 10, query_command.size assert match - _(match[1].to_i).must_equal 10 - _(match[2].to_i).must_be(:>, 0) - _(match[3].to_i).must_be(:>, 0) + assert_equal 10, match[1].to_i + assert_operator match[2].to_i, :>, 0 + assert_operator match[3].to_i, :>, 0 end end end diff --git a/test/lib/auto_extend_hash_test.rb b/test/lib/auto_extend_hash_test.rb index e9f5874..4cf50b7 100644 --- a/test/lib/auto_extend_hash_test.rb +++ b/test/lib/auto_extend_hash_test.rb @@ -12,8 +12,8 @@ class AutoExtendHashTest < ActiveSupport::TestCase it 'should create a hash that auto-extends' do auto_hash = AutoExtendHash.new - assert_not auto_hash.key?(:foo) - _(auto_hash[:foo]).wont_be_nil + refute auto_hash.key?(:foo) + refute_nil auto_hash[:foo] assert auto_hash.key?(:foo) end end @@ -22,17 +22,17 @@ class AutoExtendHashTest < ActiveSupport::TestCase it 'should allow assignment to a new key like a normal hash' do auto_hash = AutoExtendHash.new - assert_not auto_hash.key?(:foo) + refute auto_hash.key?(:foo) auto_hash[:foo] = :bar assert auto_hash.key?(:foo) - _(auto_hash[:foo]).must_equal :bar + assert_equal :bar, auto_hash[:foo] end it 'should support nested accesses' do auto_hash = AutoExtendHash.new auto_hash[:foo][:fubar][:rabuf] = :bar - _(auto_hash[:foo][:fubar][:rabuf]).must_equal :bar + assert_equal :bar, auto_hash[:foo][:fubar][:rabuf] end end @@ -40,12 +40,12 @@ class AutoExtendHashTest < ActiveSupport::TestCase it 'should allow an existing hash to be converted to auto-extend behaviour' do orig = {} - assert_not orig.key?(:foo) + refute orig.key?(:foo) orig[:foo] - assert_not orig.key?(:foo) + refute orig.key?(:foo) AutoExtendHash.auto_extend(orig) - assert_not orig.key?(:foo) + refute orig.key?(:foo) orig[:foo] assert orig.key?(:foo) end @@ -54,26 +54,26 @@ class AutoExtendHashTest < ActiveSupport::TestCase orig = {} AutoExtendHash.auto_extend(orig) - assert_not orig.key?(:foo) + refute orig.key?(:foo) orig[:foo][:bar] = 'wombles' - _(orig[:foo][:bar]).must_equal 'wombles' + assert_equal 'wombles', orig[:foo][:bar] end it 'should convert nested hashes to auto-extend' do orig = { foo: {} } AutoExtendHash.auto_extend(orig) - assert_not orig[:foo].key?(:bar) + refute orig[:foo].key?(:bar) orig[:foo][:bar][:fubar] = 'wombles' - _(orig[:foo][:bar][:fubar]).must_equal 'wombles' + assert_equal 'wombles', orig[:foo][:bar][:fubar] end it 'should not change existing default_proc behaviour' do orig = Hash.new { |hash, key| hash[key] = :chewbacca } AutoExtendHash.auto_extend(orig) - assert_not orig.key?(:foo) - _(orig[:foo]).must_equal :chewbacca + refute orig.key?(:foo) + assert_equal :chewbacca, orig[:foo] end end end diff --git a/test/models/aspect_test.rb b/test/models/aspect_test.rb index c7bcfbf..ee77265 100644 --- a/test/models/aspect_test.rb +++ b/test/models/aspect_test.rb @@ -20,12 +20,12 @@ it 'should check just the key for presence in the parameters' do aspect = Aspect.new(:street, 'foo:bar') assert aspect.present?(UserPreferences.new(params_object('street' => 'bar'))) - assert_not aspect.present?(UserPreferences.new(params_object('town' => 'bar'))) + refute aspect.present?(UserPreferences.new(params_object('town' => 'bar'))) end it 'should not be present if all values are given' do aspect = Aspect.new(:street, 'foo:bar', values: %w[a b c]) - assert_not aspect.present?(UserPreferences.new(params_object('street' => %w[a b c]))) + refute aspect.present?(UserPreferences.new(params_object('street' => %w[a b c]))) end it 'should return a preference value' do diff --git a/test/models/user_preferences_test.rb b/test/models/user_preferences_test.rb index 568c040..ea73445 100644 --- a/test/models/user_preferences_test.rb +++ b/test/models/user_preferences_test.rb @@ -17,19 +17,19 @@ it 'should report a parameter as present, or not' do prefs = UserPreferences.new(params_object('street' => 'bar')) assert prefs.present?(:street) - assert_not prefs.present?(:town) + refute prefs.present?(:town) end it 'should report a parameter as present with a given value, or not' do prefs = UserPreferences.new(params_object('street' => 'bar')) assert prefs.present?(:street, 'bar') - assert_not prefs.present?(:street, 'blam') + refute prefs.present?(:street, 'blam') end it 'should report a parameter as present, with a list of values, or not' do prefs = UserPreferences.new(params_object('nb' => %w[true false])) assert prefs.present?(:nb, 'true') assert prefs.present?(:nb, 'false') - assert_not prefs.present?(:nb, 'flimflam') + refute prefs.present?(:nb, 'flimflam') end end diff --git a/test/test_helper.rb b/test/test_helper.rb index d3fe0df..26c4278 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,6 +2,8 @@ # ActiveSupport::TestCase < Minitest::Test # In your test_helper.rb you must have require "rails/test_help" +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../config/environment', __dir__) require 'rails/test_help' require 'simplecov' @@ -10,11 +12,16 @@ add_filter '/config/' end -ENV['RAILS_ENV'] ||= 'test' -require File.expand_path('../config/environment', __dir__) +# Fix compatibility with gems that expect the old MiniTest constant +# This needs to be set before requiring any minitest gems +MiniTest = Minitest unless defined?(MiniTest) +# Require minitest gems carefully to avoid conflicts require 'minitest/rails' +# Load spec functionality without conflicting parallelize support +require 'minitest/spec' + require 'mocha/minitest' require 'json_expressions/minitest' require 'download_helpers' @@ -26,6 +33,18 @@ require 'minitest/reporters' Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new +# Include Capybara DSL in test classes +class ActionDispatch::IntegrationTest + include Capybara::DSL + include Capybara::Minitest::Assertions + + def teardown + super + Capybara.reset_sessions! + Capybara.use_default_driver + end +end + def params_object(params) ActionController::Parameters.new(params) end