diff --git a/Gemfile b/Gemfile index 902f6917..cf4893ba 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby "3.2.3" # Bundle edge Rails instead: gem "rails", github: "rails/rails" -gem "rails", "~> 7.0.8" +gem "rails", "~> 7.1.0" # Use postgresql as the database for Active Record gem "pg", "~> 1.5.6" # Use Puma as the app server diff --git a/Gemfile.lock b/Gemfile.lock index db9e66bd..87f6989f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,90 +7,103 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8.4) - actionpack (= 7.0.8.4) - activesupport (= 7.0.8.4) + actioncable (7.1.5.2) + actionpack (= 7.1.5.2) + activesupport (= 7.1.5.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8.4) - actionpack (= 7.0.8.4) - activejob (= 7.0.8.4) - activerecord (= 7.0.8.4) - activestorage (= 7.0.8.4) - activesupport (= 7.0.8.4) + zeitwerk (~> 2.6) + actionmailbox (7.1.5.2) + actionpack (= 7.1.5.2) + activejob (= 7.1.5.2) + activerecord (= 7.1.5.2) + activestorage (= 7.1.5.2) + activesupport (= 7.1.5.2) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.8.4) - actionpack (= 7.0.8.4) - actionview (= 7.0.8.4) - activejob (= 7.0.8.4) - activesupport (= 7.0.8.4) + actionmailer (7.1.5.2) + actionpack (= 7.1.5.2) + actionview (= 7.1.5.2) + activejob (= 7.1.5.2) + activesupport (= 7.1.5.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.8.4) - actionview (= 7.0.8.4) - activesupport (= 7.0.8.4) - rack (~> 2.0, >= 2.2.4) + rails-dom-testing (~> 2.2) + actionpack (7.1.5.2) + actionview (= 7.1.5.2) + activesupport (= 7.1.5.2) + nokogiri (>= 1.8.5) + racc + 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 (7.0.8.4) - actionpack (= 7.0.8.4) - activerecord (= 7.0.8.4) - activestorage (= 7.0.8.4) - activesupport (= 7.0.8.4) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.5.2) + actionpack (= 7.1.5.2) + activerecord (= 7.1.5.2) + activestorage (= 7.1.5.2) + activesupport (= 7.1.5.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8.4) - activesupport (= 7.0.8.4) + actionview (7.1.5.2) + activesupport (= 7.1.5.2) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.8.4) - activesupport (= 7.0.8.4) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.1.5.2) + activesupport (= 7.1.5.2) globalid (>= 0.3.6) - activemodel (7.0.8.4) - activesupport (= 7.0.8.4) - activerecord (7.0.8.4) - activemodel (= 7.0.8.4) - activesupport (= 7.0.8.4) - activestorage (7.0.8.4) - actionpack (= 7.0.8.4) - activejob (= 7.0.8.4) - activerecord (= 7.0.8.4) - activesupport (= 7.0.8.4) + activemodel (7.1.5.2) + activesupport (= 7.1.5.2) + activerecord (7.1.5.2) + activemodel (= 7.1.5.2) + activesupport (= 7.1.5.2) + timeout (>= 0.4.0) + activestorage (7.1.5.2) + actionpack (= 7.1.5.2) + activejob (= 7.1.5.2) + activerecord (= 7.1.5.2) + activesupport (= 7.1.5.2) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.8.4) + activesupport (7.1.5.2) + base64 + benchmark (>= 0.3) + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) + mutex_m + securerandom (>= 0.3) tzinfo (~> 2.0) - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) - ast (2.4.2) - base64 (0.2.0) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + ast (2.4.3) + base64 (0.3.0) bcrypt (3.1.20) + benchmark (0.4.1) better_errors (2.10.1) erubi (>= 1.0.0) rack (>= 0.9.0) rouge (>= 1.0.0) - bigdecimal (3.1.8) + bigdecimal (3.2.3) bindex (0.8.1) binding_of_caller (1.0.1) debug_inspector (>= 1.2.0) - bootsnap (1.18.3) + bootsnap (1.18.6) msgpack (~> 1.2) - brakeman (6.1.2) + brakeman (7.1.0) racc builder (3.3.0) - byebug (11.1.3) + byebug (12.0.0) capybara (3.40.0) addressable matrix @@ -102,75 +115,108 @@ GEM xpath (~> 3.2) coderay (1.1.3) colorize (1.1.0) - concurrent-ruby (1.3.4) - connection_pool (2.4.1) + concurrent-ruby (1.3.5) + connection_pool (2.5.4) crass (1.0.6) - cssbundling-rails (1.4.0) + cssbundling-rails (1.4.3) railties (>= 6.0.0) - dartsass-sprockets (3.1.0) + csv (3.3.5) + dartsass-sprockets (3.2.1) railties (>= 4.0.0) - sassc-embedded (~> 1.69) + sassc-embedded (~> 1.80.1) sprockets (> 3.0) sprockets-rails tilt - date (3.3.4) + date (3.4.1) debug_inspector (1.2.0) - devise (4.9.3) + devise (4.9.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - diff-lcs (1.5.1) - dotenv (3.1.0) - dotenv-rails (3.1.0) - dotenv (= 3.1.0) + diff-lcs (1.6.2) + dotenv (3.1.8) + dotenv-rails (3.1.8) + dotenv (= 3.1.8) railties (>= 6.1) - erubi (1.13.0) - factory_bot (6.4.6) - activesupport (>= 5.0.0) - factory_bot_rails (6.4.3) - factory_bot (~> 6.4) + drb (2.2.3) + erb (5.0.2) + erubi (1.13.1) + factory_bot (6.5.5) + activesupport (>= 6.1.0) + factory_bot_rails (6.4.4) + factory_bot (~> 6.5) railties (>= 5.0.0) faker (3.4.2) i18n (>= 1.8.11, < 2) - faraday (2.13.1) + faraday (2.13.4) faraday-net_http (>= 2.0, < 3.5) json logger faraday-net_http (3.4.1) net-http (>= 0.5.0) - ffi (1.16.3) + ffi (1.17.2-aarch64-linux-gnu) + ffi (1.17.2-aarch64-linux-musl) + ffi (1.17.2-arm-linux-gnu) + ffi (1.17.2-arm-linux-musl) + ffi (1.17.2-arm64-darwin) + ffi (1.17.2-x86_64-darwin) + ffi (1.17.2-x86_64-linux-gnu) + ffi (1.17.2-x86_64-linux-musl) geo_coord (0.2.0) - geocoder (1.8.2) + geocoder (1.8.5) + base64 (>= 0.1.0) + csv (>= 3.0.0) globalid (1.2.1) activesupport (>= 6.1) - google-protobuf (4.27.3-x86_64-darwin) + google-protobuf (4.32.1) + bigdecimal + rake (>= 13) + google-protobuf (4.32.1-aarch64-linux-gnu) + bigdecimal + rake (>= 13) + google-protobuf (4.32.1-aarch64-linux-musl) + bigdecimal + rake (>= 13) + google-protobuf (4.32.1-arm64-darwin) + bigdecimal + rake (>= 13) + google-protobuf (4.32.1-x86_64-darwin) + bigdecimal + rake (>= 13) + google-protobuf (4.32.1-x86_64-linux-gnu) bigdecimal rake (>= 13) - google-protobuf (4.27.3-x86_64-linux) + google-protobuf (4.32.1-x86_64-linux-musl) bigdecimal rake (>= 13) hotwire-rails (0.1.3) rails (>= 6.0.0) stimulus-rails turbo-rails - i18n (1.14.5) + i18n (1.14.7) concurrent-ruby (~> 1.0) - inline_svg (1.9.0) + inline_svg (1.10.0) activesupport (>= 3.0) nokogiri (>= 1.6) + io-console (0.8.1) + irb (1.15.2) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) jsbundling-rails (1.3.1) railties (>= 6.0.0) - json (2.7.2) - jwt (2.8.1) + json (2.13.2) + jwt (3.1.2) base64 - language_server-protocol (3.17.0.3) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) logger (1.7.0) - loofah (2.22.0) + loofah (2.24.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -179,190 +225,233 @@ GEM net-pop net-smtp marcel (1.0.4) - matrix (0.4.2) - memory_profiler (1.0.1) + matrix (0.4.3) + memory_profiler (1.1.0) method_source (1.1.0) mini_mime (1.1.5) - minitest (5.25.1) - msgpack (1.7.2) + minitest (5.25.5) + msgpack (1.8.0) + mutex_m (0.3.0) net-http (0.6.0) uri - net-imap (0.4.10) + net-imap (0.5.10) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0.1) + net-smtp (0.5.1) net-protocol - nio4r (2.7.0) - nokogiri (1.16.7-x86_64-darwin) + nio4r (2.7.4) + nokogiri (1.18.9-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-aarch64-linux-musl) racc (~> 1.4) - nokogiri (1.16.7-x86_64-linux) + nokogiri (1.18.9-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-arm-linux-musl) + racc (~> 1.4) + nokogiri (1.18.9-arm64-darwin) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-linux-musl) racc (~> 1.4) orm_adapter (0.5.0) - pagy (7.0.10) - parallel (1.26.3) - parser (3.3.4.2) + pagy (7.0.11) + parallel (1.27.0) + parser (3.3.9.0) ast (~> 2.4.1) racc - pg (1.5.6) + pg (1.5.9) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + prism (1.5.1) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - pry-byebug (3.10.1) - byebug (~> 11.0) - pry (>= 0.13, < 0.15) - pry-rails (0.3.9) - pry (>= 0.10.4) + pry-byebug (3.11.0) + byebug (~> 12.0) + pry (>= 0.13, < 0.16) + pry-rails (0.3.11) + pry (>= 0.13.0) pry-remote (0.1.8) pry (~> 0.9) slop (~> 3.0) pry-stack_explorer (0.6.1) binding_of_caller (~> 1.0) pry (~> 0.13) - public_suffix (5.0.4) - puma (6.4.2) + psych (5.2.6) + date + stringio + public_suffix (6.0.2) + puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.9) - rack-cors (2.0.2) - rack (>= 2.0.0) + rack (3.2.1) + rack-cors (3.0.0) + logger + rack (>= 3.0.14) rack-mini-profiler (3.3.1) rack (>= 1.2.0) - rack-test (2.1.0) + rack-session (2.1.1) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.2.0) rack (>= 1.3) - rails (7.0.8.4) - actioncable (= 7.0.8.4) - actionmailbox (= 7.0.8.4) - actionmailer (= 7.0.8.4) - actionpack (= 7.0.8.4) - actiontext (= 7.0.8.4) - actionview (= 7.0.8.4) - activejob (= 7.0.8.4) - activemodel (= 7.0.8.4) - activerecord (= 7.0.8.4) - activestorage (= 7.0.8.4) - activesupport (= 7.0.8.4) + rackup (2.2.1) + rack (>= 3) + rails (7.1.5.2) + actioncable (= 7.1.5.2) + actionmailbox (= 7.1.5.2) + actionmailer (= 7.1.5.2) + actionpack (= 7.1.5.2) + actiontext (= 7.1.5.2) + actionview (= 7.1.5.2) + activejob (= 7.1.5.2) + activemodel (= 7.1.5.2) + activerecord (= 7.1.5.2) + activestorage (= 7.1.5.2) + activesupport (= 7.1.5.2) bundler (>= 1.15.0) - railties (= 7.0.8.4) - rails-dom-testing (2.2.0) + railties (= 7.1.5.2) + rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) + rails-html-sanitizer (1.6.2) loofah (~> 2.21) - nokogiri (~> 1.14) - railties (7.0.8.4) - actionpack (= 7.0.8.4) - activesupport (= 7.0.8.4) - method_source + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (7.1.5.2) + actionpack (= 7.1.5.2) + activesupport (= 7.1.5.2) + irb + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.2.1) + rake (13.3.0) rb-fsevent (0.11.2) - rb-inotify (0.10.1) + rb-inotify (0.11.1) ffi (~> 1.0) + rdoc (6.14.2) + erb + psych (>= 4.0.0) redis (5.1.0) redis-client (>= 0.17.0) - redis-client (0.21.0) + redis-client (0.25.3) connection_pool - regexp_parser (2.9.2) - requestjs-rails (0.0.11) - railties (>= 6.1.0) + regexp_parser (2.11.2) + reline (0.6.2) + io-console (~> 0.5) + requestjs-rails (0.0.13) + railties (>= 7.1.0) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.3.5) - strscan - rouge (4.2.0) - rspec-core (3.13.0) + rouge (4.6.0) + rspec-core (3.13.5) rspec-support (~> 3.13.0) - rspec-expectations (3.13.0) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.0) + rspec-mocks (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (6.1.1) + rspec-rails (6.1.5) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) - rspec-core (~> 3.12) - rspec-expectations (~> 3.12) - rspec-mocks (~> 3.12) - rspec-support (~> 3.12) - rspec-support (3.13.1) - rubocop (1.65.1) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) + rspec-support (3.13.5) + rubocop (1.80.2) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.46.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.32.1) - parser (>= 3.3.1.0) - rubocop-capybara (2.20.0) - rubocop (~> 1.41) - rubocop-factory_bot (2.25.1) - rubocop (~> 1.41) - rubocop-packaging (0.5.2) - rubocop (>= 1.33, < 2.0) - rubocop-performance (1.21.1) - rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails (2.24.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.46.0) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-packaging (0.6.0) + lint_roller (~> 1.1.0) + rubocop (>= 1.72.1, < 2.0) + rubocop-performance (1.26.0) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) + rubocop-rails (2.33.3) activesupport (>= 4.2.0) + lint_roller (~> 1.1) rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rspec (2.27.1) - rubocop (~> 1.40) - rubocop-capybara (~> 2.17) - rubocop-factory_bot (~> 2.22) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) + rubocop-rspec (3.7.0) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) ruby-progressbar (1.13.0) - sass-embedded (1.77.8-x86_64-darwin) - google-protobuf (~> 4.26) - sass-embedded (1.77.8-x86_64-linux-gnu) - google-protobuf (~> 4.26) - sassc-embedded (1.77.8) - sass-embedded (~> 1.77) - shoulda-matchers (6.4.0) + sass-embedded (1.92.1-aarch64-linux-gnu) + google-protobuf (~> 4.31) + sass-embedded (1.92.1-aarch64-linux-musl) + google-protobuf (~> 4.31) + sass-embedded (1.92.1-arm-linux-gnueabihf) + google-protobuf (~> 4.31) + sass-embedded (1.92.1-arm-linux-musleabihf) + google-protobuf (~> 4.31) + sass-embedded (1.92.1-arm64-darwin) + google-protobuf (~> 4.31) + sass-embedded (1.92.1-x86_64-darwin) + google-protobuf (~> 4.31) + sass-embedded (1.92.1-x86_64-linux-gnu) + google-protobuf (~> 4.31) + sass-embedded (1.92.1-x86_64-linux-musl) + google-protobuf (~> 4.31) + sassc-embedded (1.80.5) + sass-embedded (~> 1.80) + securerandom (0.4.1) + shoulda-matchers (6.5.0) activesupport (>= 5.2.0) slop (3.6.0) - sprockets (4.2.1) + sprockets (4.2.2) concurrent-ruby (~> 1.0) + logger rack (>= 2.2.4, < 4) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) + sprockets-rails (3.5.2) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) - stackprof (0.2.26) - stimulus-rails (1.3.3) - railties (>= 6.0.0) - strscan (3.1.0) - thor (1.3.1) - tilt (2.3.0) - timeout (0.4.1) - turbo-rails (2.0.5) - actionpack (>= 6.0.0) - activejob (>= 6.0.0) + stackprof (0.2.27) + stimulus-rails (1.3.4) railties (>= 6.0.0) + stringio (3.1.7) + thor (1.4.0) + tilt (2.6.1) + timeout (0.4.3) + turbo-rails (2.0.16) + actionpack (>= 7.1.0) + railties (>= 7.1.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.1.0) uri (1.0.3) - view_component (3.11.0) - activesupport (>= 5.2.0, < 8.0) - concurrent-ruby (~> 1.0) - method_source (~> 1.0) + view_component (4.0.2) + activesupport (>= 7.1.0, < 8.1) + concurrent-ruby (~> 1) warden (1.2.9) rack (>= 2.0.9) web-console (4.2.1) @@ -370,18 +459,25 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - websocket-driver (0.7.6) + websocket-driver (0.8.0) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.17) + zeitwerk (2.7.3) PLATFORMS - x86_64-darwin-21 - x86_64-darwin-22 - x86_64-darwin-23 - x86_64-linux + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-gnueabihf + arm-linux-musl + arm-linux-musleabihf + arm64-darwin + x86_64-darwin + x86_64-linux-gnu + x86_64-linux-musl DEPENDENCIES bcrypt (~> 3.1.16) @@ -417,7 +513,7 @@ DEPENDENCIES puma (~> 6.4.2) rack-cors rack-mini-profiler (~> 3.3.1) - rails (~> 7.0.8) + rails (~> 7.1.0) redis (~> 5.1.0) requestjs-rails rspec-rails (~> 6.1.1) @@ -438,4 +534,4 @@ RUBY VERSION ruby 3.2.3p157 BUNDLED WITH - 2.5.6 + 2.6.9 diff --git a/app/assets/images/icons/error.svg b/app/assets/images/icons/error.svg new file mode 100644 index 00000000..b8f1acfa --- /dev/null +++ b/app/assets/images/icons/error.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/app/components/facilities/welcomes_icon_component.rb b/app/components/facilities/welcomes_icon_component.rb index 0776eb7b..dceec405 100644 --- a/app/components/facilities/welcomes_icon_component.rb +++ b/app/components/facilities/welcomes_icon_component.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class Facilities::WelcomesIconComponent < ViewComponent::Base + ERROR_ICON = "error.svg" ICONS = { female: "female.svg", male: "male.svg", @@ -25,20 +26,19 @@ def initialize(welcomes, variant: :full) def call return call_icon if variant == :icon - tag.span "Error: #{@welcomes}", class: "tag is-danger" - tag.div class: "svg-icon ml-1" do - inline_svg_tag(icon_location, size: "20px") + helpers.inline_svg_tag(icon_location, size: "20px") end end def call_icon tag.span class: "icon" do - inline_svg_tag(icon_location, size: "20px") + helpers.inline_svg_tag(icon_location, size: "20px") end end def icon_location - "icons/#{ICONS[@welcomes]}" + selected_icon = ICONS[@welcomes].presence || ERROR_ICON + "icons/#{selected_icon}" end end diff --git a/bin/docker/bash b/bin/docker/bash index 0593c5ab..98a6840f 100755 --- a/bin/docker/bash +++ b/bin/docker/bash @@ -1,4 +1,4 @@ #!/bin/bash set -e -docker-compose run --rm web bash +docker-compose -p linkvan-dev run --rm web bash diff --git a/bin/docker/bundle b/bin/docker/bundle index eef0d244..a82c846d 100755 --- a/bin/docker/bundle +++ b/bin/docker/bundle @@ -1,4 +1,4 @@ #!/bin/bash set -e -exec docker-compose --rm web bundle "$@" +exec docker-compose -p linkvan-dev run --rm web bundle "$@" diff --git a/bin/docker/dev_reset b/bin/docker/dev_reset index ebb462d1..f98ffb0f 100755 --- a/bin/docker/dev_reset +++ b/bin/docker/dev_reset @@ -9,7 +9,7 @@ def system!(*args) end def docked!(*args) - system!("docker-compose run -rm web", *args) + system!("docker-compose -p linkvan-dev run -rm web", *args) end FileUtils.chdir APP_ROOT do diff --git a/bin/docker/entrypoints/wait-for-postgres.sh b/bin/docker/entrypoints/wait-for-postgres.sh index 26a40145..69c41d11 100755 --- a/bin/docker/entrypoints/wait-for-postgres.sh +++ b/bin/docker/entrypoints/wait-for-postgres.sh @@ -1,10 +1,15 @@ #!/bin/bash set -e +# Set default values if environment variables are not set +POSTGRES_HOST=${POSTGRES_HOST:-postgres} +POSTGRES_PORT=${POSTGRES_PORT:-5432} + # Wait for Postgres to start before doing anything echo "" echo "== ⏱ Waiting for Postgres before running: $@ ==" -dockerize -wait tcp://postgres:35432 -timeout 60s -wait-retry-interval 5s +echo "== 🔌 Connecting to ${POSTGRES_HOST}:${POSTGRES_PORT} ==" +dockerize -wait tcp://${POSTGRES_HOST}:${POSTGRES_PORT} -timeout 60s -wait-retry-interval 5s # Then exec the container's main process (what's set as CMD in the Dockerfile). echo "" diff --git a/bin/docker/run b/bin/docker/run index 76bd8813..4c76fe80 100755 --- a/bin/docker/run +++ b/bin/docker/run @@ -2,4 +2,4 @@ # Little helper to run a command from the docker container set -e -exec docker-compose run --rm web "$@" +exec docker-compose -p linkvan-dev run --rm web "$@" diff --git a/bin/docker/setup b/bin/docker/setup index f04f7ae0..60607fd1 100755 --- a/bin/docker/setup +++ b/bin/docker/setup @@ -9,7 +9,7 @@ def system!(*args) end def docked!(*args) - command_line = ["docker-compose run --rm web"] + args + command_line = ["docker-compose -p linkvan-dev run --rm web"] + args system!(command_line.join(" ")) end @@ -19,10 +19,10 @@ FileUtils.chdir APP_ROOT do FileUtils.cp ".env.template", ".env" unless File.exist?(".env") puts "== Pulling Images ==" - system! "docker-compose pull" + system! "docker-compose -p linkvan-dev pull" puts "== Building Container ==" - system! "docker-compose build" + system! "docker-compose -p linkvan-dev build" puts "== Running: bin/setup #{ARGV.join(' ')} ==" docked!("./bin/setup", ARGV) diff --git a/bin/docker/start b/bin/docker/start index 746c7468..764854ac 100755 --- a/bin/docker/start +++ b/bin/docker/start @@ -2,4 +2,4 @@ set -e echo "== Turning on Docker ==" -docker-compose up +docker-compose -p linkvan-dev up diff --git a/bin/docker/test b/bin/docker/test index 760bcdd1..f61e6de7 100755 --- a/bin/docker/test +++ b/bin/docker/test @@ -1,4 +1,11 @@ #!/bin/bash set -e -docker-compose -f docker-compose.ci.yml run --rm test +# Pass all arguments to the rspec command inside docker +if [ $# -eq 0 ]; then + # No arguments provided, run all tests + docker-compose -f docker-compose.ci.yml -p linkvan-test run --rm test +else + # Arguments provided, pass them to rspec + docker-compose -f docker-compose.ci.yml -p linkvan-test run --rm test bash -c "./bin/setup && ./bin/rake assets:precompile && ./bin/bundle exec rspec $*" +fi diff --git a/bin/docker/yarn b/bin/docker/yarn index 8ae101d2..dbc9b1c0 100755 --- a/bin/docker/yarn +++ b/bin/docker/yarn @@ -1,4 +1,4 @@ #!/bin/bash set -e -exec docker-compose --rm web yarn "$@" +exec docker-compose -p linkvan-dev run --rm web yarn "$@" diff --git a/bin/setup b/bin/setup index 32257efc..ba48a686 100755 --- a/bin/setup +++ b/bin/setup @@ -10,7 +10,7 @@ restart = ARGV.include?('restart') APP_ROOT = File.expand_path("..", __dir__) def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") + system(*args, exception: true) end FileUtils.chdir APP_ROOT do @@ -33,8 +33,8 @@ FileUtils.chdir APP_ROOT do system! "bin/rails db:reset" else # Creates db, loads schema, initializes seed data. - puts "\n== Preparing database ==" - system! "bin/rails db:prepare" + puts "\n== Preparing database ==" + system! "bin/rails db:prepare" end if load_fake_data @@ -46,7 +46,7 @@ FileUtils.chdir APP_ROOT do system! "bin/rails log:clear tmp:clear" if restart - puts "\n== Restarting application server ==" - system! "bin/rails restart" + puts "\n== Restarting application server ==" + system! "bin/rails restart" end end diff --git a/config/application.rb b/config/application.rb index df498ec4..e7b3d541 100644 --- a/config/application.rb +++ b/config/application.rb @@ -9,7 +9,22 @@ module LinkvanApi class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 7.0 + config.load_defaults 7.1 + + # cache entry format version + config.active_support.cache_format_version = 7.1 + + # No longer add autoloaded paths into `$LOAD_PATH`. This means that you won't be able + # to manually require files that are managed by the autoloader, which you shouldn't do anyway. + # + # This will reduce the size of the load path, making `require` faster if you don't use bootsnap, or reduce the size + # of the bootsnap cache if you use it. + config.add_autoload_paths_to_load_path = false + + # Please, add to the `ignore` list any other `lib` subdirectories that do + # not contain `.rb` files, or that should not be reloaded or eager loaded. + # Common ones are `templates`, `generators`, or `middleware`, for example. + config.autoload_lib(ignore: %w(assets tasks)) # Configuration for the application, engines, and railties goes here. # diff --git a/config/environments/development.rb b/config/environments/development.rb index 8500f459..2e7fb486 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -6,7 +6,7 @@ # In the development environment your application's code is reloaded any time # it changes. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. - config.cache_classes = false + config.enable_reloading = true # Do not eager load code on boot. config.eager_load = false @@ -56,6 +56,9 @@ # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true + # Highlight code that enqueued background job in logs. + config.active_job.verbose_enqueue_logs = true + # Suppress logger output for asset requests. config.assets.quiet = true @@ -67,4 +70,7 @@ # Uncomment if you wish to allow Action Cable access from any origin. # config.action_cable.disable_request_forgery_protection = true + + # Raise error when a before_action's only/except options reference missing actions + config.action_controller.raise_on_missing_callback_actions = true end diff --git a/config/environments/production.rb b/config/environments/production.rb index 3c6aee50..ae16020c 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -4,7 +4,7 @@ # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. - config.cache_classes = true + config.enable_reloading = false # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers @@ -16,8 +16,8 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] - # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment + # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files). # config.require_master_key = true # Disable serving static files from the `/public` folder by default since @@ -27,7 +27,7 @@ # Compress CSS using a preprocessor. # config.assets.css_compressor = :sass - # Do not fallback to assets pipeline if a precompiled asset is missed. + # Do not fall back to assets pipeline if a precompiled asset is missed. config.assets.compile = false # Enable serving of images, stylesheets, and JavaScripts from an asset server. @@ -45,16 +45,26 @@ # config.action_cable.url = "wss://example.com/cable" # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] + # Assume all access to the app is happening through a SSL-terminating reverse proxy. + # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies. + # config.assume_ssl = true + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true + config.force_ssl = true - # Include generic and useful information about system operation, but avoid logging too much - # information to avoid inadvertent exposure of personally identifiable information (PII). - config.log_level = :info + # Log to STDOUT by default + config.logger = ActiveSupport::Logger.new(STDOUT) + .tap { |logger| logger.formatter = ::Logger::Formatter.new } + .then { |logger| ActiveSupport::TaggedLogging.new(logger) } # Prepend all log lines with the following tags. config.log_tags = [ :request_id ] + # "info" includes generic and useful information about system operation, but avoids logging too much + # information to avoid inadvertent exposure of personally identifiable information (PII). If you + # want to log everything, set the level to "debug". + config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") + # Use a different cache store in production. # config.cache_store = :mem_cache_store @@ -75,19 +85,14 @@ # Don't log any deprecations. config.active_support.report_deprecations = false - # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new - - # Use a different logger for distributed setups. - # require "syslog/logger" - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") - - if ENV["RAILS_LOG_TO_STDOUT"].present? - logger = ActiveSupport::Logger.new(STDOUT) - logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) - end - # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + + # Enable DNS rebinding protection and other `Host` header attacks. + # config.hosts = [ + # "example.com", # Allow requests from example.com + # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com` + # ] + # Skip DNS rebinding protection for the default health check endpoint. + # config.host_authorization = { exclude: ->(request) { request.path == "/up" } } end diff --git a/config/environments/test.rb b/config/environments/test.rb index 6ea4d1e7..3e5ae7da 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -8,12 +8,13 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # Turn false under Spring and add config.action_view.cache_template_loading = true. - config.cache_classes = true + # While tests run files are not watched, reloading is not necessary. + config.enable_reloading = false - # Eager loading loads your whole application. When running a single test locally, - # this probably isn't necessary. It's a good idea to do in a continuous integration - # system, or in some way before deploying your code. + # Eager loading loads your entire application. When running a single test locally, + # this is usually not necessary, and can slow down your test suite. However, it's + # recommended that you enable it in continuous integration systems to ensure eager + # loading is working properly before deploying your code. config.eager_load = ENV["CI"].present? # Configure public file server for tests with Cache-Control for performance. @@ -27,8 +28,8 @@ config.action_controller.perform_caching = false config.cache_store = :null_store - # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false + # Render exception templates for rescuable exceptions and raise for other exceptions. + config.action_dispatch.show_exceptions = :rescuable # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false @@ -57,4 +58,7 @@ # Annotate rendered view with file names. # config.action_view.annotate_rendered_view_with_filenames = true + + # Raise error when a before_action's only/except options reference missing actions + config.action_controller.raise_on_missing_callback_actions = true end diff --git a/config/initializers/action_text.rb b/config/initializers/action_text.rb index 7f7ec239..0c74dfb0 100644 --- a/config/initializers/action_text.rb +++ b/config/initializers/action_text.rb @@ -1,4 +1,4 @@ Rails.application.config.after_initialize do # Sets ActionText to accept custom styling. - ActionText::ContentHelper.allowed_attributes.add 'style' + # ActionText::ContentHelper.allowed_attributes.add 'style' end diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 3621f97f..b3076b38 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,8 +1,8 @@ # Be sure to restart your server when you modify this file. -# Define an application-wide content security policy -# For further information see the following documentation -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy +# Define an application-wide content security policy. +# See the Securing Rails Applications Guide for more information: +# https://guides.rubyonrails.org/security.html#content-security-policy-header # Rails.application.configure do # config.content_security_policy do |policy| @@ -16,11 +16,10 @@ # # policy.report_uri "/csp-violation-report-endpoint" # end # -# # Generate session nonces for permitted importmap and inline scripts +# # Generate session nonces for permitted importmap, inline scripts, and inline styles. # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } -# config.content_security_policy_nonce_directives = %w(script-src) +# config.content_security_policy_nonce_directives = %w(script-src style-src) # -# # Report CSP violations to a specified URI. See: -# # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only +# # Report violations without enforcing the policy. # # config.content_security_policy_report_only = true # end diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index 5e4c830d..3fe955a2 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,7 +1,7 @@ # Be sure to restart your server when you modify this file. # Avoid CORS issues when API is called from the frontend app. -# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests. +# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin Ajax requests. # Read more: https://github.com/cyu/rack-cors diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index adc6568c..c2d89e28 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,8 +1,8 @@ # Be sure to restart your server when you modify this file. -# Configure parameters to be filtered from the log file. Use this to limit dissemination of -# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported -# notations and behaviors. +# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. +# Use this to limit dissemination of sensitive information. +# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. Rails.application.config.filter_parameters += [ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn ] diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb index 00f64d71..7db3b957 100644 --- a/config/initializers/permissions_policy.rb +++ b/config/initializers/permissions_policy.rb @@ -1,11 +1,13 @@ +# Be sure to restart your server when you modify this file. + # Define an application-wide HTTP permissions policy. For further -# information see https://developers.google.com/web/updates/2018/06/feature-policy -# -# Rails.application.config.permissions_policy do |f| -# f.camera :none -# f.gyroscope :none -# f.microphone :none -# f.usb :none -# f.fullscreen :self -# f.payment :self, "https://secure.example.com" +# information see: https://developers.google.com/web/updates/2018/06/feature-policy + +# Rails.application.config.permissions_policy do |policy| +# policy.camera :none +# policy.gyroscope :none +# policy.microphone :none +# policy.usb :none +# policy.fullscreen :self +# policy.payment :self, "https://secure.example.com" # end diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index 544912af..9310dde4 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -5,7 +5,6 @@ # # docker-compose -f docker-compose.ci.yml build test # docker-compose -f docker-compose.ci.yml run --rm test -version: '3' x-ci-app: &ci-app build: @@ -17,6 +16,8 @@ x-ci-app: &ci-app RAILS_ENV: test RACK_ENV: test BUNDLE_PATH: /usr/src/app/vendor/bundle + POSTGRES_HOST: postgres + POSTGRES_PORT: 5432 entrypoint: ./bin/docker/entrypoints/wait-for-postgres.sh volumes: - .:/usr/src/app:cached diff --git a/docker-compose.yml b/docker-compose.yml index d1c48363..0c948d80 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,6 @@ # docker-compose build # docker-compose run --rm web bin/setup # docker-compose up -version: "3" x-app: &app build: @@ -21,6 +20,8 @@ x-app: &app # REDIS_URL: redis://@redis:6379/1 DATABASE_URL: postgres://postgres:postgres@postgres:35432/ GOOGLE_MAPS_API_TOKEN: ${GOOGLE_MAPS_API_TOKEN-} + POSTGRES_HOST: postgres + POSTGRES_PORT: 35432 entrypoint: ./bin/docker/entrypoints/wait-for-web.sh volumes: - .:/usr/src/app:cached @@ -33,7 +34,7 @@ x-app: &app - letter_opener:/usr/src/app/tmp/letter_opener:delegated depends_on: - postgres - # - redis +# - redis services: postgres: @@ -75,17 +76,17 @@ services: - "127.0.0.1:3000:3000" restart: on-failure - # worker: - # <<: *app - # command: bundle exec sidekiq -C config/sidekiq.yml +# worker: +# <<: *app +# command: bundle exec sidekiq -C config/sidekiq.yml - # webpacker: - # <<: *app - # command: yarn --build - # environment: - # WEBPACKER_DEV_SERVER_HOST: 0.0.0.0 - # ports: - # - "127.0.0.1:3035:3035" +# webpacker: +# <<: *app +# command: yarn --build +# environment: +# WEBPACKER_DEV_SERVER_HOST: 0.0.0.0 +# ports: +# - "127.0.0.1:3035:3035" volumes: postgresql: diff --git a/spec/components/facilities/welcomes_icon_component_spec.rb b/spec/components/facilities/welcomes_icon_component_spec.rb new file mode 100644 index 00000000..d3649702 --- /dev/null +++ b/spec/components/facilities/welcomes_icon_component_spec.rb @@ -0,0 +1,193 @@ +require "rails_helper" + +RSpec.describe Facilities::WelcomesIconComponent, type: :component do + subject(:component) { described_class.new(welcomes, variant: variant) } + + let(:variant) { :full } + + describe "with valid welcome types" do + described_class::ICONS.each do |welcome_type, expected_icon| + context "when welcomes is '#{welcome_type}'" do + let(:welcomes) { welcome_type } + + it "renders without error" do + expect { render_inline(component) }.not_to raise_exception + end + + context "with full variant" do + let(:variant) { :full } + + before do + render_inline(component) + end + + it "renders a div with svg-icon class" do + expect(rendered_content).to have_css("div.svg-icon.ml-1") + end + + it "renders the correct icon" do + expect(rendered_content).to have_css("svg") + end + end + + context "with icon variant" do + let(:variant) { :icon } + + before do + render_inline(component) + end + + it "renders a span with icon class" do + expect(rendered_content).to have_css("span.icon") + end + + it "renders the correct icon" do + expect(rendered_content).to have_css("svg") + end + + it "does not show error message for icon variant" do + expect(rendered_content).not_to have_css("span.tag.is-danger") + end + end + + describe "#icon_location" do + it "returns the correct icon path" do + expect(component.icon_location).to eq("icons/#{expected_icon}") + end + end + end + end + end + + describe "with string welcome types" do + context "when welcomes is a string that matches a valid type" do + let(:welcomes) { "female" } + + it "renders without error" do + expect { render_inline(component) }.not_to raise_exception + end + + it "converts string to symbol correctly" do + expect(component.icon_location).to eq("icons/female.svg") + end + end + + context "when welcomes is a camelCase string" do + let(:welcomes) { "maleTransgender" } + + it "converts camelCase to underscore" do + # The component should convert "maleTransgender" to "male_transgender" + expect(component.instance_variable_get(:@welcomes)).to eq(:male_transgender) + end + end + end + + describe "with invalid welcome types" do + context "when welcomes is not in the ICONS hash" do + let(:welcomes) { "invalid_type" } + + before do + render_inline(component) + end + + it "still attempts to render the icon div for full variant" do + expect(rendered_content).to have_css("div.svg-icon.ml-1") + end + end + + context "when welcomes is nil" do + let(:welcomes) { nil } + + before do + render_inline(component) + end + + it "handles nil gracefully" do + expect(rendered_content).to have_css("div.svg-icon.ml-1") + end + end + end + + describe "variant parameter" do + let(:welcomes) { :female } + + context "when variant is :full (default)" do + let(:variant) { :full } + + before do + render_inline(component) + end + + it "renders the full variant structure" do + expect(rendered_content).to have_css("div.svg-icon.ml-1") + end + end + + context "when variant is :icon" do + let(:variant) { :icon } + + before do + render_inline(component) + end + + it "renders only the icon variant structure" do + expect(rendered_content).to have_css("span.icon") + expect(rendered_content).not_to have_css("div.svg-icon") + end + end + + context "when variant is not specified" do + subject(:component) { described_class.new(welcomes) } + + let(:welcomes) { :female } + + before do + render_inline(component) + end + + it "defaults to full variant" do + expect(rendered_content).to have_css("div.svg-icon.ml-1") + end + end + end + + describe "logging" do + let(:welcomes) { :female } + + it "logs debug information during initialization" do + expect(Rails.logger).to receive(:debug) + described_class.new(welcomes) + end + end + + describe "all defined icon types" do + it "has icons defined for all expected welcome types" do + expected_types = %i[female male transgender children youth adult senior] + expect(described_class::ICONS.keys).to match_array(expected_types) + end + + it "has valid file extensions for all icons" do + described_class::ICONS.values.each do |icon_file| + expect(icon_file).to end_with(".svg") + end + end + end + + describe "icon_location method" do + context "when welcome type exists in ICONS" do + let(:welcomes) { :female } + + it "returns the correct path" do + expect(component.icon_location).to eq("icons/female.svg") + end + end + + context "when welcome type does not exist in ICONS" do + let(:welcomes) { :nonexistent } + + it "returns path with nil filename" do + expect(component.icon_location).to eq("icons/error.svg") + end + end + end +end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 3fc83d03..8f2df391 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -55,7 +55,7 @@ config.include ActiveSupport::Testing::TimeHelpers # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" + config.fixture_paths = ["#{Rails.root.join('spec', 'fixtures', 'fixtures')}"] # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false