diff --git a/Gemfile b/Gemfile index 70dee9790..45e7689f8 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" ruby "~> 3.3.6" -gem "rails", "7.2.2.1" +gem "rails", "8.0.1" gem "bootsnap", require: false gem "dalli" diff --git a/Gemfile.lock b/Gemfile.lock index 90bc66d50..aec818ca5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,66 +1,65 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.2.2.1) - actionpack (= 7.2.2.1) - activesupport (= 7.2.2.1) + actioncable (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.2.1) - actionpack (= 7.2.2.1) - activejob (= 7.2.2.1) - activerecord (= 7.2.2.1) - activestorage (= 7.2.2.1) - activesupport (= 7.2.2.1) + actionmailbox (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) mail (>= 2.8.0) - actionmailer (7.2.2.1) - actionpack (= 7.2.2.1) - actionview (= 7.2.2.1) - activejob (= 7.2.2.1) - activesupport (= 7.2.2.1) + actionmailer (8.0.1) + actionpack (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activesupport (= 8.0.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.2.1) - actionview (= 7.2.2.1) - activesupport (= 7.2.2.1) + actionpack (8.0.1) + actionview (= 8.0.1) + activesupport (= 8.0.1) nokogiri (>= 1.8.5) - racc - rack (>= 2.2.4, < 3.2) + rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (7.2.2.1) - actionpack (= 7.2.2.1) - activerecord (= 7.2.2.1) - activestorage (= 7.2.2.1) - activesupport (= 7.2.2.1) + actiontext (8.0.1) + actionpack (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.2.1) - activesupport (= 7.2.2.1) + actionview (8.0.1) + activesupport (= 8.0.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.2.1) - activesupport (= 7.2.2.1) + activejob (8.0.1) + activesupport (= 8.0.1) globalid (>= 0.3.6) - activemodel (7.2.2.1) - activesupport (= 7.2.2.1) - activerecord (7.2.2.1) - activemodel (= 7.2.2.1) - activesupport (= 7.2.2.1) + activemodel (8.0.1) + activesupport (= 8.0.1) + activerecord (8.0.1) + activemodel (= 8.0.1) + activesupport (= 8.0.1) timeout (>= 0.4.0) - activestorage (7.2.2.1) - actionpack (= 7.2.2.1) - activejob (= 7.2.2.1) - activerecord (= 7.2.2.1) - activesupport (= 7.2.2.1) + activestorage (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activesupport (= 8.0.1) marcel (~> 1.0) - activesupport (7.2.2.1) + activesupport (8.0.1) base64 benchmark (>= 0.3) bigdecimal @@ -72,6 +71,7 @@ GEM minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) ansi (1.5.0) @@ -500,20 +500,20 @@ GEM rack (>= 1.0, < 4.0) rackup (2.2.1) rack (>= 3) - rails (7.2.2.1) - actioncable (= 7.2.2.1) - actionmailbox (= 7.2.2.1) - actionmailer (= 7.2.2.1) - actionpack (= 7.2.2.1) - actiontext (= 7.2.2.1) - actionview (= 7.2.2.1) - activejob (= 7.2.2.1) - activemodel (= 7.2.2.1) - activerecord (= 7.2.2.1) - activestorage (= 7.2.2.1) - activesupport (= 7.2.2.1) + rails (8.0.1) + actioncable (= 8.0.1) + actionmailbox (= 8.0.1) + actionmailer (= 8.0.1) + actionpack (= 8.0.1) + actiontext (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activemodel (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) bundler (>= 1.15.0) - railties (= 7.2.2.1) + railties (= 8.0.1) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -525,17 +525,17 @@ 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) - rails-i18n (7.0.10) + rails-i18n (8.0.1) i18n (>= 0.7, < 2) - railties (>= 6.0.0, < 8) + railties (>= 8.0.0, < 9) rails_translation_manager (1.8.0) activesupport csv (~> 3.2) i18n-tasks rails-i18n - railties (7.2.2.1) - actionpack (= 7.2.2.1) - activesupport (= 7.2.2.1) + railties (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -649,6 +649,7 @@ GEM unicode-display_width (3.1.4) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) + uri (1.0.2) useragent (0.16.11) webmock (3.25.0) addressable (>= 2.8.0) @@ -692,7 +693,7 @@ DEPENDENCIES plek pry-byebug rack-utf8_sanitizer - rails (= 7.2.2.1) + rails (= 8.0.1) rails-controller-testing rails-i18n rails_translation_manager diff --git a/config/application.rb b/config/application.rb index 4a375aff0..a874352c5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -22,7 +22,7 @@ module GovernmentFrontend class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 7.2 + config.load_defaults 8.0 # Please, add to the `ignore` list any other `lib` subdirectories that do # not contain `.rb` files, or that should not be reloaded or eager loaded. diff --git a/config/environments/development.rb b/config/environments/development.rb index 77abae0e9..6c372c845 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -3,9 +3,7 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # In the development environment your application's code is reloaded any time - # it changes. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. + # Make code changes take effect immediately without server restart. config.enable_reloading = true # Do not eager load code on boot. @@ -17,8 +15,8 @@ # Enable server timing. config.server_timing = true - # Enable/disable caching. By default caching is disabled. - # Run rails dev:cache to toggle caching. + # Enable/disable Action Controller caching. By default Action Controller caching is disabled. + # Run rails dev:cache to toggle Action Controller caching. if Rails.root.join("tmp/caching-dev.txt").exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true @@ -49,7 +47,7 @@ config.assets.digest = false # Raises error for missing translations. - # config.i18n.raise_on_missing_translations = true + config.i18n.raise_on_missing_translations = true # Annotate rendered view with file names. config.action_view.annotate_rendered_view_with_filenames = true @@ -57,7 +55,7 @@ config.hosts.clear # Raise error when a before_action's only/except options reference missing actions. - config.action_controller.raise_on_missing_callback_actions = false + config.action_controller.raise_on_missing_callback_actions = true # Apply autocorrection by RuboCop to files generated by `bin/rails generate`. config.generators.apply_rubocop_autocorrect_after_generate! diff --git a/config/environments/production.rb b/config/environments/production.rb index 5e0ef543d..a7f8949bf 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -6,21 +6,21 @@ # Code is not reloaded between requests. config.enable_reloading = false - # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both threaded web servers - # and those relying on copy on write to perform better. - # Rake tasks automatically ignore this option for performance. + # Eager load code on boot for better performance and memory savings (ignored by Rake tasks). config.eager_load = true - # Full error reports are disabled and caching is turned on. + # Full error reports are disabled. config.consider_all_requests_local = false + + # Turn on fragment caching in view templates. config.action_controller.perform_caching = true # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files). # config.require_master_key = true - # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead. + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress JS using a preprocessor. @@ -35,12 +35,7 @@ # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.asset_host = "http://assets.example.com" - # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache - # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX - # Assume all access to the app is happening through a SSL-terminating reverse proxy. - # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies. # config.assume_ssl = true # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. @@ -49,18 +44,33 @@ # Skip http-to-https redirect for the default health check endpoint. # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } } + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new($stdout) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + # Prepend all log lines with the following tags. config.log_tags = [:request_id] + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + # "info" includes generic and useful information about system operation, but avoids logging too much # information to avoid inadvertent exposure of personally identifiable information (PII). If you # want to log everything, set the level to "debug". config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") - # Use a different cache store in production. + # Prevent health checks from clogging up the logs. + config.silence_healthcheck_path = "/healthcheck/live" + + # Don't log any deprecations. + config.active_support.report_deprecations = false + + # Replace the default in-process memory cache store with a durable alternative. config.cache_store = :mem_cache_store, nil, { namespace: :government_frontend, compress: true } - # Use a real queuing backend for Active Job (and separate queues per environment). + # Replace the default in-process and non-durable queuing backend for Active Job. # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "government_frontend_production" @@ -68,19 +78,12 @@ # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true - # Don't log any deprecations. - config.active_support.report_deprecations = false - - # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new - - # Use a different logger for distributed setups. - # require "syslog/logger" - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") - - if ENV["RAILS_LOG_TO_STDOUT"].present? - logger = ActiveSupport::Logger.new($stdout) - logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) - end + # Enable DNS rebinding protection and other `Host` header attacks. + # config.hosts = [ + # "example.com", # Allow requests from example.com + # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com` + # ] + # + # Skip DNS rebinding protection for the default health check endpoint. + # config.host_authorization = { exclude: ->(request) { request.path == "/up" } } end diff --git a/config/environments/test.rb b/config/environments/test.rb index 1998bce13..a7f07120b 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -18,14 +18,13 @@ config.eager_load = ENV["CI"].present? # Configure public file server for tests with Cache-Control for performance. - config.public_file_server.enabled = true config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}", } + config.public_file_server.enabled = true - # Show full error reports and disable caching. + # Show full error reports. config.consider_all_requests_local = true - config.action_controller.perform_caching = false config.cache_store = :null_store # Raise exceptions instead of rendering exception templates. @@ -34,6 +33,8 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + config.action_controller.perform_caching = false + # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 454d31412..487324424 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -5,8 +5,3 @@ # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path - -# Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in the app/assets -# folder are already added. -# Rails.application.config.assets.precompile += %w[webchat/library.js webchat.js] diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 166997c5a..91cf7d6c0 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,8 +1,8 @@ # Be sure to restart your server when you modify this file. -# Configure parameters to be filtered from the log file. Use this to limit dissemination of -# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported -# notations and behaviors. +# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. +# Use this to limit dissemination of sensitive information. +# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. Rails.application.config.filter_parameters += %i[ - passw secret token _key crypt salt certificate otp ssn + password passw email secret token _key crypt salt certificate otp ssn cvv cvc ] diff --git a/test/integration/answer_test.rb b/test/integration/answer_test.rb index e7c650b91..bce36435f 100644 --- a/test/integration/answer_test.rb +++ b/test/integration/answer_test.rb @@ -2,7 +2,7 @@ class AnswerTest < ActionDispatch::IntegrationTest test "random but valid items do not error" do - setup_and_visit_random_content_item + assert_nothing_raised { setup_and_visit_random_content_item } end test "renders title and body" do diff --git a/test/integration/case_study_test.rb b/test/integration/case_study_test.rb index 721b26c7c..f6d70f2b7 100644 --- a/test/integration/case_study_test.rb +++ b/test/integration/case_study_test.rb @@ -2,7 +2,7 @@ class CaseStudyTest < ActionDispatch::IntegrationTest test "random but valid items do not error" do - setup_and_visit_random_content_item + assert_nothing_raised { setup_and_visit_random_content_item } end test "translated case study" do diff --git a/test/integration/contact_test.rb b/test/integration/contact_test.rb index 58344b66e..05743a4e2 100644 --- a/test/integration/contact_test.rb +++ b/test/integration/contact_test.rb @@ -2,7 +2,7 @@ class ContactTest < ActionDispatch::IntegrationTest test "random but valid items do not error" do - setup_and_visit_random_content_item + assert_nothing_raised { setup_and_visit_random_content_item } end test "online forms are rendered" do @@ -83,14 +83,32 @@ class ContactTest < ActionDispatch::IntegrationTest end test "has GA4 tracking on the webchat available link" do - setup_and_visit_content_item("contact", { base_path: "/government/organisations/hm-passport-office/contact/hm-passport-office-webchat", details: { "more_info_webchat": "

