From cc3b8c917c825bac3e7861ce70015d00a764e2d6 Mon Sep 17 00:00:00 2001 From: Vasili Kachalko Date: Wed, 1 Nov 2023 09:44:52 +0100 Subject: [PATCH 01/20] upgrade ruby to 3.2.2 --- .github/workflows/ci.yml | 2 +- .ruby-version | 2 +- Dockerfile | 4 ++-- Gemfile | 2 +- Gemfile.lock | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05c02ad16..ba15c5042 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7.7 + ruby-version: 3.2.2 - uses: actions/setup-node@v2-beta with: node-version: '12' diff --git a/.ruby-version b/.ruby-version index 1f7da99d4..be94e6f53 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.7 +3.2.2 diff --git a/Dockerfile b/Dockerfile index d10cf70ba..cf81d00dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -ARG RUBY_VERSION=2.7.7 +ARG RUBY_VERSION=3.2.2 -FROM ruby:2.7.7 +FROM ruby:${RUBY_VERSION} ENV HOME=/app WORKDIR /app diff --git a/Gemfile b/Gemfile index a1170f438..d5a976f45 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' git_source(:github) { |name| "https://github.com/#{name}.git" } -ruby '~> 2.7.7' +ruby '~> 3.2.2' gem 'rails', '6.1.7.1' gem 'websocket-extensions', '~> 0.1.5' diff --git a/Gemfile.lock b/Gemfile.lock index 89bbcb83a..5128a7712 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -185,8 +185,8 @@ GEM database_cleaner-core (2.0.1) date (3.3.3) debug_inspector (1.1.0) - decent_decoration (0.1.0) - decent_exposure (~> 3.0) + decent_decoration (0.0.6) + decent_exposure (>= 2.0) decent_exposure (3.0.4) activesupport (>= 4.0) declarative (0.0.20) @@ -838,7 +838,7 @@ DEPENDENCIES wicked (~> 1.1) RUBY VERSION - ruby 2.7.7p221 + ruby 3.2.2p53 BUNDLED WITH 2.4.8 From 8e0dcd7d43652f39cb1653406661d056ecd67da3 Mon Sep 17 00:00:00 2001 From: Vasili Kachalko Date: Thu, 2 Nov 2023 14:55:19 +0100 Subject: [PATCH 02/20] update rails and move forms --- Gemfile | 6 +- Gemfile.lock | 206 +++++++++++------- README.md | 4 +- {app/forms => forms}/appraisal_form.rb | 0 .../award_years/v2022/qae_forms.rb | 0 .../forms => forms}/award_years/v2022/qavs.rb | 0 .../award_years/v2022/qavs/qavs_step1.rb | 0 .../award_years/v2022/qavs/qavs_step2.rb | 0 .../award_years/v2022/qavs/qavs_step3.rb | 0 .../award_years/v2022/qavs/qavs_step4.rb | 0 .../award_years/v2022/qavs/qavs_step5.rb | 0 .../award_years/v2023/qae_forms.rb | 0 .../forms => forms}/award_years/v2023/qavs.rb | 0 .../award_years/v2023/qavs/qavs_step1.rb | 0 .../award_years/v2023/qavs/qavs_step2.rb | 0 .../award_years/v2023/qavs/qavs_step3.rb | 0 .../award_years/v2023/qavs/qavs_step4.rb | 0 .../award_years/v2023/qavs/qavs_step5.rb | 0 .../award_years/v2024/qae_forms.rb | 0 .../forms => forms}/award_years/v2024/qavs.rb | 0 .../award_years/v2024/qavs/qavs_step1.rb | 0 .../award_years/v2024/qavs/qavs_step2.rb | 0 .../award_years/v2024/qavs/qavs_step3.rb | 0 .../award_years/v2024/qavs/qavs_step4.rb | 0 .../award_years/v2024/qavs/qavs_step5.rb | 0 .../declaration_of_responsibility_form.rb | 0 {app/forms => forms}/eligibility_form.rb | 0 {app/forms => forms}/feedback_form.rb | 0 {app/forms => forms}/palace_invite_form.rb | 0 {app/forms => forms}/qae_form_builder.rb | 0 .../qae_form_builder/address_question.rb | 0 .../assessor_details_question.rb | 0 .../by_years_label_question.rb | 0 .../qae_form_builder/by_years_question.rb | 0 .../ceremonial_county_question.rb | 0 .../checkbox_seria_question.rb | 0 .../qae_form_builder/comment_question.rb | 0 .../qae_form_builder/confirm_question.rb | 0 .../contact_email_question.rb | 0 .../qae_form_builder/contact_question.rb | 0 .../qae_form_builder/country_question.rb | 0 .../qae_form_builder/date_question.rb | 0 .../qae_form_builder/dropdown_question.rb | 0 .../head_of_business_question.rb | 0 .../qae_form_builder/header_question.rb | 0 .../multi_question_decorator.rb | 0 .../multi_question_validator.rb | 0 .../qae_form_builder/number_question.rb | 0 .../one_option_by_years_label_question.rb | 0 .../one_option_by_years_question.rb | 0 .../options_business_name_changed_question.rb | 0 .../qae_form_builder/options_question.rb | 0 .../previous_name_question.rb | 0 .../qae_form_builder/qae_decorator.rb | 0 .../qae_form_builder/qae_form.rb | 0 .../qae_form_builder/qae_form_decorator.rb | 0 .../qae_form_builder/question.rb | 0 .../qae_form_builder/regions_question.rb | 0 .../sic_code_dropdown_question.rb | 0 {app/forms => forms}/qae_form_builder/step.rb | 0 .../qae_form_builder/supporters_question.rb | 0 .../qae_form_builder/text_question.rb | 0 .../qae_form_builder/textarea_question.rb | 0 .../qae_form_builder/upload_question.rb | 0 .../qae_form_builder/user_info_question.rb | 0 .../qae_form_builder/year_question.rb | 0 66 files changed, 128 insertions(+), 88 deletions(-) rename {app/forms => forms}/appraisal_form.rb (100%) rename {app/forms => forms}/award_years/v2022/qae_forms.rb (100%) rename {app/forms => forms}/award_years/v2022/qavs.rb (100%) rename {app/forms => forms}/award_years/v2022/qavs/qavs_step1.rb (100%) rename {app/forms => forms}/award_years/v2022/qavs/qavs_step2.rb (100%) rename {app/forms => forms}/award_years/v2022/qavs/qavs_step3.rb (100%) rename {app/forms => forms}/award_years/v2022/qavs/qavs_step4.rb (100%) rename {app/forms => forms}/award_years/v2022/qavs/qavs_step5.rb (100%) rename {app/forms => forms}/award_years/v2023/qae_forms.rb (100%) rename {app/forms => forms}/award_years/v2023/qavs.rb (100%) rename {app/forms => forms}/award_years/v2023/qavs/qavs_step1.rb (100%) rename {app/forms => forms}/award_years/v2023/qavs/qavs_step2.rb (100%) rename {app/forms => forms}/award_years/v2023/qavs/qavs_step3.rb (100%) rename {app/forms => forms}/award_years/v2023/qavs/qavs_step4.rb (100%) rename {app/forms => forms}/award_years/v2023/qavs/qavs_step5.rb (100%) rename {app/forms => forms}/award_years/v2024/qae_forms.rb (100%) rename {app/forms => forms}/award_years/v2024/qavs.rb (100%) rename {app/forms => forms}/award_years/v2024/qavs/qavs_step1.rb (100%) rename {app/forms => forms}/award_years/v2024/qavs/qavs_step2.rb (100%) rename {app/forms => forms}/award_years/v2024/qavs/qavs_step3.rb (100%) rename {app/forms => forms}/award_years/v2024/qavs/qavs_step4.rb (100%) rename {app/forms => forms}/award_years/v2024/qavs/qavs_step5.rb (100%) rename {app/forms => forms}/declaration_of_responsibility_form.rb (100%) rename {app/forms => forms}/eligibility_form.rb (100%) rename {app/forms => forms}/feedback_form.rb (100%) rename {app/forms => forms}/palace_invite_form.rb (100%) rename {app/forms => forms}/qae_form_builder.rb (100%) rename {app/forms => forms}/qae_form_builder/address_question.rb (100%) rename {app/forms => forms}/qae_form_builder/assessor_details_question.rb (100%) rename {app/forms => forms}/qae_form_builder/by_years_label_question.rb (100%) rename {app/forms => forms}/qae_form_builder/by_years_question.rb (100%) rename {app/forms => forms}/qae_form_builder/ceremonial_county_question.rb (100%) rename {app/forms => forms}/qae_form_builder/checkbox_seria_question.rb (100%) rename {app/forms => forms}/qae_form_builder/comment_question.rb (100%) rename {app/forms => forms}/qae_form_builder/confirm_question.rb (100%) rename {app/forms => forms}/qae_form_builder/contact_email_question.rb (100%) rename {app/forms => forms}/qae_form_builder/contact_question.rb (100%) rename {app/forms => forms}/qae_form_builder/country_question.rb (100%) rename {app/forms => forms}/qae_form_builder/date_question.rb (100%) rename {app/forms => forms}/qae_form_builder/dropdown_question.rb (100%) rename {app/forms => forms}/qae_form_builder/head_of_business_question.rb (100%) rename {app/forms => forms}/qae_form_builder/header_question.rb (100%) rename {app/forms => forms}/qae_form_builder/multi_question_decorator.rb (100%) rename {app/forms => forms}/qae_form_builder/multi_question_validator.rb (100%) rename {app/forms => forms}/qae_form_builder/number_question.rb (100%) rename {app/forms => forms}/qae_form_builder/one_option_by_years_label_question.rb (100%) rename {app/forms => forms}/qae_form_builder/one_option_by_years_question.rb (100%) rename {app/forms => forms}/qae_form_builder/options_business_name_changed_question.rb (100%) rename {app/forms => forms}/qae_form_builder/options_question.rb (100%) rename {app/forms => forms}/qae_form_builder/previous_name_question.rb (100%) rename {app/forms => forms}/qae_form_builder/qae_decorator.rb (100%) rename {app/forms => forms}/qae_form_builder/qae_form.rb (100%) rename {app/forms => forms}/qae_form_builder/qae_form_decorator.rb (100%) rename {app/forms => forms}/qae_form_builder/question.rb (100%) rename {app/forms => forms}/qae_form_builder/regions_question.rb (100%) rename {app/forms => forms}/qae_form_builder/sic_code_dropdown_question.rb (100%) rename {app/forms => forms}/qae_form_builder/step.rb (100%) rename {app/forms => forms}/qae_form_builder/supporters_question.rb (100%) rename {app/forms => forms}/qae_form_builder/text_question.rb (100%) rename {app/forms => forms}/qae_form_builder/textarea_question.rb (100%) rename {app/forms => forms}/qae_form_builder/upload_question.rb (100%) rename {app/forms => forms}/qae_form_builder/user_info_question.rb (100%) rename {app/forms => forms}/qae_form_builder/year_question.rb (100%) diff --git a/Gemfile b/Gemfile index d5a976f45..3c62c946c 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ git_source(:github) { |name| "https://github.com/#{name}.git" } ruby '~> 3.2.2' -gem 'rails', '6.1.7.1' +gem 'rails', '7.1.1' gem 'websocket-extensions', '~> 0.1.5' # SSL redirect @@ -30,7 +30,7 @@ gem 'govuk_template', '0.12.0' gem 'uglifier', '>= 2.7.2' gem 'js_cookie_rails', '2.1.4' gem 'ckeditor' -gem 'webpacker', '6.0.0.beta.7' +gem 'webpacker' # Autolinking in admin mass user mailer gem 'rails_autolink' @@ -150,6 +150,8 @@ gem 'rack-canonical-host' gem 'rails-healthcheck' +gem 'matrix', '~> 0.4.1' + group :development do gem 'letter_opener' gem 'rack-mini-profiler', '>= 0.10.1', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 5128a7712..d174853ce 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,73 +32,87 @@ GEM remote: https://rubygems.org/ specs: Ascii85 (1.1.0) - actioncable (6.1.7.1) - actionpack (= 6.1.7.1) - activesupport (= 6.1.7.1) + actioncable (7.1.1) + actionpack (= 7.1.1) + activesupport (= 7.1.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.1) - actionpack (= 6.1.7.1) - activejob (= 6.1.7.1) - activerecord (= 6.1.7.1) - activestorage (= 6.1.7.1) - activesupport (= 6.1.7.1) + zeitwerk (~> 2.6) + actionmailbox (7.1.1) + actionpack (= 7.1.1) + activejob (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) mail (>= 2.7.1) - actionmailer (6.1.7.1) - actionpack (= 6.1.7.1) - actionview (= 6.1.7.1) - activejob (= 6.1.7.1) - activesupport (= 6.1.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.1.1) + actionpack (= 7.1.1) + actionview (= 7.1.1) + activejob (= 7.1.1) + activesupport (= 7.1.1) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.1.7.1) - actionview (= 6.1.7.1) - activesupport (= 6.1.7.1) - rack (~> 2.0, >= 2.0.9) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.2) + actionpack (7.1.1) + actionview (= 7.1.1) + activesupport (= 7.1.1) + nokogiri (>= 1.8.5) + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.1) - actionpack (= 6.1.7.1) - activerecord (= 6.1.7.1) - activestorage (= 6.1.7.1) - activesupport (= 6.1.7.1) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.1) + actionpack (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.7.1) - activesupport (= 6.1.7.1) + actionview (7.1.1) + activesupport (= 7.1.1) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) active_hash (3.2.0) activesupport (>= 5.0.0) - activejob (6.1.7.1) - activesupport (= 6.1.7.1) + activejob (7.1.1) + activesupport (= 7.1.1) globalid (>= 0.3.6) - activemodel (6.1.7.1) - activesupport (= 6.1.7.1) + activemodel (7.1.1) + activesupport (= 7.1.1) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (6.1.7.1) - activemodel (= 6.1.7.1) - activesupport (= 6.1.7.1) + activerecord (7.1.1) + activemodel (= 7.1.1) + activesupport (= 7.1.1) + timeout (>= 0.4.0) activerecord-import (1.5.0) activerecord (>= 4.2) - activestorage (6.1.7.1) - actionpack (= 6.1.7.1) - activejob (= 6.1.7.1) - activerecord (= 6.1.7.1) - activesupport (= 6.1.7.1) + activestorage (7.1.1) + actionpack (= 7.1.1) + activejob (= 7.1.1) + activerecord (= 7.1.1) + activesupport (= 7.1.1) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (6.1.7.1) + activesupport (7.1.1) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) - zeitwerk (~> 2.3) addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) afm (0.2.2) @@ -115,7 +129,9 @@ GEM descendants_tracker (~> 0.0.4) ice_nine (~> 0.11.0) thread_safe (~> 0.3, >= 0.3.1) + base64 (0.1.1) bcrypt (3.1.19) + bigdecimal (3.1.4) bindex (0.8.1) binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) @@ -126,6 +142,7 @@ GEM browser (2.4.0) builder (3.2.4) byebug (11.1.3) + callsite (0.0.11) capybara (3.33.0) addressable mini_mime (>= 0.1.3) @@ -221,6 +238,8 @@ GEM activesupport (>= 5.0) request_store (>= 1.0) ruby2_keywords + drb (2.1.1) + ruby2_keywords email_validator (2.2.4) activemodel enumerize (2.7.0) @@ -265,7 +284,7 @@ GEM fugit (1.8.1) et-orbi (~> 1, >= 1.2.7) raabro (~> 1.4) - globalid (1.2.0) + globalid (1.2.1) activesupport (>= 6.1) gon (6.4.0) actionpack (>= 3.0.20) @@ -326,6 +345,10 @@ GEM image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) + io-console (0.6.0) + irb (1.8.3) + rdoc + reline (>= 0.3.8) jbuilder (2.10.2) activesupport (>= 5.0.0) jquery-rails (4.4.0) @@ -362,7 +385,7 @@ GEM activesupport (>= 4) railties (>= 4) request_store (~> 1.0) - loofah (2.21.3) + loofah (2.21.4) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -378,10 +401,12 @@ GEM notifications-ruby-client (~> 5.1) rack (>= 2.1.4.1) marcel (1.0.2) + matrix (0.4.2) memoist (0.16.2) - meta_request (0.7.4) - rack-contrib (>= 1.1, < 3) - railties (>= 3.0.0, < 7.1) + meta_request (0.3.0) + callsite + rack-contrib + railties method_source (1.0.0) middleware (0.1.0) mime-types (3.5.1) @@ -389,28 +414,27 @@ GEM mime-types-data (3.2023.0808) mini_magick (4.12.0) mini_mime (1.1.5) - mini_portile2 (2.8.4) - minitest (5.19.0) + minitest (5.20.0) money (6.16.0) i18n (>= 0.6.4, <= 2) multi_json (1.15.0) multipart-post (2.3.0) - net-imap (0.3.7) + mutex_m (0.1.2) + net-imap (0.4.3) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.1) timeout - net-smtp (0.3.3) + net-smtp (0.4.0) net-protocol netrc (0.11.0) nilify_blanks (1.4.0) activerecord (>= 4.0.0) activesupport (>= 4.0.0) nio4r (2.5.9) - nokogiri (1.15.4) - mini_portile2 (~> 2.8.2) + nokogiri (1.15.4-arm64-darwin) racc (~> 1.4) notifications-ruby-client (5.4.0) jwt (>= 1.5, < 3) @@ -456,6 +480,8 @@ GEM pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) + psych (5.1.1.1) + stringio public_suffix (5.0.3) puma (5.6.7) nio4r (~> 2.0) @@ -467,7 +493,7 @@ GEM pusher-signature (~> 0.1.8) pusher-signature (0.1.8) raabro (1.4.0) - racc (1.7.1) + racc (1.7.2) rack (2.2.8) rack-canonical-host (1.2.0) addressable (> 0, < 3) @@ -480,24 +506,28 @@ GEM rack (>= 1.2.0) rack-proxy (0.7.7) rack + rack-session (1.0.1) + rack (< 3) rack-ssl-enforcer (0.2.9) rack-test (2.1.0) rack (>= 1.3) - rails (6.1.7.1) - actioncable (= 6.1.7.1) - actionmailbox (= 6.1.7.1) - actionmailer (= 6.1.7.1) - actionpack (= 6.1.7.1) - actiontext (= 6.1.7.1) - actionview (= 6.1.7.1) - activejob (= 6.1.7.1) - activemodel (= 6.1.7.1) - activerecord (= 6.1.7.1) - activestorage (= 6.1.7.1) - activesupport (= 6.1.7.1) + rackup (1.0.0) + rack (< 3) + webrick + rails (7.1.1) + actioncable (= 7.1.1) + actionmailbox (= 7.1.1) + actionmailer (= 7.1.1) + actionpack (= 7.1.1) + actiontext (= 7.1.1) + actionview (= 7.1.1) + activejob (= 7.1.1) + activemodel (= 7.1.1) + activerecord (= 7.1.1) + activestorage (= 7.1.1) + activesupport (= 7.1.1) bundler (>= 1.15.0) - railties (= 6.1.7.1) - sprockets-rails (>= 2.0.0) + railties (= 7.1.1) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -516,18 +546,22 @@ GEM actionview (> 3.1) activesupport (> 3.1) railties (> 3.1) - railties (6.1.7.1) - actionpack (= 6.1.7.1) - activesupport (= 6.1.7.1) - method_source + railties (7.1.1) + actionpack (= 7.1.1) + activesupport (= 7.1.1) + irb + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.0.6) + rake (13.1.0) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) rb-readline (0.5.5) + rdoc (6.5.0) + psych (>= 4.0.0) redis (5.0.7) redis-client (>= 0.9.0) redis-actionpack (5.3.0) @@ -549,6 +583,8 @@ GEM redis-store (1.9.2) redis (>= 4, < 6) regexp_parser (1.8.2) + reline (0.3.9) + io-console (~> 0.5) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) @@ -675,8 +711,9 @@ GEM sprockets (>= 3.0.0) ssrf_filter (1.1.2) statesman (3.5.0) + stringio (3.0.8) temple (0.8.2) - thor (1.2.2) + thor (1.3.0) thread_safe (0.3.6) tilt (2.0.11) timecop (0.9.8) @@ -714,7 +751,7 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webpacker (6.0.0.beta.7) + webpacker (6.0.0.rc.6) activesupport (>= 5.2) rack-proxy (>= 0.6.1) railties (>= 5.2) @@ -728,11 +765,11 @@ GEM railties (>= 3.0.7) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.11) + zeitwerk (2.6.12) zxcvbn (0.1.9) PLATFORMS - ruby + arm64-darwin-21 DEPENDENCIES active_hash @@ -781,6 +818,7 @@ DEPENDENCIES listen lograge mail-notify (~> 1.0) + matrix (~> 0.4.1) meta_request nilify_blanks nokogiri @@ -799,7 +837,7 @@ DEPENDENCIES rack-cors (~> 1.0) rack-mini-profiler (>= 0.10.1) rack-ssl-enforcer - rails (= 6.1.7.1) + rails (= 7.1.1) rails-controller-testing rails-healthcheck rails-html-sanitizer (>= 1.4.3) @@ -833,7 +871,7 @@ DEPENDENCIES virtus web-console webmock (= 3.13.0) - webpacker (= 6.0.0.beta.7) + webpacker websocket-extensions (~> 0.1.5) wicked (~> 1.1) diff --git a/README.md b/README.md index 4e89a3f68..b0734358e 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ docker-compose run web bundle exec rake db:migrate ### Pre-requisites -* Ruby 2.7 -* Rails 6.1 +* Ruby 3.2 +* Rails 7.1 * Postgresql 9.5+ * Redis 2.8+ diff --git a/app/forms/appraisal_form.rb b/forms/appraisal_form.rb similarity index 100% rename from app/forms/appraisal_form.rb rename to forms/appraisal_form.rb diff --git a/app/forms/award_years/v2022/qae_forms.rb b/forms/award_years/v2022/qae_forms.rb similarity index 100% rename from app/forms/award_years/v2022/qae_forms.rb rename to forms/award_years/v2022/qae_forms.rb diff --git a/app/forms/award_years/v2022/qavs.rb b/forms/award_years/v2022/qavs.rb similarity index 100% rename from app/forms/award_years/v2022/qavs.rb rename to forms/award_years/v2022/qavs.rb diff --git a/app/forms/award_years/v2022/qavs/qavs_step1.rb b/forms/award_years/v2022/qavs/qavs_step1.rb similarity index 100% rename from app/forms/award_years/v2022/qavs/qavs_step1.rb rename to forms/award_years/v2022/qavs/qavs_step1.rb diff --git a/app/forms/award_years/v2022/qavs/qavs_step2.rb b/forms/award_years/v2022/qavs/qavs_step2.rb similarity index 100% rename from app/forms/award_years/v2022/qavs/qavs_step2.rb rename to forms/award_years/v2022/qavs/qavs_step2.rb diff --git a/app/forms/award_years/v2022/qavs/qavs_step3.rb b/forms/award_years/v2022/qavs/qavs_step3.rb similarity index 100% rename from app/forms/award_years/v2022/qavs/qavs_step3.rb rename to forms/award_years/v2022/qavs/qavs_step3.rb diff --git a/app/forms/award_years/v2022/qavs/qavs_step4.rb b/forms/award_years/v2022/qavs/qavs_step4.rb similarity index 100% rename from app/forms/award_years/v2022/qavs/qavs_step4.rb rename to forms/award_years/v2022/qavs/qavs_step4.rb diff --git a/app/forms/award_years/v2022/qavs/qavs_step5.rb b/forms/award_years/v2022/qavs/qavs_step5.rb similarity index 100% rename from app/forms/award_years/v2022/qavs/qavs_step5.rb rename to forms/award_years/v2022/qavs/qavs_step5.rb diff --git a/app/forms/award_years/v2023/qae_forms.rb b/forms/award_years/v2023/qae_forms.rb similarity index 100% rename from app/forms/award_years/v2023/qae_forms.rb rename to forms/award_years/v2023/qae_forms.rb diff --git a/app/forms/award_years/v2023/qavs.rb b/forms/award_years/v2023/qavs.rb similarity index 100% rename from app/forms/award_years/v2023/qavs.rb rename to forms/award_years/v2023/qavs.rb diff --git a/app/forms/award_years/v2023/qavs/qavs_step1.rb b/forms/award_years/v2023/qavs/qavs_step1.rb similarity index 100% rename from app/forms/award_years/v2023/qavs/qavs_step1.rb rename to forms/award_years/v2023/qavs/qavs_step1.rb diff --git a/app/forms/award_years/v2023/qavs/qavs_step2.rb b/forms/award_years/v2023/qavs/qavs_step2.rb similarity index 100% rename from app/forms/award_years/v2023/qavs/qavs_step2.rb rename to forms/award_years/v2023/qavs/qavs_step2.rb diff --git a/app/forms/award_years/v2023/qavs/qavs_step3.rb b/forms/award_years/v2023/qavs/qavs_step3.rb similarity index 100% rename from app/forms/award_years/v2023/qavs/qavs_step3.rb rename to forms/award_years/v2023/qavs/qavs_step3.rb diff --git a/app/forms/award_years/v2023/qavs/qavs_step4.rb b/forms/award_years/v2023/qavs/qavs_step4.rb similarity index 100% rename from app/forms/award_years/v2023/qavs/qavs_step4.rb rename to forms/award_years/v2023/qavs/qavs_step4.rb diff --git a/app/forms/award_years/v2023/qavs/qavs_step5.rb b/forms/award_years/v2023/qavs/qavs_step5.rb similarity index 100% rename from app/forms/award_years/v2023/qavs/qavs_step5.rb rename to forms/award_years/v2023/qavs/qavs_step5.rb diff --git a/app/forms/award_years/v2024/qae_forms.rb b/forms/award_years/v2024/qae_forms.rb similarity index 100% rename from app/forms/award_years/v2024/qae_forms.rb rename to forms/award_years/v2024/qae_forms.rb diff --git a/app/forms/award_years/v2024/qavs.rb b/forms/award_years/v2024/qavs.rb similarity index 100% rename from app/forms/award_years/v2024/qavs.rb rename to forms/award_years/v2024/qavs.rb diff --git a/app/forms/award_years/v2024/qavs/qavs_step1.rb b/forms/award_years/v2024/qavs/qavs_step1.rb similarity index 100% rename from app/forms/award_years/v2024/qavs/qavs_step1.rb rename to forms/award_years/v2024/qavs/qavs_step1.rb diff --git a/app/forms/award_years/v2024/qavs/qavs_step2.rb b/forms/award_years/v2024/qavs/qavs_step2.rb similarity index 100% rename from app/forms/award_years/v2024/qavs/qavs_step2.rb rename to forms/award_years/v2024/qavs/qavs_step2.rb diff --git a/app/forms/award_years/v2024/qavs/qavs_step3.rb b/forms/award_years/v2024/qavs/qavs_step3.rb similarity index 100% rename from app/forms/award_years/v2024/qavs/qavs_step3.rb rename to forms/award_years/v2024/qavs/qavs_step3.rb diff --git a/app/forms/award_years/v2024/qavs/qavs_step4.rb b/forms/award_years/v2024/qavs/qavs_step4.rb similarity index 100% rename from app/forms/award_years/v2024/qavs/qavs_step4.rb rename to forms/award_years/v2024/qavs/qavs_step4.rb diff --git a/app/forms/award_years/v2024/qavs/qavs_step5.rb b/forms/award_years/v2024/qavs/qavs_step5.rb similarity index 100% rename from app/forms/award_years/v2024/qavs/qavs_step5.rb rename to forms/award_years/v2024/qavs/qavs_step5.rb diff --git a/app/forms/declaration_of_responsibility_form.rb b/forms/declaration_of_responsibility_form.rb similarity index 100% rename from app/forms/declaration_of_responsibility_form.rb rename to forms/declaration_of_responsibility_form.rb diff --git a/app/forms/eligibility_form.rb b/forms/eligibility_form.rb similarity index 100% rename from app/forms/eligibility_form.rb rename to forms/eligibility_form.rb diff --git a/app/forms/feedback_form.rb b/forms/feedback_form.rb similarity index 100% rename from app/forms/feedback_form.rb rename to forms/feedback_form.rb diff --git a/app/forms/palace_invite_form.rb b/forms/palace_invite_form.rb similarity index 100% rename from app/forms/palace_invite_form.rb rename to forms/palace_invite_form.rb diff --git a/app/forms/qae_form_builder.rb b/forms/qae_form_builder.rb similarity index 100% rename from app/forms/qae_form_builder.rb rename to forms/qae_form_builder.rb diff --git a/app/forms/qae_form_builder/address_question.rb b/forms/qae_form_builder/address_question.rb similarity index 100% rename from app/forms/qae_form_builder/address_question.rb rename to forms/qae_form_builder/address_question.rb diff --git a/app/forms/qae_form_builder/assessor_details_question.rb b/forms/qae_form_builder/assessor_details_question.rb similarity index 100% rename from app/forms/qae_form_builder/assessor_details_question.rb rename to forms/qae_form_builder/assessor_details_question.rb diff --git a/app/forms/qae_form_builder/by_years_label_question.rb b/forms/qae_form_builder/by_years_label_question.rb similarity index 100% rename from app/forms/qae_form_builder/by_years_label_question.rb rename to forms/qae_form_builder/by_years_label_question.rb diff --git a/app/forms/qae_form_builder/by_years_question.rb b/forms/qae_form_builder/by_years_question.rb similarity index 100% rename from app/forms/qae_form_builder/by_years_question.rb rename to forms/qae_form_builder/by_years_question.rb diff --git a/app/forms/qae_form_builder/ceremonial_county_question.rb b/forms/qae_form_builder/ceremonial_county_question.rb similarity index 100% rename from app/forms/qae_form_builder/ceremonial_county_question.rb rename to forms/qae_form_builder/ceremonial_county_question.rb diff --git a/app/forms/qae_form_builder/checkbox_seria_question.rb b/forms/qae_form_builder/checkbox_seria_question.rb similarity index 100% rename from app/forms/qae_form_builder/checkbox_seria_question.rb rename to forms/qae_form_builder/checkbox_seria_question.rb diff --git a/app/forms/qae_form_builder/comment_question.rb b/forms/qae_form_builder/comment_question.rb similarity index 100% rename from app/forms/qae_form_builder/comment_question.rb rename to forms/qae_form_builder/comment_question.rb diff --git a/app/forms/qae_form_builder/confirm_question.rb b/forms/qae_form_builder/confirm_question.rb similarity index 100% rename from app/forms/qae_form_builder/confirm_question.rb rename to forms/qae_form_builder/confirm_question.rb diff --git a/app/forms/qae_form_builder/contact_email_question.rb b/forms/qae_form_builder/contact_email_question.rb similarity index 100% rename from app/forms/qae_form_builder/contact_email_question.rb rename to forms/qae_form_builder/contact_email_question.rb diff --git a/app/forms/qae_form_builder/contact_question.rb b/forms/qae_form_builder/contact_question.rb similarity index 100% rename from app/forms/qae_form_builder/contact_question.rb rename to forms/qae_form_builder/contact_question.rb diff --git a/app/forms/qae_form_builder/country_question.rb b/forms/qae_form_builder/country_question.rb similarity index 100% rename from app/forms/qae_form_builder/country_question.rb rename to forms/qae_form_builder/country_question.rb diff --git a/app/forms/qae_form_builder/date_question.rb b/forms/qae_form_builder/date_question.rb similarity index 100% rename from app/forms/qae_form_builder/date_question.rb rename to forms/qae_form_builder/date_question.rb diff --git a/app/forms/qae_form_builder/dropdown_question.rb b/forms/qae_form_builder/dropdown_question.rb similarity index 100% rename from app/forms/qae_form_builder/dropdown_question.rb rename to forms/qae_form_builder/dropdown_question.rb diff --git a/app/forms/qae_form_builder/head_of_business_question.rb b/forms/qae_form_builder/head_of_business_question.rb similarity index 100% rename from app/forms/qae_form_builder/head_of_business_question.rb rename to forms/qae_form_builder/head_of_business_question.rb diff --git a/app/forms/qae_form_builder/header_question.rb b/forms/qae_form_builder/header_question.rb similarity index 100% rename from app/forms/qae_form_builder/header_question.rb rename to forms/qae_form_builder/header_question.rb diff --git a/app/forms/qae_form_builder/multi_question_decorator.rb b/forms/qae_form_builder/multi_question_decorator.rb similarity index 100% rename from app/forms/qae_form_builder/multi_question_decorator.rb rename to forms/qae_form_builder/multi_question_decorator.rb diff --git a/app/forms/qae_form_builder/multi_question_validator.rb b/forms/qae_form_builder/multi_question_validator.rb similarity index 100% rename from app/forms/qae_form_builder/multi_question_validator.rb rename to forms/qae_form_builder/multi_question_validator.rb diff --git a/app/forms/qae_form_builder/number_question.rb b/forms/qae_form_builder/number_question.rb similarity index 100% rename from app/forms/qae_form_builder/number_question.rb rename to forms/qae_form_builder/number_question.rb diff --git a/app/forms/qae_form_builder/one_option_by_years_label_question.rb b/forms/qae_form_builder/one_option_by_years_label_question.rb similarity index 100% rename from app/forms/qae_form_builder/one_option_by_years_label_question.rb rename to forms/qae_form_builder/one_option_by_years_label_question.rb diff --git a/app/forms/qae_form_builder/one_option_by_years_question.rb b/forms/qae_form_builder/one_option_by_years_question.rb similarity index 100% rename from app/forms/qae_form_builder/one_option_by_years_question.rb rename to forms/qae_form_builder/one_option_by_years_question.rb diff --git a/app/forms/qae_form_builder/options_business_name_changed_question.rb b/forms/qae_form_builder/options_business_name_changed_question.rb similarity index 100% rename from app/forms/qae_form_builder/options_business_name_changed_question.rb rename to forms/qae_form_builder/options_business_name_changed_question.rb diff --git a/app/forms/qae_form_builder/options_question.rb b/forms/qae_form_builder/options_question.rb similarity index 100% rename from app/forms/qae_form_builder/options_question.rb rename to forms/qae_form_builder/options_question.rb diff --git a/app/forms/qae_form_builder/previous_name_question.rb b/forms/qae_form_builder/previous_name_question.rb similarity index 100% rename from app/forms/qae_form_builder/previous_name_question.rb rename to forms/qae_form_builder/previous_name_question.rb diff --git a/app/forms/qae_form_builder/qae_decorator.rb b/forms/qae_form_builder/qae_decorator.rb similarity index 100% rename from app/forms/qae_form_builder/qae_decorator.rb rename to forms/qae_form_builder/qae_decorator.rb diff --git a/app/forms/qae_form_builder/qae_form.rb b/forms/qae_form_builder/qae_form.rb similarity index 100% rename from app/forms/qae_form_builder/qae_form.rb rename to forms/qae_form_builder/qae_form.rb diff --git a/app/forms/qae_form_builder/qae_form_decorator.rb b/forms/qae_form_builder/qae_form_decorator.rb similarity index 100% rename from app/forms/qae_form_builder/qae_form_decorator.rb rename to forms/qae_form_builder/qae_form_decorator.rb diff --git a/app/forms/qae_form_builder/question.rb b/forms/qae_form_builder/question.rb similarity index 100% rename from app/forms/qae_form_builder/question.rb rename to forms/qae_form_builder/question.rb diff --git a/app/forms/qae_form_builder/regions_question.rb b/forms/qae_form_builder/regions_question.rb similarity index 100% rename from app/forms/qae_form_builder/regions_question.rb rename to forms/qae_form_builder/regions_question.rb diff --git a/app/forms/qae_form_builder/sic_code_dropdown_question.rb b/forms/qae_form_builder/sic_code_dropdown_question.rb similarity index 100% rename from app/forms/qae_form_builder/sic_code_dropdown_question.rb rename to forms/qae_form_builder/sic_code_dropdown_question.rb diff --git a/app/forms/qae_form_builder/step.rb b/forms/qae_form_builder/step.rb similarity index 100% rename from app/forms/qae_form_builder/step.rb rename to forms/qae_form_builder/step.rb diff --git a/app/forms/qae_form_builder/supporters_question.rb b/forms/qae_form_builder/supporters_question.rb similarity index 100% rename from app/forms/qae_form_builder/supporters_question.rb rename to forms/qae_form_builder/supporters_question.rb diff --git a/app/forms/qae_form_builder/text_question.rb b/forms/qae_form_builder/text_question.rb similarity index 100% rename from app/forms/qae_form_builder/text_question.rb rename to forms/qae_form_builder/text_question.rb diff --git a/app/forms/qae_form_builder/textarea_question.rb b/forms/qae_form_builder/textarea_question.rb similarity index 100% rename from app/forms/qae_form_builder/textarea_question.rb rename to forms/qae_form_builder/textarea_question.rb diff --git a/app/forms/qae_form_builder/upload_question.rb b/forms/qae_form_builder/upload_question.rb similarity index 100% rename from app/forms/qae_form_builder/upload_question.rb rename to forms/qae_form_builder/upload_question.rb diff --git a/app/forms/qae_form_builder/user_info_question.rb b/forms/qae_form_builder/user_info_question.rb similarity index 100% rename from app/forms/qae_form_builder/user_info_question.rb rename to forms/qae_form_builder/user_info_question.rb diff --git a/app/forms/qae_form_builder/year_question.rb b/forms/qae_form_builder/year_question.rb similarity index 100% rename from app/forms/qae_form_builder/year_question.rb rename to forms/qae_form_builder/year_question.rb From 7b86842430696eb18d451a2d134580679e502c2e Mon Sep 17 00:00:00 2001 From: Vasili Kachalko Date: Thu, 2 Nov 2023 15:04:42 +0100 Subject: [PATCH 03/20] renaming classes for zeitwerk --- Gemfile | 4 +-- Gemfile.lock | 30 ++++++++----------- .../admin/form_answers_controller.rb | 2 +- .../assessor/form_answers_controller.rb | 2 +- app/controllers/form_controller.rb | 2 +- .../lieutenant/form_answers_controller.rb | 2 +- app/decorators/form_answer_decorator.rb | 8 ++--- app/form_pointers/financial_table.rb | 8 ++--- app/form_pointers/financial_year_pointer.rb | 8 ++--- app/form_pointers/form_financial_pointer.rb | 8 ++--- app/models/assessor_assignment.rb | 8 ++--- app/models/audit_log.rb | 4 +-- app/models/comment.rb | 4 +-- app/models/eligibility.rb | 2 +- app/models/feedback.rb | 4 +-- app/models/form_answer.rb | 20 ++++++------- app/models/group_leader.rb | 2 +- app/models/reports/all_entries.rb | 2 +- app/models/reports/citation_report.rb | 2 +- app/models/reports/csv_helper.rb | 2 +- app/models/reports/press_book_list.rb | 2 +- .../company_details/_sic_form.html.slim | 2 +- .../assessor/form_answers/_question.html.slim | 2 +- .../questions/_address_question.html.slim | 2 +- .../_assessor_details_question.html.slim | 2 +- .../qae_form/_address_question.html.slim | 2 +- .../_assessor_details_question.html.slim | 2 +- app/views/qae_form/_question.html.slim | 4 +-- config/application.rb | 11 +++++-- forms/award_years/v2022/qae_forms.rb | 4 +-- forms/award_years/v2022/qavs.rb | 24 +++++++-------- forms/award_years/v2022/qavs/qavs_step1.rb | 2 +- forms/award_years/v2022/qavs/qavs_step2.rb | 2 +- forms/award_years/v2022/qavs/qavs_step3.rb | 2 +- forms/award_years/v2022/qavs/qavs_step4.rb | 2 +- forms/award_years/v2022/qavs/qavs_step5.rb | 2 +- forms/award_years/v2023/qae_forms.rb | 4 +-- forms/award_years/v2023/qavs.rb | 24 +++++++-------- forms/award_years/v2023/qavs/qavs_step1.rb | 2 +- forms/award_years/v2023/qavs/qavs_step2.rb | 2 +- forms/award_years/v2023/qavs/qavs_step3.rb | 2 +- forms/award_years/v2023/qavs/qavs_step4.rb | 2 +- forms/award_years/v2023/qavs/qavs_step5.rb | 2 +- forms/award_years/v2024/qae_forms.rb | 4 +-- forms/award_years/v2024/qavs.rb | 24 +++++++-------- forms/award_years/v2024/qavs/qavs_step1.rb | 2 +- forms/award_years/v2024/qavs/qavs_step2.rb | 2 +- forms/award_years/v2024/qavs/qavs_step3.rb | 2 +- forms/award_years/v2024/qavs/qavs_step4.rb | 2 +- forms/award_years/v2024/qavs/qavs_step5.rb | 2 +- forms/qae_form_builder.rb | 4 +-- forms/qae_form_builder/address_question.rb | 2 +- .../assessor_details_question.rb | 2 +- .../by_years_label_question.rb | 2 +- forms/qae_form_builder/by_years_question.rb | 2 +- .../ceremonial_county_question.rb | 2 +- .../checkbox_seria_question.rb | 2 +- forms/qae_form_builder/comment_question.rb | 2 +- forms/qae_form_builder/confirm_question.rb | 2 +- .../contact_email_question.rb | 2 +- forms/qae_form_builder/contact_question.rb | 2 +- forms/qae_form_builder/country_question.rb | 2 +- forms/qae_form_builder/date_question.rb | 2 +- forms/qae_form_builder/dropdown_question.rb | 2 +- .../head_of_business_question.rb | 2 +- forms/qae_form_builder/header_question.rb | 2 +- .../multi_question_decorator.rb | 2 +- .../multi_question_validator.rb | 2 +- forms/qae_form_builder/number_question.rb | 2 +- .../one_option_by_years_label_question.rb | 2 +- .../one_option_by_years_question.rb | 2 +- .../options_business_name_changed_question.rb | 2 +- forms/qae_form_builder/options_question.rb | 2 +- .../previous_name_question.rb | 2 +- forms/qae_form_builder/qae_decorator.rb | 4 +-- forms/qae_form_builder/qae_form.rb | 6 ++-- forms/qae_form_builder/qae_form_decorator.rb | 4 +-- forms/qae_form_builder/question.rb | 12 ++++---- forms/qae_form_builder/regions_question.rb | 4 +-- .../sic_code_dropdown_question.rb | 2 +- forms/qae_form_builder/step.rb | 18 +++++------ forms/qae_form_builder/supporters_question.rb | 2 +- forms/qae_form_builder/text_question.rb | 2 +- forms/qae_form_builder/textarea_question.rb | 2 +- forms/qae_form_builder/upload_question.rb | 2 +- forms/qae_form_builder/user_info_question.rb | 2 +- forms/qae_form_builder/year_question.rb | 2 +- lib/{qae.rb => q_a_e.rb} | 0 lib/sic_code.rb | 4 +-- spec/unit/qae_form_builder_spec.rb | 20 ++++++------- 90 files changed, 203 insertions(+), 200 deletions(-) rename lib/{qae.rb => q_a_e.rb} (100%) diff --git a/Gemfile b/Gemfile index 3c62c946c..537d22ba7 100644 --- a/Gemfile +++ b/Gemfile @@ -180,11 +180,11 @@ end group :test do gem 'factory_bot_rails' - gem 'capybara', '3.33' + gem 'capybara', '~> 3.39' gem 'poltergeist' gem 'database_cleaner-active_record' gem 'launchy' - gem 'turnip', '~> 4.2.0' + gem 'turnip', '~> 4.4.0' gem 'shoulda-matchers', require: false gem 'pdf-inspector', require: 'pdf/inspector' gem 'codeclimate_circle_ci_coverage' diff --git a/Gemfile.lock b/Gemfile.lock index d174853ce..a792d03b3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -143,13 +143,14 @@ GEM builder (3.2.4) byebug (11.1.3) callsite (0.0.11) - capybara (3.33.0) + capybara (3.39.2) addressable + matrix mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - regexp_parser (~> 1.5) + regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) carrierwave (2.2.4) activemodel (>= 5.0.0) @@ -191,10 +192,11 @@ GEM crack (0.4.5) rexml crass (1.0.6) - cucumber-gherkin (14.2.0) - cucumber-messages (~> 12.4, >= 12.4.0) - cucumber-messages (12.4.0) - protobuf-cucumber (~> 3.10, >= 3.10.8) + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) + cucumber-messages (22.0.0) + cuke_modeler (3.20.1) + cucumber-gherkin (< 28.0) curb (0.9.10) database_cleaner-active_record (2.1.0) activerecord (>= 5.a) @@ -408,7 +410,6 @@ GEM rack-contrib railties method_source (1.0.0) - middleware (0.1.0) mime-types (3.5.1) mime-types-data (~> 3.2015) mime-types-data (3.2023.0808) @@ -469,11 +470,6 @@ GEM ttfunk (~> 1.7) prawn-table (0.2.2) prawn (>= 1.3.0, < 3.0.0) - protobuf-cucumber (3.10.8) - activesupport (>= 3.2) - middleware - thor - thread_safe pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) @@ -582,7 +578,7 @@ GEM redis-store (>= 1.2, < 2) redis-store (1.9.2) redis (>= 4, < 6) - regexp_parser (1.8.2) + regexp_parser (2.8.2) reline (0.3.9) io-console (~> 0.5) representable (3.2.0) @@ -720,8 +716,8 @@ GEM timeout (0.4.0) trailblazer-option (0.1.2) ttfunk (1.7.0) - turnip (4.2.0) - cucumber-gherkin (~> 14.0) + turnip (4.4.0) + cuke_modeler (~> 3.15) rspec (>= 3.0, < 4.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) @@ -780,7 +776,7 @@ DEPENDENCIES bootscale bootstrap-sass (~> 3.4) browser (= 2.4.0) - capybara (= 3.33) + capybara (~> 3.39) carrierwave (~> 2.2.2) carrierwave-google-storage! ckeditor @@ -864,7 +860,7 @@ DEPENDENCIES sprockets-rails (>= 2.0.0) statesman (= 3.5.0) timecop - turnip (~> 4.2.0) + turnip (~> 4.4.0) uglifier (>= 2.7.2) vigilion (~> 1.0.4)! vigilion-rails (~> 2.1.0) diff --git a/app/controllers/admin/form_answers_controller.rb b/app/controllers/admin/form_answers_controller.rb index f27e1ecc2..310f19635 100644 --- a/app/controllers/admin/form_answers_controller.rb +++ b/app/controllers/admin/form_answers_controller.rb @@ -40,7 +40,7 @@ class Admin::FormAnswersController < Admin::BaseController expose(:questions_with_references) do all_form_questions.select do |q| - !q.is_a?(QAEFormBuilder::HeaderQuestion) && + !q.is_a?(QaeFormBuilder::HeaderQuestion) && (q.ref.present? || q.sub_ref.present?) end end diff --git a/app/controllers/assessor/form_answers_controller.rb b/app/controllers/assessor/form_answers_controller.rb index 4ffea4aeb..1c83c839a 100644 --- a/app/controllers/assessor/form_answers_controller.rb +++ b/app/controllers/assessor/form_answers_controller.rb @@ -11,7 +11,7 @@ class Assessor::FormAnswersController < Assessor::BaseController expose(:questions_with_references) do all_form_questions.select do |q| - !q.is_a?(QAEFormBuilder::HeaderQuestion) && + !q.is_a?(QaeFormBuilder::HeaderQuestion) && (q.ref.present? || q.sub_ref.present?) end end diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index 0a722a8c4..2316934c9 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -36,7 +36,7 @@ class FormController < ApplicationController expose(:questions_with_references) do all_form_questions.select do |q| - !q.is_a?(QAEFormBuilder::HeaderQuestion) && + !q.is_a?(QaeFormBuilder::HeaderQuestion) && (q.ref.present? || q.sub_ref.present?) end end diff --git a/app/controllers/lieutenant/form_answers_controller.rb b/app/controllers/lieutenant/form_answers_controller.rb index f72ac4376..d2441cb5d 100644 --- a/app/controllers/lieutenant/form_answers_controller.rb +++ b/app/controllers/lieutenant/form_answers_controller.rb @@ -15,7 +15,7 @@ class Lieutenant::FormAnswersController < Lieutenant::BaseController expose(:questions_with_references) do all_form_questions.select do |q| - !q.is_a?(QAEFormBuilder::HeaderQuestion) && + !q.is_a?(QaeFormBuilder::HeaderQuestion) && (q.ref.present? || q.sub_ref.present?) end end diff --git a/app/decorators/form_answer_decorator.rb b/app/decorators/form_answer_decorator.rb index ed7d74fc0..4af1182cd 100644 --- a/app/decorators/form_answer_decorator.rb +++ b/app/decorators/form_answer_decorator.rb @@ -168,7 +168,7 @@ def progress_text def average_growth_for(year) if object.sic_code.present? - sic = SICCode.find_by_code(object.sic_code) + sic = SicCode.find_by_code(object.sic_code) sic.by_year(year) if sic end end @@ -182,7 +182,7 @@ def all_average_growths def sic_code_name sic = object.sic_code if sic.present? - SICCode.find_by_code(sic).name + SicCode.find_by_code(sic).name end end @@ -194,7 +194,7 @@ def corp_responsibility_required_keys object.award_form.steps.detect do |step| step.short_title == "Declaration of Corporate Responsibility" end.questions.select do |q| - q.is_a?(QAEFormBuilder::TextareaQuestion) && q.required + q.is_a?(QaeFormBuilder::TextareaQuestion) && q.required end.map(&:key) .map(&:to_s) end @@ -212,7 +212,7 @@ def awarded? def average_growth_legend(years = [1, 2, 3]) growths = years.map { |y| average_growth_for(y) }.uniq growths.map do |g| - note = SICCode::NOTES[g] + note = SicCode::NOTES[g] "#{g} - #{note}" if note end.compact.join("\n") end diff --git a/app/form_pointers/financial_table.rb b/app/form_pointers/financial_table.rb index dd6dea586..9b4475bc0 100644 --- a/app/form_pointers/financial_table.rb +++ b/app/form_pointers/financial_table.rb @@ -142,9 +142,9 @@ def financial_years_number end def one_option_question? - question.is_a?(QAEFormBuilder::OneOptionByYearsLabelQuestionDecorator) || - question.is_a?(QAEFormBuilder::OneOptionByYearsQuestionDecorator) || - question.is_a?(QAEFormBuilder::OneOptionByYearsLabelQuestion) || - question.is_a?(QAEFormBuilder::OneOptionByYearsQuestion) + question.is_a?(QaeFormBuilder::OneOptionByYearsLabelQuestionDecorator) || + question.is_a?(QaeFormBuilder::OneOptionByYearsQuestionDecorator) || + question.is_a?(QaeFormBuilder::OneOptionByYearsLabelQuestion) || + question.is_a?(QaeFormBuilder::OneOptionByYearsQuestion) end end diff --git a/app/form_pointers/financial_year_pointer.rb b/app/form_pointers/financial_year_pointer.rb index 998f235ff..a8885b0e9 100644 --- a/app/form_pointers/financial_year_pointer.rb +++ b/app/form_pointers/financial_year_pointer.rb @@ -21,13 +21,13 @@ def data def fetch_data case question.delegate_obj - when QAEFormBuilder::ByYearsLabelQuestion + when QaeFormBuilder::ByYearsLabelQuestion fetch_year_labels - when QAEFormBuilder::ByYearsQuestion + when QaeFormBuilder::ByYearsQuestion fetch_years - when QAEFormBuilder::OneOptionByYearsLabelQuestion + when QaeFormBuilder::OneOptionByYearsLabelQuestion fetch_one_option_year_labels - when QAEFormBuilder::OneOptionByYearsQuestion + when QaeFormBuilder::OneOptionByYearsQuestion fetch_one_option_years end end diff --git a/app/form_pointers/form_financial_pointer.rb b/app/form_pointers/form_financial_pointer.rb index b49443a57..3dc76ab97 100644 --- a/app/form_pointers/form_financial_pointer.rb +++ b/app/form_pointers/form_financial_pointer.rb @@ -13,10 +13,10 @@ class FormFinancialPointer :options TARGET_FINANCIAL_DATA_QUESTION_TYPES = [ - QAEFormBuilder::ByYearsLabelQuestion, - QAEFormBuilder::ByYearsQuestion, - QAEFormBuilder::OneOptionByYearsLabelQuestion, - QAEFormBuilder::OneOptionByYearsQuestion + QaeFormBuilder::ByYearsLabelQuestion, + QaeFormBuilder::ByYearsQuestion, + QaeFormBuilder::OneOptionByYearsLabelQuestion, + QaeFormBuilder::OneOptionByYearsQuestion ] YEAR_LABELS = %w(day month year) IN_PROGRESS = "-" diff --git a/app/models/assessor_assignment.rb b/app/models/assessor_assignment.rb index 50ec5a492..3c111d68f 100644 --- a/app/models/assessor_assignment.rb +++ b/app/models/assessor_assignment.rb @@ -19,10 +19,10 @@ class AssessorAssignment < ApplicationRecord end begin :associations - belongs_to :assessor - belongs_to :form_answer - belongs_to :editable, polymorphic: true - belongs_to :award_year + belongs_to :assessor, optional: true + belongs_to :form_answer, optional: true + belongs_to :editable, polymorphic: true, optional: true + belongs_to :award_year, optional: true end begin :scopes diff --git a/app/models/audit_log.rb b/app/models/audit_log.rb index 9fe1d2ede..0e9fc472d 100644 --- a/app/models/audit_log.rb +++ b/app/models/audit_log.rb @@ -3,8 +3,8 @@ class AuditLog < ApplicationRecord validates :subject_id, presence: true validates :action_type, presence: true - belongs_to :subject, polymorphic: true - belongs_to :auditable, polymorphic: true + belongs_to :subject, polymorphic: true, optional: true + belongs_to :auditable, polymorphic: true, optional: true scope :data_export, -> { where(auditable_type: nil).or(AuditLog.where(action_type: "download_form_answer")) } scope :data_update, -> { where(auditable_type: "FormAnswer").where("action_type != 'download_form_answer'") } diff --git a/app/models/comment.rb b/app/models/comment.rb index 641f20a33..74bfbb6b4 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -1,6 +1,6 @@ class Comment < ApplicationRecord - belongs_to :commentable, polymorphic: true - belongs_to :authorable, polymorphic: true + belongs_to :commentable, polymorphic: true, optional: true + belongs_to :authorable, polymorphic: true, optional: true validates :body, presence: true diff --git a/app/models/eligibility.rb b/app/models/eligibility.rb index 43f3dab49..550376dc4 100644 --- a/app/models/eligibility.rb +++ b/app/models/eligibility.rb @@ -4,7 +4,7 @@ class Eligibility < ApplicationRecord AWARD_NAME = "" belongs_to :account - belongs_to :form_answer + belongs_to :form_answer, optional: true attr_accessor :current_step, :force_validate_now diff --git a/app/models/feedback.rb b/app/models/feedback.rb index bed274f16..1f448a124 100644 --- a/app/models/feedback.rb +++ b/app/models/feedback.rb @@ -2,13 +2,13 @@ class Feedback < ApplicationRecord has_paper_trail unless: Proc.new { |t| Rails.env.test? } - belongs_to :form_answer + belongs_to :form_answer, optional: true store_accessor :document, FeedbackForm.fields scope :submitted, -> { where submitted: true } belongs_to :authorable, polymorphic: true - belongs_to :award_year + belongs_to :award_year, optional: true validates :form_answer_id, uniqueness: true diff --git a/app/models/form_answer.rb b/app/models/form_answer.rb index 93763c7a9..697197c46 100644 --- a/app/models/form_answer.rb +++ b/app/models/form_answer.rb @@ -1,6 +1,6 @@ -require 'award_years/v2022/qae_forms' -require 'award_years/v2023/qae_forms' -require 'award_years/v2024/qae_forms' +require_relative '../../forms/award_years/v2022/qae_forms' +require_relative '../../forms/award_years/v2023/qae_forms' +require_relative '../../forms/award_years/v2024/qae_forms' class FormAnswer < ApplicationRecord include Statesman::Adapters::ActiveRecordQueries @@ -37,9 +37,9 @@ class FormAnswer < ApplicationRecord begin :associations belongs_to :user - belongs_to :account + belongs_to :account, optional: true belongs_to :award_year - belongs_to :company_details_editable, polymorphic: true + belongs_to :company_details_editable, polymorphic: true, optional: true belongs_to :ceremonial_county, optional: true has_one :form_basic_eligibility, class_name: 'Eligibility::Basic', dependent: :destroy @@ -51,8 +51,8 @@ class FormAnswer < ApplicationRecord has_one :admin_verdict, dependent: :destroy has_one :group_leader - belongs_to :primary_assessor, class_name: "Assessor", foreign_key: :primary_assessor_id - belongs_to :secondary_assessor, class_name: "Assessor", foreign_key: :secondary_assessor_id + belongs_to :primary_assessor, class_name: "Assessor", foreign_key: :primary_assessor_id, optional: true + belongs_to :secondary_assessor, class_name: "Assessor", foreign_key: :secondary_assessor_id, optional: true has_many :form_answer_attachments, dependent: :destroy has_many :support_letter_attachments, dependent: :destroy @@ -66,7 +66,7 @@ class FormAnswer < ApplicationRecord begin :validations validates :user, presence: true - validates :sic_code, format: { with: SICCode::REGEX }, allow_nil: true, allow_blank: true + validates :sic_code, format: { with: SicCode::REGEX }, allow_nil: true, allow_blank: true validate :validate_answers validates :ineligible_reason_nominator, presence: true, if: proc { state == "admin_not_eligible_nominator" } validates :ineligible_reason_group, presence: true, if: proc { state == "admin_not_eligible_group" } @@ -152,7 +152,7 @@ def award_form elsif self.class.const_defined?(award_form_class_name(year)) self.class.const_get(award_form_class_name(year)) else - AwardYears::V2024::QAEForms # default value + AwardYears::V2024::QaeForms # default value end else raise ArgumentError, "Can not find award form for the nomination in year: #{award_year.year}" @@ -429,7 +429,7 @@ def validate_answers end def award_form_class_name(year) - "::AwardYears::V#{year}::QAEForms" + "::AwardYears::V#{year}::QaeForms" end def self.transition_class diff --git a/app/models/group_leader.rb b/app/models/group_leader.rb index 2c373d7a3..874cb95d1 100644 --- a/app/models/group_leader.rb +++ b/app/models/group_leader.rb @@ -21,7 +21,7 @@ class GroupLeader < ApplicationRecord } } - belongs_to :form_answer + belongs_to :form_answer, optional: true scope :by_email, -> { order(:email) } scope :confirmed, -> { where.not(confirmed_at: nil) } diff --git a/app/models/reports/all_entries.rb b/app/models/reports/all_entries.rb index cc0c7b63e..916f9b285 100644 --- a/app/models/reports/all_entries.rb +++ b/app/models/reports/all_entries.rb @@ -1,5 +1,5 @@ class Reports::AllEntries - include Reports::CSVHelper + include Reports::CsvHelper MAPPING = [ { diff --git a/app/models/reports/citation_report.rb b/app/models/reports/citation_report.rb index bb8426c47..8b9b8d386 100644 --- a/app/models/reports/citation_report.rb +++ b/app/models/reports/citation_report.rb @@ -1,7 +1,7 @@ class Reports::CitationReport attr_reader :award_year, :scope - include Reports::CSVHelper + include Reports::CsvHelper MAPPING = [ { diff --git a/app/models/reports/csv_helper.rb b/app/models/reports/csv_helper.rb index 27398d950..022ceeb55 100644 --- a/app/models/reports/csv_helper.rb +++ b/app/models/reports/csv_helper.rb @@ -1,6 +1,6 @@ require "csv" -module Reports::CSVHelper +module Reports::CsvHelper def build CSV.generate(encoding: "UTF-8", force_quotes: true) do |csv| csv << headers diff --git a/app/models/reports/press_book_list.rb b/app/models/reports/press_book_list.rb index bf1355bd8..05e25cdb2 100644 --- a/app/models/reports/press_book_list.rb +++ b/app/models/reports/press_book_list.rb @@ -1,5 +1,5 @@ class Reports::PressBookList - include Reports::CSVHelper + include Reports::CsvHelper MAPPING = [ { diff --git a/app/views/admin/form_answers/company_details/_sic_form.html.slim b/app/views/admin/form_answers/company_details/_sic_form.html.slim index af5ee2786..0b4111de5 100644 --- a/app/views/admin/form_answers/company_details/_sic_form.html.slim +++ b/app/views/admin/form_answers/company_details/_sic_form.html.slim @@ -22,7 +22,7 @@ wrapper_html: { class: "form-group" }, input_html: { class: "form-control select2" }, as: :select, - collection: SICCode.collection, + collection: SicCode.collection, include_blank: false, label: false .govuk-button-group diff --git a/app/views/assessor/form_answers/_question.html.slim b/app/views/assessor/form_answers/_question.html.slim index 1d2f07610..9078c0863 100644 --- a/app/views/assessor/form_answers/_question.html.slim +++ b/app/views/assessor/form_answers/_question.html.slim @@ -13,7 +13,7 @@ fieldset class=question.fieldset_classes data=question.fieldset_data_hash span.todo = ref.to_s - unless question.title.blank? - - font_size = question.delegate_obj.is_a?(QAEFormBuilder::HeaderQuestion) ? "govuk-!-font-size-36" : "govuk-!-font-size-24" + - font_size = question.delegate_obj.is_a?(QaeFormBuilder::HeaderQuestion) ? "govuk-!-font-size-36" : "govuk-!-font-size-24" span class="govuk-body #{ font_size } govuk-!-font-weight-bold govuk-!-display-block" == question.title diff --git a/app/views/assessor/form_answers/questions/_address_question.html.slim b/app/views/assessor/form_answers/questions/_address_question.html.slim index f6c1b3ab7..e50a71bb0 100644 --- a/app/views/assessor/form_answers/questions/_address_question.html.slim +++ b/app/views/assessor/form_answers/questions/_address_question.html.slim @@ -65,5 +65,5 @@ div role="group" id="q_#{question.key}" .clear - klass = "#{sub_field_title.parameterize == 'postcode' ? 'govuk-input--width-10' : 'govuk-input--width-20'}" - - klass <<(QAEFormBuilder::AddressQuestionValidator::NO_VALIDATION_SUB_FIELDS.exclude?(sub_field_key) ? " required" : " not-required") + - klass <<(QaeFormBuilder::AddressQuestionValidator::NO_VALIDATION_SUB_FIELDS.exclude?(sub_field_key) ? " required" : " not-required") input.govuk-input.js-trigger-autosave class=klass type="text" id=question.input_name(suffix: sub_field_key) value=question.input_value(suffix: sub_field_key) name=question.input_name(suffix: sub_field_key) autocomplete="off" disabled="disabled" diff --git a/app/views/assessor/form_answers/questions/_assessor_details_question.html.slim b/app/views/assessor/form_answers/questions/_assessor_details_question.html.slim index 45a3c13bc..0237edf6a 100644 --- a/app/views/assessor/form_answers/questions/_assessor_details_question.html.slim +++ b/app/views/assessor/form_answers/questions/_assessor_details_question.html.slim @@ -13,5 +13,5 @@ .clear - klass = "#{sub_field_title.parameterize == "phone-number-optional" ? "govuk-input--width-10" : "govuk-input--width-20"}" - - klass <<(QAEFormBuilder::AssessorDetailsQuestionValidator::NO_VALIDATION_SUB_FIELDS.exclude?(sub_field_key) ? " required" : " not-required") + - klass <<(QaeFormBuilder::AssessorDetailsQuestionValidator::NO_VALIDATION_SUB_FIELDS.exclude?(sub_field_key) ? " required" : " not-required") input.govuk-input.js-trigger-autosave class=klass type="text" id=question.input_name(suffix: sub_field_key) value=question.input_value(suffix: sub_field_key) name=question.input_name(suffix: sub_field_key) autocomplete="off" disabled="disabled" diff --git a/app/views/qae_form/_address_question.html.slim b/app/views/qae_form/_address_question.html.slim index 809b9886c..baf38cb53 100644 --- a/app/views/qae_form/_address_question.html.slim +++ b/app/views/qae_form/_address_question.html.slim @@ -67,5 +67,5 @@ div role="group" id="q_#{question.key}" .clear - klass = "#{sub_field_title.parameterize == 'postcode' ? 'govuk-input--width-10' : 'govuk-input--width-20'}" - - klass <<(QAEFormBuilder::AddressQuestionValidator::NO_VALIDATION_SUB_FIELDS.exclude?(sub_field_key) ? " required" : " not-required") + - klass <<(QaeFormBuilder::AddressQuestionValidator::NO_VALIDATION_SUB_FIELDS.exclude?(sub_field_key) ? " required" : " not-required") input.govuk-input.js-trigger-autosave class=klass type="text" id=question.input_name(suffix: sub_field_key) value=question.input_value(suffix: sub_field_key) name=question.input_name(suffix: sub_field_key) autocomplete="off" *possible_read_only_ops(question.step.opts[:id]) diff --git a/app/views/qae_form/_assessor_details_question.html.slim b/app/views/qae_form/_assessor_details_question.html.slim index ac45c1804..6ac149794 100644 --- a/app/views/qae_form/_assessor_details_question.html.slim +++ b/app/views/qae_form/_assessor_details_question.html.slim @@ -13,5 +13,5 @@ .clear - klass = "#{sub_field_title.parameterize == "phone-number-optional" ? "govuk-input--width-10" : "govuk-input--width-20"}" - - klass <<(QAEFormBuilder::AssessorDetailsQuestionValidator::NO_VALIDATION_SUB_FIELDS.exclude?(sub_field_key) ? " required" : " not-required") + - klass <<(QaeFormBuilder::AssessorDetailsQuestionValidator::NO_VALIDATION_SUB_FIELDS.exclude?(sub_field_key) ? " required" : " not-required") input.govuk-input.js-trigger-autosave class=klass type="text" id=question.input_name(suffix: sub_field_key) value=question.input_value(suffix: sub_field_key) name=question.input_name(suffix: sub_field_key) autocomplete="off" *possible_read_only_ops(question.step.opts[:id]) diff --git a/app/views/qae_form/_question.html.slim b/app/views/qae_form/_question.html.slim index 1cde1c5e4..d916491bc 100644 --- a/app/views/qae_form/_question.html.slim +++ b/app/views/qae_form/_question.html.slim @@ -15,7 +15,7 @@ fieldset class=question.fieldset_classes data=question.fieldset_data_hash span.todo = ref.to_s - unless question.title.blank? - - font_size = question.delegate_obj.is_a?(QAEFormBuilder::HeaderQuestion) ? "govuk-!-font-size-36" : "govuk-!-font-size-24" + - font_size = question.delegate_obj.is_a?(QaeFormBuilder::HeaderQuestion) ? "govuk-!-font-size-36" : "govuk-!-font-size-24" span class="govuk-body #{ font_size } govuk-!-font-weight-bold govuk-!-display-block" == question.title @@ -44,7 +44,7 @@ fieldset class=question.fieldset_classes data=question.fieldset_data_hash span.todo = ref.to_s - - if question.delegate_obj.is_a?(QAEFormBuilder::HeaderQuestion) + - if question.delegate_obj.is_a?(QaeFormBuilder::HeaderQuestion) - if question.ref || question.sub_ref span.question-context.question-debug.govuk-hint = "Please note #{(question.ref || question.sub_ref).delete(" ")} is just a heading for the following sub-questions." diff --git a/config/application.rb b/config/application.rb index 963a194dd..90afbc1ed 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,6 +8,8 @@ module Qae class Application < Rails::Application + config.load_defaults 7.0 + #initializer :regenerate_require_cache, before: :load_environment_config do # Bootscale.regenerate #end @@ -15,6 +17,7 @@ class Application < Rails::Application # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. # config.middleware.use Rack::SslEnforcer, except: "/healthcheck", except_environments: ["development", "test"] + config.autoloader = :zeitwerk if ENV['CORS_HOST'].present? config.middleware.insert_before 0, Rack::Cors do @@ -44,8 +47,12 @@ class Application < Rails::Application #NOTE: This works like Rails 4. For Rails 5, we can use # `config.eager_load_paths << Rails.root.join('lib')` but still it is not recommended for Threadsafty. # Need to take look in to it. - config.enable_dependency_loading = true - config.autoload_paths << Rails.root.join('lib') + config.eager_load = false + + config.autoload_once_paths << "#{root}/lib" + config.autoload_once_paths << "#{root}/forms" + config.autoload_paths << "#{root}/lib" + config.eager_load_paths << "#{root}/lib" config.generators do |g| g.test_framework :rspec diff --git a/forms/award_years/v2022/qae_forms.rb b/forms/award_years/v2022/qae_forms.rb index 7e345a35a..5e8f56962 100644 --- a/forms/award_years/v2022/qae_forms.rb +++ b/forms/award_years/v2022/qae_forms.rb @@ -1,4 +1,4 @@ -require 'award_years/v2022/qavs' +require_relative 'qavs' -class AwardYears::V2022::QAEForms +class AwardYears::V2022::QaeForms end diff --git a/forms/award_years/v2022/qavs.rb b/forms/award_years/v2022/qavs.rb index ff3a2171c..319b69945 100644 --- a/forms/award_years/v2022/qavs.rb +++ b/forms/award_years/v2022/qavs.rb @@ -1,29 +1,29 @@ -require "award_years/v2022/qavs/qavs_step1" -require "award_years/v2022/qavs/qavs_step2" -require "award_years/v2022/qavs/qavs_step3" -require "award_years/v2022/qavs/qavs_step4" -require "award_years/v2022/qavs/qavs_step5" +require_relative "qavs/qavs_step1" +require_relative "qavs/qavs_step2" +require_relative "qavs/qavs_step3" +require_relative "qavs/qavs_step4" +require_relative "qavs/qavs_step5" -class AwardYears::V2022::QAEForms +class AwardYears::V2022::QaeForms class << self def qavs - @qavs ||= QAEFormBuilder.build "Queen's Award for Voluntary Service Nomination" do + @qavs ||= QaeFormBuilder.build "Queen's Award for Voluntary Service Nomination" do step "nominee", - &AwardYears::V2022::QAEForms.qavs_step1 + &AwardYears::V2022::QaeForms.qavs_step1 step "recommendation", - &AwardYears::V2022::QAEForms.qavs_step2 + &AwardYears::V2022::QaeForms.qavs_step2 step "letters_of_support", { id: :letters_of_support_step }, - &AwardYears::V2022::QAEForms.qavs_step3 + &AwardYears::V2022::QaeForms.qavs_step3 step "submit_step", - &AwardYears::V2022::QAEForms.qavs_step4 + &AwardYears::V2022::QaeForms.qavs_step4 step "local_assessment_form", { id: :local_assessment }, - &AwardYears::V2022::QAEForms.qavs_step5 + &AwardYears::V2022::QaeForms.qavs_step5 end end end diff --git a/forms/award_years/v2022/qavs/qavs_step1.rb b/forms/award_years/v2022/qavs/qavs_step1.rb index 7254b3cf5..16d7e3184 100644 --- a/forms/award_years/v2022/qavs/qavs_step1.rb +++ b/forms/award_years/v2022/qavs/qavs_step1.rb @@ -1,5 +1,5 @@ # coding: utf-8 -class AwardYears::V2022::QAEForms +class AwardYears::V2022::QaeForms class << self def qavs_step1 @qavs_step1 ||= proc do diff --git a/forms/award_years/v2022/qavs/qavs_step2.rb b/forms/award_years/v2022/qavs/qavs_step2.rb index 1c1d06a6f..0f7c6fc68 100644 --- a/forms/award_years/v2022/qavs/qavs_step2.rb +++ b/forms/award_years/v2022/qavs/qavs_step2.rb @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -class AwardYears::V2022::QAEForms +class AwardYears::V2022::QaeForms class << self def qavs_step2 @qavs_step2 ||= proc do diff --git a/forms/award_years/v2022/qavs/qavs_step3.rb b/forms/award_years/v2022/qavs/qavs_step3.rb index 5fd11d62b..be9d6502c 100644 --- a/forms/award_years/v2022/qavs/qavs_step3.rb +++ b/forms/award_years/v2022/qavs/qavs_step3.rb @@ -1,4 +1,4 @@ -class AwardYears::V2022::QAEForms +class AwardYears::V2022::QaeForms class << self def qavs_step3 @qavs_step3 ||= proc do diff --git a/forms/award_years/v2022/qavs/qavs_step4.rb b/forms/award_years/v2022/qavs/qavs_step4.rb index 3cda747c2..2cea63bdb 100644 --- a/forms/award_years/v2022/qavs/qavs_step4.rb +++ b/forms/award_years/v2022/qavs/qavs_step4.rb @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -class AwardYears::V2022::QAEForms +class AwardYears::V2022::QaeForms class << self def qavs_step4 @qavs_step4 ||= proc do diff --git a/forms/award_years/v2022/qavs/qavs_step5.rb b/forms/award_years/v2022/qavs/qavs_step5.rb index 0da65b9c5..26b62d9d1 100644 --- a/forms/award_years/v2022/qavs/qavs_step5.rb +++ b/forms/award_years/v2022/qavs/qavs_step5.rb @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -class AwardYears::V2022::QAEForms +class AwardYears::V2022::QaeForms class << self def qavs_step5 @qavs_step5 ||= proc do diff --git a/forms/award_years/v2023/qae_forms.rb b/forms/award_years/v2023/qae_forms.rb index 2835928a9..94fa614e0 100644 --- a/forms/award_years/v2023/qae_forms.rb +++ b/forms/award_years/v2023/qae_forms.rb @@ -1,4 +1,4 @@ -require 'award_years/v2023/qavs' +require_relative 'qavs' -class AwardYears::V2023::QAEForms +class AwardYears::V2023::QaeForms end diff --git a/forms/award_years/v2023/qavs.rb b/forms/award_years/v2023/qavs.rb index df3c93452..368ca2b39 100644 --- a/forms/award_years/v2023/qavs.rb +++ b/forms/award_years/v2023/qavs.rb @@ -1,29 +1,29 @@ -require "award_years/v2023/qavs/qavs_step1" -require "award_years/v2023/qavs/qavs_step2" -require "award_years/v2023/qavs/qavs_step3" -require "award_years/v2023/qavs/qavs_step4" -require "award_years/v2023/qavs/qavs_step5" +require_relative "qavs/qavs_step1" +require_relative "qavs/qavs_step2" +require_relative "qavs/qavs_step3" +require_relative "qavs/qavs_step4" +require_relative "qavs/qavs_step5" -class AwardYears::V2023::QAEForms +class AwardYears::V2023::QaeForms class << self def qavs - @qavs ||= QAEFormBuilder.build "King's Award for Voluntary Service Nomination" do + @qavs ||= QaeFormBuilder.build "King's Award for Voluntary Service Nomination" do step "nominee", - &AwardYears::V2023::QAEForms.qavs_step1 + &AwardYears::V2023::QaeForms.qavs_step1 step "recommendation", - &AwardYears::V2023::QAEForms.qavs_step2 + &AwardYears::V2023::QaeForms.qavs_step2 step "letters_of_support", { id: :letters_of_support_step }, - &AwardYears::V2023::QAEForms.qavs_step3 + &AwardYears::V2023::QaeForms.qavs_step3 step "submit_step", - &AwardYears::V2023::QAEForms.qavs_step4 + &AwardYears::V2023::QaeForms.qavs_step4 step "local_assessment_form", { id: :local_assessment }, - &AwardYears::V2023::QAEForms.qavs_step5 + &AwardYears::V2023::QaeForms.qavs_step5 end end end diff --git a/forms/award_years/v2023/qavs/qavs_step1.rb b/forms/award_years/v2023/qavs/qavs_step1.rb index c0a6a7e33..7dea24f84 100644 --- a/forms/award_years/v2023/qavs/qavs_step1.rb +++ b/forms/award_years/v2023/qavs/qavs_step1.rb @@ -1,5 +1,5 @@ # coding: utf-8 -class AwardYears::V2023::QAEForms +class AwardYears::V2023::QaeForms class << self def qavs_step1 @qavs_step1 ||= proc do diff --git a/forms/award_years/v2023/qavs/qavs_step2.rb b/forms/award_years/v2023/qavs/qavs_step2.rb index a88f29fb0..6ab2e7953 100644 --- a/forms/award_years/v2023/qavs/qavs_step2.rb +++ b/forms/award_years/v2023/qavs/qavs_step2.rb @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -class AwardYears::V2023::QAEForms +class AwardYears::V2023::QaeForms class << self def qavs_step2 @qavs_step2 ||= proc do diff --git a/forms/award_years/v2023/qavs/qavs_step3.rb b/forms/award_years/v2023/qavs/qavs_step3.rb index aebdcb8e5..e74e9d877 100644 --- a/forms/award_years/v2023/qavs/qavs_step3.rb +++ b/forms/award_years/v2023/qavs/qavs_step3.rb @@ -1,4 +1,4 @@ -class AwardYears::V2023::QAEForms +class AwardYears::V2023::QaeForms class << self def qavs_step3 @qavs_step3 ||= proc do diff --git a/forms/award_years/v2023/qavs/qavs_step4.rb b/forms/award_years/v2023/qavs/qavs_step4.rb index acfb63602..fb43e46a8 100644 --- a/forms/award_years/v2023/qavs/qavs_step4.rb +++ b/forms/award_years/v2023/qavs/qavs_step4.rb @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -class AwardYears::V2023::QAEForms +class AwardYears::V2023::QaeForms class << self def qavs_step4 @qavs_step4 ||= proc do diff --git a/forms/award_years/v2023/qavs/qavs_step5.rb b/forms/award_years/v2023/qavs/qavs_step5.rb index 2bedccf06..bd0d610bf 100644 --- a/forms/award_years/v2023/qavs/qavs_step5.rb +++ b/forms/award_years/v2023/qavs/qavs_step5.rb @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -class AwardYears::V2023::QAEForms +class AwardYears::V2023::QaeForms class << self def qavs_step5 @qavs_step5 ||= proc do diff --git a/forms/award_years/v2024/qae_forms.rb b/forms/award_years/v2024/qae_forms.rb index b86d3a686..10112cd70 100644 --- a/forms/award_years/v2024/qae_forms.rb +++ b/forms/award_years/v2024/qae_forms.rb @@ -1,4 +1,4 @@ -require 'award_years/v2024/qavs' +require_relative 'qavs' -class AwardYears::V2024::QAEForms +class AwardYears::V2024::QaeForms end diff --git a/forms/award_years/v2024/qavs.rb b/forms/award_years/v2024/qavs.rb index 492f44e3d..a7c0ae68f 100644 --- a/forms/award_years/v2024/qavs.rb +++ b/forms/award_years/v2024/qavs.rb @@ -1,29 +1,29 @@ -require "award_years/v2024/qavs/qavs_step1" -require "award_years/v2024/qavs/qavs_step2" -require "award_years/v2024/qavs/qavs_step3" -require "award_years/v2024/qavs/qavs_step4" -require "award_years/v2024/qavs/qavs_step5" +require_relative "qavs/qavs_step1" +require_relative "qavs/qavs_step2" +require_relative "qavs/qavs_step3" +require_relative "qavs/qavs_step4" +require_relative "qavs/qavs_step5" -class AwardYears::V2024::QAEForms +class AwardYears::V2024::QaeForms class << self def qavs - @qavs ||= QAEFormBuilder.build "King's Award for Voluntary Service Nomination" do + @qavs ||= QaeFormBuilder.build "King's Award for Voluntary Service Nomination" do step "nominee", - &AwardYears::V2024::QAEForms.qavs_step1 + &AwardYears::V2024::QaeForms.qavs_step1 step "recommendation", - &AwardYears::V2024::QAEForms.qavs_step2 + &AwardYears::V2024::QaeForms.qavs_step2 step "letters_of_support", { id: :letters_of_support_step }, - &AwardYears::V2024::QAEForms.qavs_step3 + &AwardYears::V2024::QaeForms.qavs_step3 step "submit_step", - &AwardYears::V2024::QAEForms.qavs_step4 + &AwardYears::V2024::QaeForms.qavs_step4 step "local_assessment_form", { id: :local_assessment }, - &AwardYears::V2024::QAEForms.qavs_step5 + &AwardYears::V2024::QaeForms.qavs_step5 end end end diff --git a/forms/award_years/v2024/qavs/qavs_step1.rb b/forms/award_years/v2024/qavs/qavs_step1.rb index 3e85972e6..e660057b4 100644 --- a/forms/award_years/v2024/qavs/qavs_step1.rb +++ b/forms/award_years/v2024/qavs/qavs_step1.rb @@ -1,5 +1,5 @@ # coding: utf-8 -class AwardYears::V2024::QAEForms +class AwardYears::V2024::QaeForms class << self def qavs_step1 @qavs_step1 ||= proc do diff --git a/forms/award_years/v2024/qavs/qavs_step2.rb b/forms/award_years/v2024/qavs/qavs_step2.rb index 382295d6d..fefcb55da 100644 --- a/forms/award_years/v2024/qavs/qavs_step2.rb +++ b/forms/award_years/v2024/qavs/qavs_step2.rb @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -class AwardYears::V2024::QAEForms +class AwardYears::V2024::QaeForms class << self def qavs_step2 @qavs_step2 ||= proc do diff --git a/forms/award_years/v2024/qavs/qavs_step3.rb b/forms/award_years/v2024/qavs/qavs_step3.rb index c72a12f4e..caab1d43f 100644 --- a/forms/award_years/v2024/qavs/qavs_step3.rb +++ b/forms/award_years/v2024/qavs/qavs_step3.rb @@ -1,4 +1,4 @@ -class AwardYears::V2024::QAEForms +class AwardYears::V2024::QaeForms class << self def qavs_step3 @qavs_step3 ||= proc do diff --git a/forms/award_years/v2024/qavs/qavs_step4.rb b/forms/award_years/v2024/qavs/qavs_step4.rb index 166195c69..2a5c1ffdc 100644 --- a/forms/award_years/v2024/qavs/qavs_step4.rb +++ b/forms/award_years/v2024/qavs/qavs_step4.rb @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -class AwardYears::V2024::QAEForms +class AwardYears::V2024::QaeForms class << self def qavs_step4 @qavs_step4 ||= proc do diff --git a/forms/award_years/v2024/qavs/qavs_step5.rb b/forms/award_years/v2024/qavs/qavs_step5.rb index 9c8eba390..c7a0a4805 100644 --- a/forms/award_years/v2024/qavs/qavs_step5.rb +++ b/forms/award_years/v2024/qavs/qavs_step5.rb @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -class AwardYears::V2024::QAEForms +class AwardYears::V2024::QaeForms class << self def qavs_step5 @qavs_step5 ||= proc do diff --git a/forms/qae_form_builder.rb b/forms/qae_form_builder.rb index cfd22f09f..b797b1faa 100644 --- a/forms/qae_form_builder.rb +++ b/forms/qae_form_builder.rb @@ -37,11 +37,11 @@ require "qae_form_builder/assessor_details_question" -class QAEFormBuilder +class QaeFormBuilder class << self def build title, &block - form = QAEForm.new title + form = QaeForm.new title form.instance_eval &block if block_given? form end diff --git a/forms/qae_form_builder/address_question.rb b/forms/qae_form_builder/address_question.rb index 27d9ca993..a72ed3355 100644 --- a/forms/qae_form_builder/address_question.rb +++ b/forms/qae_form_builder/address_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class AddressQuestionValidator < QuestionValidator NO_VALIDATION_SUB_FIELDS = [:street, :county] def errors diff --git a/forms/qae_form_builder/assessor_details_question.rb b/forms/qae_form_builder/assessor_details_question.rb index 9da49a918..bdeea5abe 100644 --- a/forms/qae_form_builder/assessor_details_question.rb +++ b/forms/qae_form_builder/assessor_details_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class AssessorDetailsQuestionValidator < QuestionValidator NO_VALIDATION_SUB_FIELDS = [:secondary_assessor_name, :phone] def errors diff --git a/forms/qae_form_builder/by_years_label_question.rb b/forms/qae_form_builder/by_years_label_question.rb index e98e32db6..66f486ddb 100644 --- a/forms/qae_form_builder/by_years_label_question.rb +++ b/forms/qae_form_builder/by_years_label_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class ByYearsLabelQuestionValidator < QuestionValidator end diff --git a/forms/qae_form_builder/by_years_question.rb b/forms/qae_form_builder/by_years_question.rb index 1547aed46..36624a67e 100644 --- a/forms/qae_form_builder/by_years_question.rb +++ b/forms/qae_form_builder/by_years_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class ByYearsQuestionValidator < QuestionValidator end diff --git a/forms/qae_form_builder/ceremonial_county_question.rb b/forms/qae_form_builder/ceremonial_county_question.rb index 5623d4dad..4b538857c 100644 --- a/forms/qae_form_builder/ceremonial_county_question.rb +++ b/forms/qae_form_builder/ceremonial_county_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class CeremonialCountyQuestionValidator < OptionsQuestionValidator end diff --git a/forms/qae_form_builder/checkbox_seria_question.rb b/forms/qae_form_builder/checkbox_seria_question.rb index 05ce55ca1..96ab6adb8 100644 --- a/forms/qae_form_builder/checkbox_seria_question.rb +++ b/forms/qae_form_builder/checkbox_seria_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class CheckboxSeriaQuestionValidator < QuestionValidator def errors result = super diff --git a/forms/qae_form_builder/comment_question.rb b/forms/qae_form_builder/comment_question.rb index cf7154725..27e01ac8f 100644 --- a/forms/qae_form_builder/comment_question.rb +++ b/forms/qae_form_builder/comment_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class CommentQuestionValidator < QuestionValidator def errors {} diff --git a/forms/qae_form_builder/confirm_question.rb b/forms/qae_form_builder/confirm_question.rb index 7f87e11f0..995f2ea1f 100644 --- a/forms/qae_form_builder/confirm_question.rb +++ b/forms/qae_form_builder/confirm_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class ConfirmQuestionValidator < QuestionValidator end diff --git a/forms/qae_form_builder/contact_email_question.rb b/forms/qae_form_builder/contact_email_question.rb index f322b879f..0766dbb23 100644 --- a/forms/qae_form_builder/contact_email_question.rb +++ b/forms/qae_form_builder/contact_email_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class ContactEmailQuestionValidator < QuestionValidator end diff --git a/forms/qae_form_builder/contact_question.rb b/forms/qae_form_builder/contact_question.rb index ac9d5b6c7..4566d0aa4 100644 --- a/forms/qae_form_builder/contact_question.rb +++ b/forms/qae_form_builder/contact_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class ContactQuestionValidator < QuestionValidator end diff --git a/forms/qae_form_builder/country_question.rb b/forms/qae_form_builder/country_question.rb index af99df646..88a2ab209 100644 --- a/forms/qae_form_builder/country_question.rb +++ b/forms/qae_form_builder/country_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class CountryQuestionValidator < QuestionValidator end diff --git a/forms/qae_form_builder/date_question.rb b/forms/qae_form_builder/date_question.rb index f32058be0..394019bfc 100644 --- a/forms/qae_form_builder/date_question.rb +++ b/forms/qae_form_builder/date_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class DateQuestionValidator < QuestionValidator def errors result = super diff --git a/forms/qae_form_builder/dropdown_question.rb b/forms/qae_form_builder/dropdown_question.rb index aefda5f5b..c4970f06d 100644 --- a/forms/qae_form_builder/dropdown_question.rb +++ b/forms/qae_form_builder/dropdown_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class DropdownQuestionValidator < OptionsQuestionValidator end diff --git a/forms/qae_form_builder/head_of_business_question.rb b/forms/qae_form_builder/head_of_business_question.rb index dd030f969..e199de154 100644 --- a/forms/qae_form_builder/head_of_business_question.rb +++ b/forms/qae_form_builder/head_of_business_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class HeadOfBusinessQuestionValidator < QuestionValidator end diff --git a/forms/qae_form_builder/header_question.rb b/forms/qae_form_builder/header_question.rb index 23bdab0e2..1c9b4ac5d 100644 --- a/forms/qae_form_builder/header_question.rb +++ b/forms/qae_form_builder/header_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class HeaderQuestionValidator < QuestionValidator def errors {} diff --git a/forms/qae_form_builder/multi_question_decorator.rb b/forms/qae_form_builder/multi_question_decorator.rb index 2a6aaf73d..f4cbb9697 100644 --- a/forms/qae_form_builder/multi_question_decorator.rb +++ b/forms/qae_form_builder/multi_question_decorator.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder::MultiQuestionDecorator < QAEFormBuilder::QuestionDecorator +class QaeFormBuilder::MultiQuestionDecorator < QaeFormBuilder::QuestionDecorator def entities @entities ||= (answers[delegate_obj.key.to_s] || []) end diff --git a/forms/qae_form_builder/multi_question_validator.rb b/forms/qae_form_builder/multi_question_validator.rb index f0e59d9fd..13813eb23 100644 --- a/forms/qae_form_builder/multi_question_validator.rb +++ b/forms/qae_form_builder/multi_question_validator.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder::MultiQuestionValidator < QAEFormBuilder::QuestionValidator +class QaeFormBuilder::MultiQuestionValidator < QaeFormBuilder::QuestionValidator def errors result = super diff --git a/forms/qae_form_builder/number_question.rb b/forms/qae_form_builder/number_question.rb index 1d13cb438..4007fb696 100644 --- a/forms/qae_form_builder/number_question.rb +++ b/forms/qae_form_builder/number_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class NumberQuestionValidator < QuestionValidator end diff --git a/forms/qae_form_builder/one_option_by_years_label_question.rb b/forms/qae_form_builder/one_option_by_years_label_question.rb index 3f5221945..b51c5b1ab 100644 --- a/forms/qae_form_builder/one_option_by_years_label_question.rb +++ b/forms/qae_form_builder/one_option_by_years_label_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class OneOptionByYearsLabelQuestionValidator < QuestionValidator end diff --git a/forms/qae_form_builder/one_option_by_years_question.rb b/forms/qae_form_builder/one_option_by_years_question.rb index bf41003c4..8496b73c8 100644 --- a/forms/qae_form_builder/one_option_by_years_question.rb +++ b/forms/qae_form_builder/one_option_by_years_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class OneOptionByYearsQuestionValidator < QuestionValidator end diff --git a/forms/qae_form_builder/options_business_name_changed_question.rb b/forms/qae_form_builder/options_business_name_changed_question.rb index 12474ceb2..313c0b422 100644 --- a/forms/qae_form_builder/options_business_name_changed_question.rb +++ b/forms/qae_form_builder/options_business_name_changed_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class OptionsBusinessNameChangedQuestionValidator < OptionsQuestionValidator end diff --git a/forms/qae_form_builder/options_question.rb b/forms/qae_form_builder/options_question.rb index 3b59600f6..b53809332 100644 --- a/forms/qae_form_builder/options_question.rb +++ b/forms/qae_form_builder/options_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class OptionsQuestionValidator < QuestionValidator end diff --git a/forms/qae_form_builder/previous_name_question.rb b/forms/qae_form_builder/previous_name_question.rb index d972f9580..f4681aa1b 100644 --- a/forms/qae_form_builder/previous_name_question.rb +++ b/forms/qae_form_builder/previous_name_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class PreviousNameQuestionValidator < QuestionValidator end diff --git a/forms/qae_form_builder/qae_decorator.rb b/forms/qae_form_builder/qae_decorator.rb index 47b61aa42..0f04e5afe 100644 --- a/forms/qae_form_builder/qae_decorator.rb +++ b/forms/qae_form_builder/qae_decorator.rb @@ -1,6 +1,6 @@ -class QAEFormBuilder +class QaeFormBuilder - class QAEDecorator + class QaeDecorator attr_reader :delegate_obj def initialize obj, decorator_options = {} diff --git a/forms/qae_form_builder/qae_form.rb b/forms/qae_form_builder/qae_form.rb index ae4aa0d04..90e524b6c 100644 --- a/forms/qae_form_builder/qae_form.rb +++ b/forms/qae_form_builder/qae_form.rb @@ -1,6 +1,6 @@ -class QAEFormBuilder +class QaeFormBuilder - class QAEForm + class QaeForm attr_reader :title, :opts, :steps, :questions_by_key def initialize title, opts={} @@ -16,7 +16,7 @@ def [] key end def decorate options = {} - QAEFormDecorator.new self, options + QaeFormDecorator.new self, options end def step title, options = {}, &block diff --git a/forms/qae_form_builder/qae_form_decorator.rb b/forms/qae_form_builder/qae_form_decorator.rb index 2c42dbb87..c99ba22bb 100644 --- a/forms/qae_form_builder/qae_form_decorator.rb +++ b/forms/qae_form_builder/qae_form_decorator.rb @@ -1,6 +1,6 @@ -class QAEFormBuilder +class QaeFormBuilder - class QAEFormDecorator < QAEDecorator + class QaeFormDecorator < QaeDecorator def form_name @decorator_options[:form_name] || 'form' diff --git a/forms/qae_form_builder/question.rb b/forms/qae_form_builder/question.rb index aeafb96d9..994804e3b 100644 --- a/forms/qae_form_builder/question.rb +++ b/forms/qae_form_builder/question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class QuestionValidator # multifield questions that can not be simply validated SKIP_PRESENCE_VALIDATION_QUESTIONS = [ @@ -50,7 +50,7 @@ def limit_with_buffer(limit) end end - class QuestionDecorator < QAEDecorator + class QuestionDecorator < QaeDecorator def input_name options = {} if options[:index] suffix = options.fetch(:suffix) @@ -152,7 +152,7 @@ def validate error = {} question_class = delegate_obj.class.name.demodulize - validator_class = "QAEFormBuilder::#{question_class}Validator".constantize + validator_class = "QaeFormBuilder::#{question_class}Validator".constantize validator = validator_class.new(self, answers) errors.merge!(validator.errors) @@ -260,11 +260,11 @@ def children_conditions(questions_with_references) end def can_have_conditional_hints? - delegate_obj.is_a?(QAEFormBuilder::OptionsQuestion) + delegate_obj.is_a?(QaeFormBuilder::OptionsQuestion) end def can_have_parent_conditional_hints? - !delegate_obj.is_a?(QAEFormBuilder::HeaderQuestion) + !delegate_obj.is_a?(QaeFormBuilder::HeaderQuestion) end def pdf_conditional_hints(questions_with_references) @@ -483,7 +483,7 @@ def title def decorate options = {} kls_name = self.class.name.split('::').last - kls = QAEFormBuilder.const_get "#{kls_name}Decorator" rescue nil + kls = QaeFormBuilder.const_get "#{kls_name}Decorator" rescue nil (kls || QuestionDecorator).new self, options end diff --git a/forms/qae_form_builder/regions_question.rb b/forms/qae_form_builder/regions_question.rb index fa3ac1f2c..0d246946c 100644 --- a/forms/qae_form_builder/regions_question.rb +++ b/forms/qae_form_builder/regions_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class RegionsQuestionValidator < DropdownQuestionValidator def errors result = super @@ -20,7 +20,7 @@ class RegionsQuestionBuilder < DropdownQuestionBuilder class RegionsQuestionDecorator < QuestionDecorator def regions - ::QAEFormBuilder::AddressQuestionDecorator::REGIONS.sort + ::QaeFormBuilder::AddressQuestionDecorator::REGIONS.sort end def entities diff --git a/forms/qae_form_builder/sic_code_dropdown_question.rb b/forms/qae_form_builder/sic_code_dropdown_question.rb index e6824aab4..fe6b69b8d 100644 --- a/forms/qae_form_builder/sic_code_dropdown_question.rb +++ b/forms/qae_form_builder/sic_code_dropdown_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class SicCodeDropdownQuestionValidator < QuestionValidator end diff --git a/forms/qae_form_builder/step.rb b/forms/qae_form_builder/step.rb index 634774ba8..db5148a79 100644 --- a/forms/qae_form_builder/step.rb +++ b/forms/qae_form_builder/step.rb @@ -1,8 +1,8 @@ require 'active_support/inflector' -class QAEFormBuilder +class QaeFormBuilder - class StepDecorator < QAEDecorator + class StepDecorator < QaeDecorator QUESTIONS_WITH_NOT_REJECTING_BLANKS_ON_SAVE = %w( innovation_materials @@ -49,7 +49,7 @@ def allowed_questions_params_list(form_data) allowed_params[question.key] = hashify_params(form_data[question.key]) question_possible_sub_keys(question).each do |sub_question_key| - allowed_params[sub_question_key] = if question.delegate_obj.is_a?(QAEFormBuilder::ByYearsQuestion) || question.delegate_obj.is_a?(QAEFormBuilder::OneOptionByYearsQuestion) + allowed_params[sub_question_key] = if question.delegate_obj.is_a?(QaeFormBuilder::ByYearsQuestion) || question.delegate_obj.is_a?(QaeFormBuilder::OneOptionByYearsQuestion) # Sometimes users can input commas, we are stripping them form_data[sub_question_key].to_s.delete(",") else @@ -57,7 +57,7 @@ def allowed_questions_params_list(form_data) end end - if question.delegate_obj.is_a?(QAEFormBuilder::UploadQuestion) && + if question.delegate_obj.is_a?(QaeFormBuilder::UploadQuestion) && hashify_params(form_data[question.key]).nil? # This code handles case when user removes all attachments / links # from Form: Add Website Address/Documents section @@ -96,7 +96,7 @@ def question_possible_sub_keys(question) if by_year_conditions.present? sub_question_keys += question.by_year_conditions.map do |c| (1..c.years).map do |y| - if question.delegate_obj.is_a?(QAEFormBuilder::ByYearsLabelQuestion) + if question.delegate_obj.is_a?(QaeFormBuilder::ByYearsLabelQuestion) [:day, :month, :year].map do |i| "#{y}of#{c.years}#{i}" end @@ -107,9 +107,9 @@ def question_possible_sub_keys(question) end.flatten end - if question.delegate_obj.is_a?(QAEFormBuilder::OneOptionByYearsLabelQuestion) || question.delegate_obj.is_a?(QAEFormBuilder::OneOptionByYearsQuestion) + if question.delegate_obj.is_a?(QaeFormBuilder::OneOptionByYearsLabelQuestion) || question.delegate_obj.is_a?(QaeFormBuilder::OneOptionByYearsQuestion) sub_question_keys += (1..3).map do |y| - if question.delegate_obj.is_a?(QAEFormBuilder::OneOptionByYearsLabelQuestion) + if question.delegate_obj.is_a?(QaeFormBuilder::OneOptionByYearsLabelQuestion) [:day, :month, :year].map do |i| "#{y}of3#{i}" end @@ -149,8 +149,8 @@ def submit text, &block end def method_missing(meth, *args, &block) - klass_builder = QAEFormBuilder.const_get("#{meth.to_s.camelize}QuestionBuilder") rescue nil - klass = QAEFormBuilder.const_get("#{meth.to_s.camelize}Question") rescue nil + klass_builder = QaeFormBuilder.const_get("#{meth.to_s.camelize}QuestionBuilder") rescue nil + klass = QaeFormBuilder.const_get("#{meth.to_s.camelize}Question") rescue nil if klass_builder && klass && args.length >= 2 && args.length <= 3 id, title, opts = args diff --git a/forms/qae_form_builder/supporters_question.rb b/forms/qae_form_builder/supporters_question.rb index c1fe02d06..67a55a3d8 100644 --- a/forms/qae_form_builder/supporters_question.rb +++ b/forms/qae_form_builder/supporters_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class SupportersQuestionValidator < QuestionValidator MIN_LIMIT = 2 diff --git a/forms/qae_form_builder/text_question.rb b/forms/qae_form_builder/text_question.rb index d6d7e3efa..34f9c03a2 100644 --- a/forms/qae_form_builder/text_question.rb +++ b/forms/qae_form_builder/text_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class TextQuestionValidator < QuestionValidator # regex source: https://stackoverflow.com/questions/46155/how-to-validate-an-email-address-in-javascript/13178771#13178771 EMAIL_REGEX = /\A([a-zA-Z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)\z/ diff --git a/forms/qae_form_builder/textarea_question.rb b/forms/qae_form_builder/textarea_question.rb index 4b81e308e..42833056f 100644 --- a/forms/qae_form_builder/textarea_question.rb +++ b/forms/qae_form_builder/textarea_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class TextareaQuestionValidator < QuestionValidator def errors result = super diff --git a/forms/qae_form_builder/upload_question.rb b/forms/qae_form_builder/upload_question.rb index 3f7e3365a..8116ee258 100644 --- a/forms/qae_form_builder/upload_question.rb +++ b/forms/qae_form_builder/upload_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class UploadQuestionValidator < QuestionValidator end diff --git a/forms/qae_form_builder/user_info_question.rb b/forms/qae_form_builder/user_info_question.rb index 79e41d823..b368684e6 100644 --- a/forms/qae_form_builder/user_info_question.rb +++ b/forms/qae_form_builder/user_info_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class UserInfoQuestionValidator < QuestionValidator def errors result = super diff --git a/forms/qae_form_builder/year_question.rb b/forms/qae_form_builder/year_question.rb index b19177716..7b45bde25 100644 --- a/forms/qae_form_builder/year_question.rb +++ b/forms/qae_form_builder/year_question.rb @@ -1,4 +1,4 @@ -class QAEFormBuilder +class QaeFormBuilder class YearQuestionValidator < QuestionValidator def errors result = super diff --git a/lib/qae.rb b/lib/q_a_e.rb similarity index 100% rename from lib/qae.rb rename to lib/q_a_e.rb diff --git a/lib/sic_code.rb b/lib/sic_code.rb index 47162da86..2aa61b198 100644 --- a/lib/sic_code.rb +++ b/lib/sic_code.rb @@ -1,6 +1,6 @@ require "csv" -class SICCode < ActiveYaml::Base +class SicCode < ActiveYaml::Base REGEX = /\A\d{4}(\/\d{1})?\z/ # based on the sic codes spreadsheet set_root_path "#{Rails.root}/db/fixtures" @@ -52,6 +52,6 @@ def name end def self.collection - SICCode.all.sort_by(&:code).map { |sic| [sic.name, sic.code] } + SicCode.all.sort_by(&:code).map { |sic| [sic.name, sic.code] } end end diff --git a/spec/unit/qae_form_builder_spec.rb b/spec/unit/qae_form_builder_spec.rb index 93a4a7e09..0fd0fe31c 100644 --- a/spec/unit/qae_form_builder_spec.rb +++ b/spec/unit/qae_form_builder_spec.rb @@ -1,20 +1,20 @@ require 'rails_helper' -describe QAEFormBuilder do +describe QaeFormBuilder do - it 'should build QAEFormBuilder::Form instances' do - empty = QAEFormBuilder.build 'test' + it 'should build QaeFormBuilder::Form instances' do + empty = QaeFormBuilder.build 'test' expect(empty.title).to eq('test') - expect(empty).to be_instance_of(QAEFormBuilder::QAEForm) + expect(empty).to be_instance_of(QaeFormBuilder::QAEForm) end it 'should build 0 steps for empty block' do - empty = QAEFormBuilder.build 'test' + empty = QaeFormBuilder.build 'test' expect(empty.steps).to eq([]) end it 'should build form steps' do - sample = QAEFormBuilder.build 'test' do + sample = QaeFormBuilder.build 'test' do step 'eligibility' step 'company_info' step 'goods_or_services', custom_option: :foo @@ -27,7 +27,7 @@ end it 'should build questions inside steps' do - sample = QAEFormBuilder.build 'test' do + sample = QaeFormBuilder.build 'test' do step 'eligibility' do text :org_kind, 'What kind of organisation are you?' text :org_uk, 'Is your business based in UK?' do @@ -48,7 +48,7 @@ end it 'should navigate between steps with decorator' do - sample = QAEFormBuilder.build 'test' do + sample = QaeFormBuilder.build 'test' do step 'A', 'A' step 'B', 'B' end @@ -67,7 +67,7 @@ end it 'should report visible? depending on conditionals' do - sample = QAEFormBuilder.build 'test' do + sample = QaeFormBuilder.build 'test' do step 'test_step' do options :parent, 'Parent' do yes_no @@ -87,7 +87,7 @@ describe "Drop conditions" do let(:sample) do - QAEFormBuilder.build 'test' do + QaeFormBuilder.build 'test' do step 'test_step' do options :grandparent, 'Grand' do option '2 years', '2' From cfeb71bec26797ac58e205e172f63e0e639daccd Mon Sep 17 00:00:00 2001 From: Vasili Kachalko Date: Mon, 6 Nov 2023 11:29:07 +0100 Subject: [PATCH 04/20] update statesman --- Gemfile | 2 +- Gemfile.lock | 4 ++-- app/models/form_answer.rb | 5 ++++- app/models/form_answer_transition.rb | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 537d22ba7..328506d4f 100644 --- a/Gemfile +++ b/Gemfile @@ -70,7 +70,7 @@ gem 'kaminari' gem 'wicked', '~> 1.1' # Statemachine -gem 'statesman', '3.5.0' +gem 'statesman', '~> 11.0' # Form & Data helpers gem 'simple_form', '~> 5.0' diff --git a/Gemfile.lock b/Gemfile.lock index a792d03b3..64eeafac0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -706,7 +706,7 @@ GEM activesupport (>= 5.2) sprockets (>= 3.0.0) ssrf_filter (1.1.2) - statesman (3.5.0) + statesman (11.0.0) stringio (3.0.8) temple (0.8.2) thor (1.3.0) @@ -858,7 +858,7 @@ DEPENDENCIES slim-rails (~> 3.2.0) sprockets (~> 3.7.2) sprockets-rails (>= 2.0.0) - statesman (= 3.5.0) + statesman (~> 11.0) timecop turnip (~> 4.4.0) uglifier (>= 2.7.2) diff --git a/app/models/form_answer.rb b/app/models/form_answer.rb index 697197c46..0100f6329 100644 --- a/app/models/form_answer.rb +++ b/app/models/form_answer.rb @@ -3,7 +3,10 @@ require_relative '../../forms/award_years/v2024/qae_forms' class FormAnswer < ApplicationRecord - include Statesman::Adapters::ActiveRecordQueries +include Statesman::Adapters::ActiveRecordQueries[ + initial_state: :eligibility_in_progress, + transition_class: FormAnswerTransition + ] include PgSearch::Model extend Enumerize include FormAnswerStatesHelper diff --git a/app/models/form_answer_transition.rb b/app/models/form_answer_transition.rb index c62212972..f08891410 100644 --- a/app/models/form_answer_transition.rb +++ b/app/models/form_answer_transition.rb @@ -1,7 +1,7 @@ class FormAnswerTransition < ApplicationRecord include Statesman::Adapters::ActiveRecordTransition - belongs_to :form_answer, inverse_of: :form_answer_transitions + belongs_to :form_answer, optional: true, inverse_of: :form_answer_transitions def transitable t_type = metadata["transitable_type"] From cc9ccec1002dca1f21ef3e2bf31624b1d14a6237 Mon Sep 17 00:00:00 2001 From: Vasili Kachalko Date: Mon, 6 Nov 2023 11:40:06 +0100 Subject: [PATCH 05/20] fix models specs --- app/models/form_answer_attachment.rb | 2 +- app/models/support_letter_attachment.rb | 2 +- app/validators/file_size_validator.rb | 2 +- spec/models/assessor_assignment_spec.rb | 2 +- spec/models/eligibility_spec.rb | 4 ++-- spec/models/group_leader_spec.rb | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/form_answer_attachment.rb b/app/models/form_answer_attachment.rb index fd4c4eb3c..9ea52ad7e 100644 --- a/app/models/form_answer_attachment.rb +++ b/app/models/form_answer_attachment.rb @@ -1,6 +1,6 @@ class FormAnswerAttachment < ApplicationRecord belongs_to :form_answer - belongs_to :attachable, polymorphic: true + belongs_to :attachable, polymorphic: true, optional: true mount_uploader :file, FormAnswerAttachmentUploader scan_file :file diff --git a/app/models/support_letter_attachment.rb b/app/models/support_letter_attachment.rb index c3640ba45..7ba459d4e 100644 --- a/app/models/support_letter_attachment.rb +++ b/app/models/support_letter_attachment.rb @@ -8,7 +8,7 @@ class SupportLetterAttachment < ApplicationRecord begin :associations belongs_to :user belongs_to :form_answer - belongs_to :support_letter + belongs_to :support_letter, optional: true end begin :validations diff --git a/app/validators/file_size_validator.rb b/app/validators/file_size_validator.rb index a2f729339..fad3ec6d3 100644 --- a/app/validators/file_size_validator.rb +++ b/app/validators/file_size_validator.rb @@ -56,7 +56,7 @@ def validate_each(record, attribute, value) default_message = options[MESSAGES[key]] errors_options[:message] ||= default_message if default_message - record.errors.add(attribute, MESSAGES[key], errors_options) + record.errors.add(attribute, MESSAGES[key], **errors_options) end end diff --git a/spec/models/assessor_assignment_spec.rb b/spec/models/assessor_assignment_spec.rb index 8d9f1a3a5..bf94a0bf2 100644 --- a/spec/models/assessor_assignment_spec.rb +++ b/spec/models/assessor_assignment_spec.rb @@ -13,7 +13,7 @@ end it "is invalid" do expect(subject).to_not be_valid - expect(subject.errors.keys).to include(:verdict_rate) + expect(subject.errors.attribute_names).to include(:verdict_rate) end end end diff --git a/spec/models/eligibility_spec.rb b/spec/models/eligibility_spec.rb index 765a08bd7..05e35da36 100644 --- a/spec/models/eligibility_spec.rb +++ b/spec/models/eligibility_spec.rb @@ -2,8 +2,8 @@ describe Eligibility do - it {is_expected.to belong_to(:account)} - it {is_expected.to belong_to(:form_answer)} + it { is_expected.to belong_to(:account) } + it { is_expected.to belong_to(:form_answer).optional } describe 'base validation' do it 'should raise error' do diff --git a/spec/models/group_leader_spec.rb b/spec/models/group_leader_spec.rb index 63ed6fc91..955465285 100644 --- a/spec/models/group_leader_spec.rb +++ b/spec/models/group_leader_spec.rb @@ -4,7 +4,7 @@ subject {build(:group_leader)} describe "associations" do - it { should belong_to(:form_answer) } + it { should belong_to(:form_answer).optional } end it 'has valid a factory' do From af35a86216f87d74de57699c0ff358e22e3bc133 Mon Sep 17 00:00:00 2001 From: Vasili Kachalko Date: Mon, 6 Nov 2023 12:13:42 +0100 Subject: [PATCH 06/20] fix migration error --- ...most_recent_for_form_answer_transitions.rb | 2 +- ...0809072320_add_form_answer_to_citations.rb | 2 +- lib/tasks/statesman.rake | 62 +++++++++++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 lib/tasks/statesman.rake diff --git a/db/migrate/20181102125923_add_constraints_to_most_recent_for_form_answer_transitions.rb b/db/migrate/20181102125923_add_constraints_to_most_recent_for_form_answer_transitions.rb index 42dc49396..444b4101b 100644 --- a/db/migrate/20181102125923_add_constraints_to_most_recent_for_form_answer_transitions.rb +++ b/db/migrate/20181102125923_add_constraints_to_most_recent_for_form_answer_transitions.rb @@ -2,7 +2,7 @@ class AddConstraintsToMostRecentForFormAnswerTransitions < ActiveRecord::Migrati disable_ddl_transaction! def up - Rake::Task['statesman:backfill_most_recent'].invoke("FormAnswer") + Rake::Task['statesman:backfill_most_recent_fixed'].invoke("FormAnswer") FormAnswerTransition.where(most_recent: nil).update_all(most_recent: false) add_index :form_answer_transitions, [:form_answer_id, :most_recent], unique: true, where: "most_recent", name: "index_form_answer_transitions_parent_most_recent", algorithm: :concurrently rescue "" change_column_null :form_answer_transitions, :most_recent, false diff --git a/db/migrate/20210809072320_add_form_answer_to_citations.rb b/db/migrate/20210809072320_add_form_answer_to_citations.rb index dc78f0610..67211d825 100644 --- a/db/migrate/20210809072320_add_form_answer_to_citations.rb +++ b/db/migrate/20210809072320_add_form_answer_to_citations.rb @@ -1,5 +1,5 @@ class AddFormAnswerToCitations < ActiveRecord::Migration[6.0] def change - add_reference :citations, :form_answer, index: true, foreigh_key: true + add_reference :citations, :form_answer, index: true, foreign_key: true end end diff --git a/lib/tasks/statesman.rake b/lib/tasks/statesman.rake new file mode 100644 index 000000000..5dcde0713 --- /dev/null +++ b/lib/tasks/statesman.rake @@ -0,0 +1,62 @@ +namespace :statesman do + desc "Set most_recent to false for old transitions and to true for the " \ + "latest one. Safe to re-run" + task :backfill_most_recent_fixed, [:parent_model_name] => :environment do |_, args| + parent_model_name = args.parent_model_name + abort("Parent model name must be specified") unless parent_model_name + + parent_class = parent_model_name.constantize + transition_class = parent_class.transition_class + parent_fk = "#{parent_model_name.demodulize.underscore}_id" + updated_at = if ActiveRecord.default_timezone == :utc + Time.now.utc + else + Time.now + end + + total_models = parent_class.count + done_models = 0 + batch_size = 500 + + parent_class.find_in_batches(batch_size: batch_size) do |models| + ActiveRecord::Base.transaction(requires_new: true) do + if Statesman::Adapters::ActiveRecord.database_supports_partial_indexes? + # Set all transitions' most_recent to FALSE + transition_class.where(parent_fk => models.map(&:id)). + update_all(most_recent: false, updated_at: updated_at) + else + transition_class.where(parent_fk => models.map(&:id)). + update_all(most_recent: nil, updated_at: updated_at) + end + + # Set current transition's most_recent to TRUE + initial_t = transition_class.arel_table + subsequent_t = initial_t.alias + + later_row_for_same_parent = initial_t[parent_fk]. + eq(subsequent_t[parent_fk]). + and(initial_t[:sort_key]. + lt(subsequent_t[:sort_key])) + + no_later_row = subsequent_t[:id].eq(nil) + in_current_parent_batch = initial_t[parent_fk].in(models.map(&:id)) + + latest_ids_query = initial_t.join(subsequent_t, Arel::Nodes::OuterJoin). + on(later_row_for_same_parent). + where(no_later_row.and(in_current_parent_batch)). + project(initial_t[:id]).to_sql + + latest_ids = transition_class.find_by_sql(latest_ids_query). + to_a.collect(&:id) + + transition_class.where(id: latest_ids). + update_all(most_recent: true, updated_at: updated_at) + end + + done_models += batch_size + puts "Updated #{transition_class.name.pluralize} for " \ + "#{[done_models, total_models].min}/#{total_models} " \ + "#{parent_model_name.pluralize}" + end + end +end From 0ce5dc3a05e67217ec4fe3f37927cf6be4a980cd Mon Sep 17 00:00:00 2001 From: Vasili Kachalko Date: Mon, 6 Nov 2023 12:23:58 +0100 Subject: [PATCH 07/20] update papertrail and modify configs --- Gemfile | 2 +- Gemfile.lock | 8 +- config/environments/test.rb | 2 + .../new_framework_defaults_7_0.rb | 148 ++++++++++++++++++ config/initializers/paper_trail.rb | 1 - config/initializers/permissions_policy.rb | 11 ++ config/puma.rb | 1 - 7 files changed, 166 insertions(+), 7 deletions(-) create mode 100644 config/initializers/new_framework_defaults_7_0.rb create mode 100644 config/initializers/permissions_policy.rb diff --git a/Gemfile b/Gemfile index 328506d4f..777d142e4 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,7 @@ gem 'pg' gem 'activerecord-import' # Track Changes -gem 'paper_trail', '~> 10.3' +gem 'paper_trail', '~> 15.0' # Assets & Templates gem 'sprockets', '~> 3.7.2' diff --git a/Gemfile.lock b/Gemfile.lock index 64eeafac0..594f4357e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -441,9 +441,9 @@ GEM jwt (>= 1.5, < 3) orm_adapter (0.5.0) os (1.1.4) - paper_trail (10.3.1) - activerecord (>= 4.2) - request_store (~> 1.1) + paper_trail (15.1.0) + activerecord (>= 6.1) + request_store (~> 1.4) parallel (1.23.0) parser (3.2.2.3) ast (~> 2.4.1) @@ -818,7 +818,7 @@ DEPENDENCIES meta_request nilify_blanks nokogiri - paper_trail (~> 10.3) + paper_trail (~> 15.0) pdf-inspector pg pg_search (~> 2.3.3) diff --git a/config/environments/test.rb b/config/environments/test.rb index ca0179387..4760a796a 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -45,6 +45,8 @@ # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + config.active_support.disallowed_deprecation = :raise + config.active_support.disallowed_deprecation_warnings = [] config.active_job.queue_adapter = :test config.cache_store = :null_store diff --git a/config/initializers/new_framework_defaults_7_0.rb b/config/initializers/new_framework_defaults_7_0.rb new file mode 100644 index 000000000..0c6eda1b8 --- /dev/null +++ b/config/initializers/new_framework_defaults_7_0.rb @@ -0,0 +1,148 @@ +# Be sure to restart your server when you modify this file. +# +# This file eases your Rails 7.0 framework defaults upgrade. +# +# Uncomment each configuration one by one to switch to the new default. +# Once your application is ready to run with all new defaults, you can remove +# this file and set the `config.load_defaults` to `7.0`. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. +# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html + +# `button_to` view helper will render `