From d85f847c3d78986b5002bbdfbd633d8ab4a07b15 Mon Sep 17 00:00:00 2001 From: Jon Roberts Date: Tue, 12 Nov 2024 15:42:09 -0500 Subject: [PATCH 1/2] remove some warning ran rspec with --warnings flag and fixed most of them in our code --- app/services/followup_service.rb | 4 +--- app/views/case_contacts/form/details.html.erb | 1 - spec/services/placement_export_csv_service_spec.rb | 2 +- spec/support/capybara.rb | 9 +-------- spec/support/pretender_context.rb | 4 ++++ spec/views/layouts/header.html.erb_spec.rb | 5 ----- spec/views/layouts/sidebar.html.erb_spec.rb | 5 ----- 7 files changed, 7 insertions(+), 23 deletions(-) create mode 100644 spec/support/pretender_context.rb diff --git a/app/services/followup_service.rb b/app/services/followup_service.rb index ddce20a01c..50dc805e5e 100644 --- a/app/services/followup_service.rb +++ b/app/services/followup_service.rb @@ -16,9 +16,7 @@ def self.create_followup(case_contact, creator, note) followup end - private_class_method - - def self.send_notification(followup, creator) + private_class_method def self.send_notification(followup, creator) FollowupNotifier .with(followup: followup, created_by: creator) .deliver(followup.case_contact.creator) diff --git a/app/views/case_contacts/form/details.html.erb b/app/views/case_contacts/form/details.html.erb index 6c96adb9e0..525ee662a3 100644 --- a/app/views/case_contacts/form/details.html.erb +++ b/app/views/case_contacts/form/details.html.erb @@ -54,7 +54,6 @@ <% min_date = CaseContact::MINIMUM_DATE %> <% current_date = Time.zone.today %> - <% initial_value = @case_contact.occurred_at&.to_date %> <%= form.date_field(:occurred_at, required: true, max: (current_date + 1.day).to_fs(:iso8601), diff --git a/spec/services/placement_export_csv_service_spec.rb b/spec/services/placement_export_csv_service_spec.rb index dd2d986820..ab84e37c7f 100644 --- a/spec/services/placement_export_csv_service_spec.rb +++ b/spec/services/placement_export_csv_service_spec.rb @@ -6,7 +6,7 @@ casa_org = create(:casa_org, name: "Fake Name", display_name: "Fake Display Name") placement_type = create(:placement_type, casa_org: casa_org) creator = create(:user) - placement = create(:placement, creator: creator, placement_type: placement_type) # rubocop:disable Lint/UselessAssignment + create(:placement, creator: creator, placement_type: placement_type) csv_headers = "Casa Org,Casa Case Number,Placement Type,Placement Started At,Created At,Creator Name\n" result = PlacementExportCsvService.new(casa_org: casa_org).perform diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 4ed308b033..4fd304e527 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -15,14 +15,7 @@ Capybara.disable_animation = true Capybara::Screenshot.autosave_on_failure = true - -module Capybara - module Screenshot - def self.capybara_tmp_path - Rails.root.join("tmp", "screenshots#{ENV["GROUPS_UNDERSCORE"]}") - end - end -end +Capybara.save_path = Rails.root.join("tmp", "screenshots#{ENV["GROUPS_UNDERSCORE"]}") options = Selenium::WebDriver::Chrome::Options.new options.add_argument("--disable-gpu") diff --git a/spec/support/pretender_context.rb b/spec/support/pretender_context.rb new file mode 100644 index 0000000000..67b2077720 --- /dev/null +++ b/spec/support/pretender_context.rb @@ -0,0 +1,4 @@ +module PretenderContext + def true_user + end +end diff --git a/spec/views/layouts/header.html.erb_spec.rb b/spec/views/layouts/header.html.erb_spec.rb index d30dd4ebf1..a14821ca87 100644 --- a/spec/views/layouts/header.html.erb_spec.rb +++ b/spec/views/layouts/header.html.erb_spec.rb @@ -1,10 +1,5 @@ require "rails_helper" -module PretenderContext - def true_user - end -end - RSpec.describe "layout/header", type: :view do before do view.class.include PretenderContext diff --git a/spec/views/layouts/sidebar.html.erb_spec.rb b/spec/views/layouts/sidebar.html.erb_spec.rb index c320c7881c..0abdcac489 100644 --- a/spec/views/layouts/sidebar.html.erb_spec.rb +++ b/spec/views/layouts/sidebar.html.erb_spec.rb @@ -1,10 +1,5 @@ require "rails_helper" -module PretenderContext - def true_user - end -end - RSpec.describe "layout/sidebar", type: :view do before do view.class.include PretenderContext From 744c66a8c51e58f703dadcfbad67b96964f225d0 Mon Sep 17 00:00:00 2001 From: Jon Roberts Date: Tue, 12 Nov 2024 15:50:26 -0500 Subject: [PATCH 2/2] update to ruby 3.3.6 --- .devcontainer/post-create.sh | 4 ++-- .ruby-version | 2 +- .tool-versions | 2 +- Dockerfile | 4 ++-- Gemfile | 2 +- Gemfile.lock | 2 +- README.md | 2 +- doc/LINUX_SETUP.md | 8 ++++---- doc/MAC_SETUP.md | 8 ++++---- doc/WSL_SETUP.md | 8 ++++---- flake.nix | 2 +- gemset.nix | 2 +- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 3a31fc008a..8562cd08ce 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -3,9 +3,9 @@ RUBY_VERSION="$(cat .ruby-version | tr -d '\n')" # copy the file only if it doesn't already exist cp -n .devcontainer/.env.codespaces .env -# If the project's required ruby version changes from 3.2.4, this command +# If the project's required ruby version changes from 3.3.6, this command # will download and compile the correct version, but it will take a long time. -if [ "$RUBY_VERSION" != "3.2.4" ]; then +if [ "$RUBY_VERSION" != "3.3.6" ]; then rvm install $RUBY_VERSION rvm use $RUBY_VERSION echo "Ruby $RUBY_VERSION installed" diff --git a/.ruby-version b/.ruby-version index 351227fca3..9c25013dbb 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.4 +3.3.6 diff --git a/.tool-versions b/.tool-versions index a8eca4ee53..d0262ceac5 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ -ruby 3.2.4 +ruby 3.3.6 yarn 1.22.22 nodejs 22.11.0 diff --git a/Dockerfile b/Dockerfile index 690d185b18..c787c74a60 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.2.4-alpine AS builder +FROM ruby:3.3.6-alpine AS builder RUN apk update && apk upgrade && apk add --update --no-cache \ build-base \ @@ -14,7 +14,7 @@ RUN bundle install ### BUILD STEP DONE ### -FROM ruby:3.2.4-alpine +FROM ruby:3.3.6-alpine ARG RAILS_ROOT=/usr/src/app/ diff --git a/Gemfile b/Gemfile index d9a4d09e96..d81c677f1a 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -ruby "3.2.4" +ruby "3.3.6" gem "rails", "~> 7.2" gem "after_party" # post-deployment tasks diff --git a/Gemfile.lock b/Gemfile.lock index c18cc4693b..1b5e3c6adc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -669,7 +669,7 @@ DEPENDENCIES wicked RUBY VERSION - ruby 3.2.4p170 + ruby 3.3.6p108 BUNDLED WITH 2.5.23 diff --git a/README.md b/README.md index deda4be55b..703d23e8e7 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ The complete [role description of a CASA volunteer](https://pgcasa.org/volunteer **Ruby** 1. Install a ruby version manager: [rvm](https://rvm.io/) or [rbenv](https://github.com/rbenv/rbenv) -1. when you cd into the project directory, let your version manager install the ruby version in `.ruby-version`. Right now that's Ruby 3.2.4 +1. when you cd into the project directory, let your version manager install the ruby version in `.ruby-version`. Right now that's Ruby 3.3.6 1. `gem install bundler` **node.js** diff --git a/doc/LINUX_SETUP.md b/doc/LINUX_SETUP.md index 3255077363..1dfe513061 100644 --- a/doc/LINUX_SETUP.md +++ b/doc/LINUX_SETUP.md @@ -87,7 +87,7 @@ rbenv init mkdir -p "$(rbenv root)"/plugins git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build -rbenv install 3.2.4 +rbenv install 3.3.6 ``` If you would like RVM instead of rbenv @@ -98,9 +98,9 @@ gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703 \curl -sSL https://get.rvm.io | bash . ./.bashrc rvm get head -rvm install 3.2.4 -rvm alias create ruby 3.2.4 -rvm alias create default ruby-3.2.4 +rvm install 3.3.6 +rvm alias create ruby 3.3.6 +rvm alias create default ruby-3.3.6 ``` ```# Download the Chrome browser (for RSpec testing): diff --git a/doc/MAC_SETUP.md b/doc/MAC_SETUP.md index 5a11b11cb7..b21778e1ed 100644 --- a/doc/MAC_SETUP.md +++ b/doc/MAC_SETUP.md @@ -53,17 +53,17 @@ Next, install the version of Ruby that this project uses. This can be found by c To install the appropriate ruby version, run: ```bash -rbenv install 3.2.4 +rbenv install 3.3.6 ``` -(Do not forget to switch 3.2.4 to the appropriate version) +(Do not forget to switch 3.3.6 to the appropriate version) Finally, run: ```bash -rbenv local 3.2.4 +rbenv local 3.3.6 ``` -(Do not forget to swtich 3.2.4 to the appropriate version) +(Do not forget to swtich 3.3.6 to the appropriate version) ## Nodejs diff --git a/doc/WSL_SETUP.md b/doc/WSL_SETUP.md index 2732d35e85..902eda651e 100644 --- a/doc/WSL_SETUP.md +++ b/doc/WSL_SETUP.md @@ -28,7 +28,7 @@ You will need the following local tools installed: Install a ruby version manager like [rbenv](https://github.com/rbenv/rbenv#installation) - **Be sure to install the ruby version in `.ruby-version`. Right now that's Ruby 3.2.4.** + **Be sure to install the ruby version in `.ruby-version`. Right now that's Ruby 3.3.6.** Instructions for rbenv: @@ -48,13 +48,13 @@ Instructions for rbenv: 5. **[Install Ruby](https://github.com/rbenv/rbenv#installing-ruby-versions)** - **Be sure to install the ruby version in `.ruby-version`. Right now that's Ruby 3.2.4.** + **Be sure to install the ruby version in `.ruby-version`. Right now that's Ruby 3.3.6.** - `rbenv install 3.2.4` + `rbenv install 3.3.6` 6. **Set a Ruby version to finish installation and start** - `rbenv global 3.2.4` OR `rbenv local 3.2.4` + `rbenv global 3.3.6` OR `rbenv local 3.3.6` #### Troubleshooting If you are on Ubuntu in Windows Subsystem for Linux (WSL) and `rbenv install` indicates that the Ruby version is unavailable, you might be using Ubuntu's default install of `ruby-build`, which only comes with old installs of Ruby (ending before 2.6.) You should uninstall rvm and ruby-build's apt packages (`apt remove rvm ruby-build`) and install them with Git like this: diff --git a/flake.nix b/flake.nix index 4ec59da7ee..f8baae45b4 100644 --- a/flake.nix +++ b/flake.nix @@ -39,7 +39,7 @@ gemConfig = { }; # See available versions here: https://github.com/bobvanderlinden/nixpkgs-ruby/blob/master/ruby/versions.json - ruby = pkgs."ruby-3.2.4"; + ruby = pkgs."ruby-3.3.6"; bundixcli = bundix.packages.${system}.default; in rec { diff --git a/gemset.nix b/gemset.nix index 382793711a..e8a5f35d03 100644 --- a/gemset.nix +++ b/gemset.nix @@ -307,7 +307,7 @@ sha256 = "045wzckxpwcqzrjr353cxnyaxgf0qg22jh00dcx7z38cys5g1jlr"; type = "gem"; }; - version = "3.2.4"; + version = "3.3.6"; }; bullet = { dependencies = ["activesupport" "uniform_notifier"];