Some HTML

\n" } }) + assert_nothing_raised do + setup_and_visit_content_item( + "contact", + { + base_path: "/government/organisations/hm-passport-office/contact/hm-passport-office-webchat", + details: { "more_info_webchat": "

Some HTML

\n" }, + }, + ) + end assert_selector ".js-webchat-advisers-available a[data-module=ga4-link-tracker]" assert_selector ".js-webchat-advisers-available a[data-ga4-link='{\"event_name\":\"navigation\",\"type\":\"webchat\",\"text\":\"Speak to an adviser now\"}']" end test "has English text for GA4 on the webchat available link, even if the link is in another language" do - setup_and_visit_content_item("contact", { locale: "cy", base_path: "/government/organisations/hm-passport-office/contact/hm-passport-office-webchat", details: { "more_info_webchat": "

Some HTML

\n" } }) + assert_nothing_raised do + setup_and_visit_content_item( + "contact", + { + locale: "cy", + base_path: "/government/organisations/hm-passport-office/contact/hm-passport-office-webchat", + details: { "more_info_webchat": "

Some HTML

\n" }, + }, + ) + end + assert_selector ".js-webchat-advisers-available a[data-module=ga4-link-tracker]" assert_selector ".js-webchat-advisers-available a[data-ga4-link='{\"event_name\":\"navigation\",\"type\":\"webchat\",\"text\":\"Speak to an adviser now\"}']" assert_selector ".js-webchat-advisers-available a", text: "Siaradwch รข chynghorydd nawr" diff --git a/test/integration/detailed_guide_test.rb b/test/integration/detailed_guide_test.rb index be34f53fd..bfd4dc12e 100644 --- a/test/integration/detailed_guide_test.rb +++ b/test/integration/detailed_guide_test.rb @@ -2,7 +2,7 @@ class DetailedGuideTest < ActionDispatch::IntegrationTest test "random but valid items do not error" do - setup_and_visit_random_content_item + assert_nothing_raised { setup_and_visit_random_content_item } end test "detailed guide" do diff --git a/test/integration/guide_test.rb b/test/integration/guide_test.rb index 3454fa085..57dd3dda6 100644 --- a/test/integration/guide_test.rb +++ b/test/integration/guide_test.rb @@ -2,7 +2,7 @@ class GuideTest < ActionDispatch::IntegrationTest test "random but valid items do not error" do - setup_and_visit_random_content_item + assert_nothing_raised { setup_and_visit_random_content_item } end test "guide header and navigation" do @@ -167,7 +167,7 @@ class GuideTest < ActionDispatch::IntegrationTest content_item = setup_and_visit_voting_guide first_part = content_item["details"]["parts"].first - assert_selector "h1", text: first_part["title"] + assert_nothing_raised { assert_selector "h1", text: first_part["title"] } part_titles = content_item["details"]["parts"].drop(1).map { |part| part["title"] } part_titles.each do |part_title| diff --git a/test/integration/html_publication_test.rb b/test/integration/html_publication_test.rb index 06c886196..c936b9db6 100644 --- a/test/integration/html_publication_test.rb +++ b/test/integration/html_publication_test.rb @@ -2,14 +2,15 @@ class HtmlPublicationTest < ActionDispatch::IntegrationTest test "random but valid items do not error" do - setup_and_visit_random_content_item + assert_nothing_raised { setup_and_visit_random_content_item } end test "html publications" do setup_and_visit_html_publication("published") within ".gem-c-inverse-header" do - assert page.has_text?(@content_item["details"]["format_sub_type"]) + format_sub_type = @content_item["details"]["format_sub_type"] + assert page.has_text?(format_sub_type) if format_sub_type.present? assert page.has_text?(@content_item["title"]) assert page.has_text?("Published 17 January 2016") diff --git a/test/integration/publication_test.rb b/test/integration/publication_test.rb index 35a621d9e..bd8e47dc5 100644 --- a/test/integration/publication_test.rb +++ b/test/integration/publication_test.rb @@ -2,7 +2,7 @@ class PublicationTest < ActionDispatch::IntegrationTest test "random but valid items do not error" do - setup_and_visit_random_content_item(document_type: "statutory_guidance") + assert_nothing_raised { setup_and_visit_random_content_item(document_type: "statutory_guidance") } end test "publication" do diff --git a/test/integration/service_manual_guide_test.rb b/test/integration/service_manual_guide_test.rb index 6b064f81e..5a1488375 100644 --- a/test/integration/service_manual_guide_test.rb +++ b/test/integration/service_manual_guide_test.rb @@ -74,7 +74,7 @@ class ServiceManualGuideTest < ActionDispatch::IntegrationTest setup_and_visit_content_item("service_manual_guide") within(".app-change-history") do - assert_text "Last update:\n9 October 2015" + assert_nothing_raised { assert_text "Last update:\n9 October 2015" } end end diff --git a/test/integration/service_manual_service_standard_test.rb b/test/integration/service_manual_service_standard_test.rb index 2c529b38a..2bc1f4700 100644 --- a/test/integration/service_manual_service_standard_test.rb +++ b/test/integration/service_manual_service_standard_test.rb @@ -39,7 +39,7 @@ class ServiceManualServiceStandardTest < ActionDispatch::IntegrationTest end test "each point has an anchor tag so that they can be linked to externally" do - setup_and_visit_content_item("service_manual_service_standard") + assert_nothing_raised { setup_and_visit_content_item("service_manual_service_standard") } within("#criterion-1") do assert_text("1.\nUnderstand user needs") diff --git a/test/integration/specialist_document_test.rb b/test/integration/specialist_document_test.rb index 1acca926b..e6b6a6729 100644 --- a/test/integration/specialist_document_test.rb +++ b/test/integration/specialist_document_test.rb @@ -2,10 +2,12 @@ class SpecialistDocumentTest < ActionDispatch::IntegrationTest test "random specialist document schema formats do not error" do - setup_and_visit_random_content_item(document_type: "aaib_report") - setup_and_visit_random_content_item(document_type: "raib_report") - setup_and_visit_random_content_item(document_type: "tax_tribunal_decision") - setup_and_visit_random_content_item(document_type: "cma_case") + assert_nothing_raised do + setup_and_visit_random_content_item(document_type: "aaib_report") + setup_and_visit_random_content_item(document_type: "raib_report") + setup_and_visit_random_content_item(document_type: "tax_tribunal_decision") + setup_and_visit_random_content_item(document_type: "cma_case") + end end test "renders title, description and body" do diff --git a/test/integration/statistics_announcement_test.rb b/test/integration/statistics_announcement_test.rb index 10182b502..9f49bd8b8 100644 --- a/test/integration/statistics_announcement_test.rb +++ b/test/integration/statistics_announcement_test.rb @@ -58,7 +58,9 @@ class StatisticsAnnouncementTest < ActionDispatch::IntegrationTest setup_and_visit_content_item("official_statistics") within(".gem-c-notice") do - assert_text "#{StatisticsAnnouncementPresenter::FORTHCOMING_NOTICE} on #{@content_item['details']['display_date']}" + assert_nothing_raised do + assert_text "#{StatisticsAnnouncementPresenter::FORTHCOMING_NOTICE} on #{@content_item['details']['display_date']}" + end end end diff --git a/test/integration/topical_event_about_page_test.rb b/test/integration/topical_event_about_page_test.rb index 4ae748449..ce4e69286 100644 --- a/test/integration/topical_event_about_page_test.rb +++ b/test/integration/topical_event_about_page_test.rb @@ -2,7 +2,7 @@ class TopicalEventAboutPageTest < ActionDispatch::IntegrationTest test "random but valid items do not error" do - setup_and_visit_random_content_item + assert_nothing_raised { setup_and_visit_random_content_item } end test "topical event about pages" do diff --git a/test/integration/working_group_test.rb b/test/integration/working_group_test.rb index 2124b96d0..de85c99e1 100644 --- a/test/integration/working_group_test.rb +++ b/test/integration/working_group_test.rb @@ -2,7 +2,7 @@ class WorkingGroupTest < ActionDispatch::IntegrationTest test "random but valid items do not error" do - setup_and_visit_random_content_item + assert_nothing_raised { setup_and_visit_random_content_item } end test "working groups" do diff --git a/test/presenters/content_item/organisation_branding_test.rb b/test/presenters/content_item/organisation_branding_test.rb index f79912232..c54ab45db 100644 --- a/test/presenters/content_item/organisation_branding_test.rb +++ b/test/presenters/content_item/organisation_branding_test.rb @@ -3,7 +3,7 @@ class ContentItemOrganisationBrandingTest < ActiveSupport::TestCase include ContentItem::OrganisationBranding - def test_organisation + def tested_organisation { "base_path" => "/base-path", "details" => { @@ -17,23 +17,23 @@ def test_organisation end test "presents the logo for organisations" do - logo = organisation_logo(test_organisation) + logo = organisation_logo(tested_organisation) - assert_equal logo[:organisation][:brand], test_organisation["details"]["brand"] - assert_equal logo[:organisation][:url], test_organisation["base_path"] - assert_equal logo[:organisation][:crest], test_organisation["details"]["logo"]["crest"] - assert_equal logo[:organisation][:name], test_organisation["details"]["logo"]["formatted_title"] + assert_equal logo[:organisation][:brand], tested_organisation["details"]["brand"] + assert_equal logo[:organisation][:url], tested_organisation["base_path"] + assert_equal logo[:organisation][:crest], tested_organisation["details"]["logo"]["crest"] + assert_equal logo[:organisation][:name], tested_organisation["details"]["logo"]["formatted_title"] end test "presents the brand colour class for organisations" do - assert_equal "department-of-health-brand-colour", organisation_brand_class(test_organisation) + assert_equal "department-of-health-brand-colour", organisation_brand_class(tested_organisation) end test "alters the brand for organisations with an executive order crest" do - organisation = test_organisation + organisation = tested_organisation organisation["details"]["logo"]["crest"] = "eo" - assert_not_equal organisation_brand(organisation), test_organisation["details"]["brand"] + assert_not_equal organisation_brand(organisation), tested_organisation["details"]["brand"] assert_equal organisation_brand(organisation), "executive-office" end @@ -45,7 +45,7 @@ def test_organisation end test "includes an image organisations with a custom logo" do - organisation = test_organisation + organisation = tested_organisation organisation["details"]["logo"]["image"] = { "url" => "url", "alt_text" => "alt_text",