From 313569c3cc96bb3cacf4fd7c3d617b9f98b520df Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Mon, 27 Oct 2025 11:49:51 -0600 Subject: [PATCH 01/30] modernize RSpec use --- spec/controllers/attempts_controller_spec.rb | 2 +- .../auth_callbacks_controller_spec.rb | 2 +- .../collaborations_controller_spec.rb | 2 +- .../completed_trails_controller_spec.rb | 2 +- spec/controllers/downloads_controller_spec.rb | 2 +- .../exercise_trails_controller_spec.rb | 2 +- .../forum_sessions_controller_spec.rb | 2 +- .../invitations_controller_spec.rb | 2 +- spec/controllers/marketing_controller_spec.rb | 2 +- .../memberships_controller_spec.rb | 2 +- .../repositories_controller_spec.rb | 2 +- spec/controllers/shows_controller_spec.rb | 2 +- spec/controllers/teams_controller_spec.rb | 2 +- .../twitter_player_cards_controller_spec.rb | 2 +- .../unsubscribes_controller_spec.rb | 2 +- spec/controllers/videos_controller_spec.rb | 2 +- spec/features/admin_creates_deck_spec.rb | 2 +- .../features/clearance/user_signs_out_spec.rb | 2 +- .../clearance/visitor_resets_password_spec.rb | 2 +- .../clearance/visitor_signs_in_spec.rb | 2 +- .../visitor_updates_password_spec.rb | 2 +- .../design_for_developers_resources_spec.rb | 2 +- .../non_subscriber_accesses_content_spec.rb | 2 +- spec/features/pages_spec.rb | 2 +- .../features/subscriber_follows_trail_spec.rb | 2 +- .../subscriber_searches_for_content_spec.rb | 2 +- .../subscriber_uses_flashcards_spec.rb | 2 +- .../subscriber_views_completed_trails_spec.rb | 2 +- .../subscriber_views_practice_trails_spec.rb | 2 +- spec/features/subscriber_views_topic_spec.rb | 2 +- .../subscriber_views_trail_details_spec.rb | 2 +- spec/features/subscriber_views_video_spec.rb | 2 +- .../subscriber_views_weekly_iteration_spec.rb | 2 +- .../test_driven_rails_resources_spec.rb | 2 +- .../user_accepts_team_invitation_spec.rb | 2 +- .../user_manages_team_subscription_spec.rb | 2 +- .../user_removes_pending_invitation_spec.rb | 2 +- .../features/user_removes_team_member_spec.rb | 2 +- .../user_sees_trail_map_progress_spec.rb | 2 +- spec/features/user_signs_out_spec.rb | 2 +- spec/features/user_views_account_spec.rb | 2 +- spec/features/user_views_landing_page_spec.rb | 2 +- .../user_views_team_invitations_spec.rb | 2 +- spec/features/videos_spec.rb | 2 +- .../visitor_views_weekly_iteration_spec.rb | 2 +- spec/helpers/application_helper_spec.rb | 2 +- spec/helpers/html_helper_spec.rb | 2 +- spec/helpers/open_graph_helper_spec.rb | 2 +- spec/helpers/products_helper_spec.rb | 2 +- spec/helpers/searches_helper_spec.rb | 2 +- spec/helpers/trails_helper_spec.rb | 2 +- spec/helpers/videos_helper_spec.rb | 2 +- spec/jobs/weekly_iteration_mailer_job_spec.rb | 2 +- spec/lib/slug_constraint_spec.rb | 2 +- spec/lib/watchable_rails_admin_field_spec.rb | 2 +- spec/mailers/invitation_mailer_spec.rb | 2 +- .../weekly_iteration_drip_mailer_spec.rb | 2 +- spec/models/attempt_spec.rb | 2 +- spec/models/catalog_spec.rb | 2 +- spec/models/classification_spec.rb | 2 +- spec/models/clip_spec.rb | 2 +- .../models/completeable_with_progress_spec.rb | 2 +- spec/models/content_recommendation_spec.rb | 2 +- spec/models/deck_spec.rb | 2 +- spec/models/exercise_spec.rb | 2 +- spec/models/flashcard_spec.rb | 2 +- .../flashcards_needing_review_query_spec.rb | 2 +- spec/models/forum_spec.rb | 2 +- spec/models/guest_spec.rb | 2 +- spec/models/invitation_spec.rb | 2 +- spec/models/marker_spec.rb | 2 +- spec/models/null_attempt_spec.rb | 2 +- spec/models/product_spec.rb | 2 +- spec/models/recommendable_content_spec.rb | 2 +- spec/models/repository_spec.rb | 2 +- spec/models/return_path_finder_spec.rb | 2 +- spec/models/search_result_spec.rb | 2 +- spec/models/search_spec.rb | 2 +- spec/models/show_spec.rb | 2 +- spec/models/status_finder_spec.rb | 2 +- spec/models/status_spec.rb | 2 +- spec/models/step_spec.rb | 2 +- spec/models/teacher_spec.rb | 2 +- spec/models/team_spec.rb | 2 +- spec/models/topic_spec.rb | 2 +- spec/models/trail_spec.rb | 2 +- spec/models/trail_with_progress_query_spec.rb | 2 +- spec/models/trail_with_progress_spec.rb | 2 +- .../trails_for_practice_page_query_spec.rb | 2 +- spec/models/unstarted_spec.rb | 2 +- spec/models/user_spec.rb | 2 +- spec/models/video_listing_spec.rb | 2 +- spec/models/video_spec.rb | 2 +- spec/models/video_thumbnail_spec.rb | 2 +- spec/models/video_with_status_spec.rb | 2 +- spec/rails_helper.rb | 1 + .../design_for_developers_resource_spec.rb | 2 +- spec/requests/sign_up_redirect_spec.rb | 2 +- spec/requests/sitemap_spec.rb | 2 +- spec/requests/video_status_spec.rb | 2 +- spec/serializers/user_serializer_spec.rb | 2 +- spec/services/auth_hash_service_spec.rb | 2 +- .../completeable_with_progress_query_spec.rb | 2 +- spec/services/practice_spec.rb | 2 +- spec/services/status_updater_spec.rb | 2 +- spec/services/topic_with_trails_spec.rb | 2 +- spec/services/video_duration_updater_spec.rb | 2 +- .../weekly_iteration_recommender_spec.rb | 2 +- .../weekly_iteration_suggestions_spec.rb | 2 +- spec/spec_helper.rb | 20 +++++++++++++++++-- spec/support/airbrake.rb | 2 +- spec/support/must_be_team_owner.rb | 2 +- spec/support/product_shared_examples.rb | 2 +- spec/support/stub_view_method.rb | 5 ++--- spec/views/flashcards/show.html.erb_spec.rb | 2 +- spec/views/layouts/_footer.html.erb_spec.rb | 2 +- ..._header_application_links.html.erb_spec.rb | 2 +- spec/views/practice/show.html.erb_spec.rb | 2 +- spec/views/products/_forum.html.erb_spec.rb | 2 +- .../products/shows/_show.html.erb_spec.rb | 2 +- .../views/results/_flashcard.html.erb_spec.rb | 2 +- spec/views/shared/_flashes.html.erb_spec.rb | 2 +- spec/views/teams/_team.html.erb_spec.rb | 2 +- spec/views/topics/_trail.html.erb_spec.rb | 2 +- spec/views/topics/show.html.erb_spec.rb | 2 +- .../_completeable_preview.html.erb_spec.rb | 2 +- .../trails/_incomplete_trail.html.erb_spec.rb | 2 +- .../trails/_progress_dot.html.erb_spec.rb | 2 +- .../trails/_repositories.html.erb_spec.rb | 2 +- spec/views/trails/show.html.erb_spec.rb | 2 +- .../_meta.html.erb_spec.rb | 2 +- .../show.html.erb_spec.rb | 2 +- .../videos/_access_callout.html.erb_spec.rb | 2 +- .../videos/_video_player.html.erb_spec.rb | 2 +- spec/views/videos/show.html.erb_spec.rb | 2 +- 135 files changed, 153 insertions(+), 137 deletions(-) diff --git a/spec/controllers/attempts_controller_spec.rb b/spec/controllers/attempts_controller_spec.rb index cbb2c4deb6..05da0515fe 100644 --- a/spec/controllers/attempts_controller_spec.rb +++ b/spec/controllers/attempts_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe AttemptsController do +RSpec.describe AttemptsController do include StubCurrentUserHelper describe "#create" do diff --git a/spec/controllers/auth_callbacks_controller_spec.rb b/spec/controllers/auth_callbacks_controller_spec.rb index afba243563..8a6814b7dd 100644 --- a/spec/controllers/auth_callbacks_controller_spec.rb +++ b/spec/controllers/auth_callbacks_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe AuthCallbacksController do +RSpec.describe AuthCallbacksController do context "#create" do it "redirects to the practice path without an auth origin" do request.env["omniauth.auth"] = OmniAuth.config.mock_auth[:github] diff --git a/spec/controllers/collaborations_controller_spec.rb b/spec/controllers/collaborations_controller_spec.rb index 73d50000f8..454b2564a6 100644 --- a/spec/controllers/collaborations_controller_spec.rb +++ b/spec/controllers/collaborations_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe CollaborationsController do +RSpec.describe CollaborationsController do describe "#create" do context "as a user with access to repos" do it "redirects to the repository" do diff --git a/spec/controllers/completed_trails_controller_spec.rb b/spec/controllers/completed_trails_controller_spec.rb index 6363968940..aba3bc9430 100644 --- a/spec/controllers/completed_trails_controller_spec.rb +++ b/spec/controllers/completed_trails_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe CompletedTrailsController do +RSpec.describe CompletedTrailsController do it "shows completed trails for current user" do completed_trails = double("completed-trails") expect(Trail).to receive(:completed_for).and_return(completed_trails) diff --git a/spec/controllers/downloads_controller_spec.rb b/spec/controllers/downloads_controller_spec.rb index 6ad31d05d7..5a9c558168 100644 --- a/spec/controllers/downloads_controller_spec.rb +++ b/spec/controllers/downloads_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe DownloadsController do +RSpec.describe DownloadsController do include StubCurrentUserHelper describe "#show" do diff --git a/spec/controllers/exercise_trails_controller_spec.rb b/spec/controllers/exercise_trails_controller_spec.rb index 167d23b5c3..21aadd03e8 100644 --- a/spec/controllers/exercise_trails_controller_spec.rb +++ b/spec/controllers/exercise_trails_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe ExerciseTrailsController do +RSpec.describe ExerciseTrailsController do include StubCurrentUserHelper describe "#show" do diff --git a/spec/controllers/forum_sessions_controller_spec.rb b/spec/controllers/forum_sessions_controller_spec.rb index e49cdeb56f..eea640977f 100644 --- a/spec/controllers/forum_sessions_controller_spec.rb +++ b/spec/controllers/forum_sessions_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe ForumSessionsController do +RSpec.describe ForumSessionsController do include StubCurrentUserHelper describe "#new" do diff --git a/spec/controllers/invitations_controller_spec.rb b/spec/controllers/invitations_controller_spec.rb index dba1157084..7ceeabf727 100644 --- a/spec/controllers/invitations_controller_spec.rb +++ b/spec/controllers/invitations_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe InvitationsController do +RSpec.describe InvitationsController do it_behaves_like "must be team owner" do def perform_request invitation = double("invitation", deliver: true) diff --git a/spec/controllers/marketing_controller_spec.rb b/spec/controllers/marketing_controller_spec.rb index 12ea9f92cf..1566af4272 100644 --- a/spec/controllers/marketing_controller_spec.rb +++ b/spec/controllers/marketing_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe MarketingController do +RSpec.describe MarketingController do context "the user is not logged in" do it "renders the content of /join, but stays on /" do get :show diff --git a/spec/controllers/memberships_controller_spec.rb b/spec/controllers/memberships_controller_spec.rb index e838ffd7f0..50c9518e79 100644 --- a/spec/controllers/memberships_controller_spec.rb +++ b/spec/controllers/memberships_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe MembershipsController do +RSpec.describe MembershipsController do it "does not allow you to remove yourself" do user = create(:user, :with_attached_team) sign_in_as user diff --git a/spec/controllers/repositories_controller_spec.rb b/spec/controllers/repositories_controller_spec.rb index 1e69123460..94b4104d7c 100644 --- a/spec/controllers/repositories_controller_spec.rb +++ b/spec/controllers/repositories_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe RepositoriesController do +RSpec.describe RepositoriesController do describe "#show" do it "redirects to the repository on GitHub" do repository = stub_repository diff --git a/spec/controllers/shows_controller_spec.rb b/spec/controllers/shows_controller_spec.rb index 9da9bc1c02..0740272d31 100644 --- a/spec/controllers/shows_controller_spec.rb +++ b/spec/controllers/shows_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe ShowsController do +RSpec.describe ShowsController do context "show" do it "doesn't render other formats" do show = create(:show) diff --git a/spec/controllers/teams_controller_spec.rb b/spec/controllers/teams_controller_spec.rb index aeceb7063e..c971049eef 100644 --- a/spec/controllers/teams_controller_spec.rb +++ b/spec/controllers/teams_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe TeamsController do +RSpec.describe TeamsController do it_behaves_like "must be team owner" do def perform_request get :edit diff --git a/spec/controllers/twitter_player_cards_controller_spec.rb b/spec/controllers/twitter_player_cards_controller_spec.rb index 9a80a64d75..9f978c7c6b 100644 --- a/spec/controllers/twitter_player_cards_controller_spec.rb +++ b/spec/controllers/twitter_player_cards_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe TwitterPlayerCardsController do +RSpec.describe TwitterPlayerCardsController do it "removes the 'X-Frame-Options' header to allow cross-domain iframes" do stub_video diff --git a/spec/controllers/unsubscribes_controller_spec.rb b/spec/controllers/unsubscribes_controller_spec.rb index 7ad22b0dc4..23f0b2c4af 100644 --- a/spec/controllers/unsubscribes_controller_spec.rb +++ b/spec/controllers/unsubscribes_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe UnsubscribesController do +RSpec.describe UnsubscribesController do include UnsubscribesHelper describe "#show" do diff --git a/spec/controllers/videos_controller_spec.rb b/spec/controllers/videos_controller_spec.rb index 0cc6f0d78d..e3ba39108b 100644 --- a/spec/controllers/videos_controller_spec.rb +++ b/spec/controllers/videos_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe VideosController do +RSpec.describe VideosController do include StubCurrentUserHelper describe "#show" do diff --git a/spec/features/admin_creates_deck_spec.rb b/spec/features/admin_creates_deck_spec.rb index a0d2323cb0..24127985e7 100644 --- a/spec/features/admin_creates_deck_spec.rb +++ b/spec/features/admin_creates_deck_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "Admin creates a deck" do +RSpec.feature "Admin creates a deck" do scenario "is 404 if not an admin" do expect do visit new_admin_deck_path(as: create(:user)) diff --git a/spec/features/clearance/user_signs_out_spec.rb b/spec/features/clearance/user_signs_out_spec.rb index 860a1b10eb..18da4ed3cc 100644 --- a/spec/features/clearance/user_signs_out_spec.rb +++ b/spec/features/clearance/user_signs_out_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "User signs out" do +RSpec.feature "User signs out" do scenario "signs out" do signed_in_user diff --git a/spec/features/clearance/visitor_resets_password_spec.rb b/spec/features/clearance/visitor_resets_password_spec.rb index cd58812c15..8a0bc96464 100644 --- a/spec/features/clearance/visitor_resets_password_spec.rb +++ b/spec/features/clearance/visitor_resets_password_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "Visitor resets password" do +RSpec.feature "Visitor resets password" do scenario "by navigating to the page" do visit sign_in_path diff --git a/spec/features/clearance/visitor_signs_in_spec.rb b/spec/features/clearance/visitor_signs_in_spec.rb index a6b96fb4d2..8dbbb180de 100644 --- a/spec/features/clearance/visitor_signs_in_spec.rb +++ b/spec/features/clearance/visitor_signs_in_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "Visitor signs in" do +RSpec.feature "Visitor signs in" do scenario "with valid email and password" do create_user "user@example.com", "password" sign_in_with "user@example.com", "password" diff --git a/spec/features/clearance/visitor_updates_password_spec.rb b/spec/features/clearance/visitor_updates_password_spec.rb index 1a500d9ff6..3f40b3658b 100644 --- a/spec/features/clearance/visitor_updates_password_spec.rb +++ b/spec/features/clearance/visitor_updates_password_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "Visitor updates password" do +RSpec.feature "Visitor updates password" do scenario "with valid password" do user = user_with_reset_password diff --git a/spec/features/design_for_developers_resources_spec.rb b/spec/features/design_for_developers_resources_spec.rb index 33b149668e..7fd0efa8a4 100644 --- a/spec/features/design_for_developers_resources_spec.rb +++ b/spec/features/design_for_developers_resources_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "Design For Developers Resources" do +RSpec.feature "Design For Developers Resources" do scenario "View the resources" do visit "/upcase/design-for-developers-resources" diff --git a/spec/features/non_subscriber_accesses_content_spec.rb b/spec/features/non_subscriber_accesses_content_spec.rb index 2d92014224..82fa0a36b2 100644 --- a/spec/features/non_subscriber_accesses_content_spec.rb +++ b/spec/features/non_subscriber_accesses_content_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "User looking for content" do +RSpec.feature "User looking for content" do scenario "accesses the practice page" do visit practice_path(as: create(:user)) diff --git a/spec/features/pages_spec.rb b/spec/features/pages_spec.rb index 37c0c6ae8c..c1c70b979e 100644 --- a/spec/features/pages_spec.rb +++ b/spec/features/pages_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "Pages" do +RSpec.feature "Pages" do ["/upcase/privacy", "/upcase/terms"].each do |page_url| scenario "able to visit #{page_url}" do visit page_url diff --git a/spec/features/subscriber_follows_trail_spec.rb b/spec/features/subscriber_follows_trail_spec.rb index 2beb77628d..c590df8e24 100644 --- a/spec/features/subscriber_follows_trail_spec.rb +++ b/spec/features/subscriber_follows_trail_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "user starts a trail" do +RSpec.feature "user starts a trail" do scenario "clicks into exercise" do exercises = [ create(:exercise, name: "First Exercise"), diff --git a/spec/features/subscriber_searches_for_content_spec.rb b/spec/features/subscriber_searches_for_content_spec.rb index e54419ccb0..2737c0f4b2 100644 --- a/spec/features/subscriber_searches_for_content_spec.rb +++ b/spec/features/subscriber_searches_for_content_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "user searches for content" do +RSpec.feature "user searches for content" do scenario "finds the desired content" do create(:trail, name: "regex", published: true) tmux = create(:trail, :with_topic, name: "tmux", published: true) diff --git a/spec/features/subscriber_uses_flashcards_spec.rb b/spec/features/subscriber_uses_flashcards_spec.rb index 329672f1ba..7528b9e081 100644 --- a/spec/features/subscriber_uses_flashcards_spec.rb +++ b/spec/features/subscriber_uses_flashcards_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "user views decks" do +RSpec.feature "user views decks" do scenario "and starts a deck" do flashcard = create(:flashcard) diff --git a/spec/features/subscriber_views_completed_trails_spec.rb b/spec/features/subscriber_views_completed_trails_spec.rb index c74a08f0d9..6e7f5cb30f 100644 --- a/spec/features/subscriber_views_completed_trails_spec.rb +++ b/spec/features/subscriber_views_completed_trails_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "Completed Trails" do +RSpec.feature "Completed Trails" do scenario "user navigates to completed trails" do user = create(:user) complete_trail = create_trail_completed_by(user, at: 1.week.ago) diff --git a/spec/features/subscriber_views_practice_trails_spec.rb b/spec/features/subscriber_views_practice_trails_spec.rb index 5fb4218fd4..6d859540cb 100644 --- a/spec/features/subscriber_views_practice_trails_spec.rb +++ b/spec/features/subscriber_views_practice_trails_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "user views completed trails" do +RSpec.feature "user views completed trails" do scenario "completed and incompleted trails are separated" do completed_trail = create(:trail, :published, :completed) user = completed_trail.users.last diff --git a/spec/features/subscriber_views_topic_spec.rb b/spec/features/subscriber_views_topic_spec.rb index 6b8e0665dc..666d2dcb66 100644 --- a/spec/features/subscriber_views_topic_spec.rb +++ b/spec/features/subscriber_views_topic_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "user views a topic" do +RSpec.feature "user views a topic" do scenario "and sees associated resources" do topic = create(:topic, :explorable) user = create(:user) diff --git a/spec/features/subscriber_views_trail_details_spec.rb b/spec/features/subscriber_views_trail_details_spec.rb index 110d4ce9a7..b5712825b7 100644 --- a/spec/features/subscriber_views_trail_details_spec.rb +++ b/spec/features/subscriber_views_trail_details_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "user views trail details" do +RSpec.feature "user views trail details" do scenario "sees progress" do exercises = [ create(:exercise, name: "First Exercise"), diff --git a/spec/features/subscriber_views_video_spec.rb b/spec/features/subscriber_views_video_spec.rb index 8c4092e011..a942b2cbdc 100644 --- a/spec/features/subscriber_views_video_spec.rb +++ b/spec/features/subscriber_views_video_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "user views video trail" do +RSpec.feature "user views video trail" do scenario "and marks a video as complete" do trail = create_video_trail diff --git a/spec/features/subscriber_views_weekly_iteration_spec.rb b/spec/features/subscriber_views_weekly_iteration_spec.rb index 439946356b..c89a962e92 100644 --- a/spec/features/subscriber_views_weekly_iteration_spec.rb +++ b/spec/features/subscriber_views_weekly_iteration_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "user views weekly iteration" do +RSpec.feature "user views weekly iteration" do scenario "and sees relevant details on the page" do user = create(:user) show = create(:show) diff --git a/spec/features/test_driven_rails_resources_spec.rb b/spec/features/test_driven_rails_resources_spec.rb index 396c630949..28ed5d928e 100644 --- a/spec/features/test_driven_rails_resources_spec.rb +++ b/spec/features/test_driven_rails_resources_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "Test-Driven Rails Resources" do +RSpec.feature "Test-Driven Rails Resources" do scenario "View the resources" do visit "/upcase/test-driven-rails-resources" diff --git a/spec/features/user_accepts_team_invitation_spec.rb b/spec/features/user_accepts_team_invitation_spec.rb index 6ee97b4baa..799cd6f190 100644 --- a/spec/features/user_accepts_team_invitation_spec.rb +++ b/spec/features/user_accepts_team_invitation_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "Accept team invitations" do +RSpec.feature "Accept team invitations" do context "when user is signed in" do it "accepts the invitation immediately" do create_team_account diff --git a/spec/features/user_manages_team_subscription_spec.rb b/spec/features/user_manages_team_subscription_spec.rb index 57228a516b..1e73cccd76 100644 --- a/spec/features/user_manages_team_subscription_spec.rb +++ b/spec/features/user_manages_team_subscription_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "User edits a team" do +RSpec.feature "User edits a team" do include ActionView::Helpers::NumberHelper background do diff --git a/spec/features/user_removes_pending_invitation_spec.rb b/spec/features/user_removes_pending_invitation_spec.rb index db0dcd6639..9f20390c9f 100644 --- a/spec/features/user_removes_pending_invitation_spec.rb +++ b/spec/features/user_removes_pending_invitation_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "Remove pending invitations" do +RSpec.feature "Remove pending invitations" do include ActionView::RecordIdentifier scenario "an owner removes a team member" do diff --git a/spec/features/user_removes_team_member_spec.rb b/spec/features/user_removes_team_member_spec.rb index 58583e6a8d..e31f5859bf 100644 --- a/spec/features/user_removes_team_member_spec.rb +++ b/spec/features/user_removes_team_member_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "Remove team members" do +RSpec.feature "Remove team members" do include ActionView::RecordIdentifier scenario "an owner removes a team member" do diff --git a/spec/features/user_sees_trail_map_progress_spec.rb b/spec/features/user_sees_trail_map_progress_spec.rb index 31cc31aba9..7e48f21c17 100644 --- a/spec/features/user_sees_trail_map_progress_spec.rb +++ b/spec/features/user_sees_trail_map_progress_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "User can see their trail map progress" do +RSpec.feature "User can see their trail map progress" do background do sign_in end diff --git a/spec/features/user_signs_out_spec.rb b/spec/features/user_signs_out_spec.rb index b39c2ae15c..f9ff9bc5ea 100644 --- a/spec/features/user_signs_out_spec.rb +++ b/spec/features/user_signs_out_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "Users signs out" do +RSpec.feature "Users signs out" do scenario "from account page" do visit my_account_path(as: create(:user)) click_link "Sign out" diff --git a/spec/features/user_views_account_spec.rb b/spec/features/user_views_account_spec.rb index db489b0e54..39e046a8cc 100644 --- a/spec/features/user_views_account_spec.rb +++ b/spec/features/user_views_account_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "Account Settings" do +RSpec.feature "Account Settings" do scenario "user edits account information" do user = create(:user, name: "Test User") diff --git a/spec/features/user_views_landing_page_spec.rb b/spec/features/user_views_landing_page_spec.rb index f26914c9b9..a04f918467 100644 --- a/spec/features/user_views_landing_page_spec.rb +++ b/spec/features/user_views_landing_page_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "User views landing page" do +RSpec.feature "User views landing page" do context "the user is not logged in" do it "displays the basic landing page" do visit root_path diff --git a/spec/features/user_views_team_invitations_spec.rb b/spec/features/user_views_team_invitations_spec.rb index 7a229cc042..96ef1ce63f 100644 --- a/spec/features/user_views_team_invitations_spec.rb +++ b/spec/features/user_views_team_invitations_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "View team invitations" do +RSpec.feature "View team invitations" do scenario "when some have been accepted" do owner = create(:user, :with_attached_team) team = owner.team diff --git a/spec/features/videos_spec.rb b/spec/features/videos_spec.rb index b7273bf38e..1c7830053f 100644 --- a/spec/features/videos_spec.rb +++ b/spec/features/videos_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "Videos" do +RSpec.describe "Videos" do context "GET /" do it "provides RSS to distribute the Weekly Iteration to various channels" do show = create( diff --git a/spec/features/visitor_views_weekly_iteration_spec.rb b/spec/features/visitor_views_weekly_iteration_spec.rb index c78a793c4f..6b43f87f31 100644 --- a/spec/features/visitor_views_weekly_iteration_spec.rb +++ b/spec/features/visitor_views_weekly_iteration_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -feature "Visitor" do +RSpec.feature "Visitor" do scenario "views Weekly Iteration preview page" do show = create(:the_weekly_iteration) create(:video, watchable: show) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 2f8c001fbf..8c4d9ec7be 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe ApplicationHelper do +RSpec.describe ApplicationHelper do describe "#format_markdown" do it "returns the rendered html for the input markdown" do markdown = "hello **world**" diff --git a/spec/helpers/html_helper_spec.rb b/spec/helpers/html_helper_spec.rb index 3820972b6e..e4fd187065 100644 --- a/spec/helpers/html_helper_spec.rb +++ b/spec/helpers/html_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe HtmlHelper do +RSpec.describe HtmlHelper do describe "#truncate_html" do it "returns the plain text after rendering to markdown" do input = "[hello world link](http://example.com)" diff --git a/spec/helpers/open_graph_helper_spec.rb b/spec/helpers/open_graph_helper_spec.rb index f72a35b954..577700bcb4 100644 --- a/spec/helpers/open_graph_helper_spec.rb +++ b/spec/helpers/open_graph_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe OpenGraphHelper do +RSpec.describe OpenGraphHelper do before :each do helper.request.path_parameters .merge!(controller: "marketing", action: "show") diff --git a/spec/helpers/products_helper_spec.rb b/spec/helpers/products_helper_spec.rb index 87148b3c51..5dfad14b9a 100644 --- a/spec/helpers/products_helper_spec.rb +++ b/spec/helpers/products_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe ProductsHelper do +RSpec.describe ProductsHelper do describe "#test_driven_rails_url" do it "returns a link to the right page" do result = helper.test_driven_rails_url diff --git a/spec/helpers/searches_helper_spec.rb b/spec/helpers/searches_helper_spec.rb index 7af6b56295..a28c515b5e 100644 --- a/spec/helpers/searches_helper_spec.rb +++ b/spec/helpers/searches_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe SearchesHelper do +RSpec.describe SearchesHelper do describe "#cleaned_search_excerpt" do it "removes repeated dashes and pipe characters from provided string" do highlight_string = "title ===== ``` hello ``` ----- world ||||| things" diff --git a/spec/helpers/trails_helper_spec.rb b/spec/helpers/trails_helper_spec.rb index d9173f8260..9ae369e85e 100644 --- a/spec/helpers/trails_helper_spec.rb +++ b/spec/helpers/trails_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe TrailsHelper do +RSpec.describe TrailsHelper do include Rails.application.routes.url_helpers describe "#trail_breadcrumbs" do diff --git a/spec/helpers/videos_helper_spec.rb b/spec/helpers/videos_helper_spec.rb index 80732fefcc..b7d81933a5 100644 --- a/spec/helpers/videos_helper_spec.rb +++ b/spec/helpers/videos_helper_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe VideosHelper do +RSpec.describe VideosHelper do describe "#topic_slugs" do it "returns nil if no related topic found" do video = double("video", topics: []) diff --git a/spec/jobs/weekly_iteration_mailer_job_spec.rb b/spec/jobs/weekly_iteration_mailer_job_spec.rb index e67337cbd0..ec6679d5fe 100644 --- a/spec/jobs/weekly_iteration_mailer_job_spec.rb +++ b/spec/jobs/weekly_iteration_mailer_job_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe WeeklyIterationMailerJob do +RSpec.describe WeeklyIterationMailerJob do it_behaves_like "a Delayed Job that notifies Sentry about errors" describe "#perform" do diff --git a/spec/lib/slug_constraint_spec.rb b/spec/lib/slug_constraint_spec.rb index 7f9569b0c7..d4fd6ecfbc 100644 --- a/spec/lib/slug_constraint_spec.rb +++ b/spec/lib/slug_constraint_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe SlugConstraint do +RSpec.describe SlugConstraint do around do |example| RequestStore.clear! example.run diff --git a/spec/lib/watchable_rails_admin_field_spec.rb b/spec/lib/watchable_rails_admin_field_spec.rb index eea20477be..2f54ed996c 100644 --- a/spec/lib/watchable_rails_admin_field_spec.rb +++ b/spec/lib/watchable_rails_admin_field_spec.rb @@ -1,6 +1,6 @@ require "spec_helper" -describe WatchableRailsAdminField do +RSpec.describe WatchableRailsAdminField do context "#associated_collection" do it "sorts the delegated value" do unsorted = [2, 1, 3] diff --git a/spec/mailers/invitation_mailer_spec.rb b/spec/mailers/invitation_mailer_spec.rb index 7fbe0da8b9..206a3b8e63 100644 --- a/spec/mailers/invitation_mailer_spec.rb +++ b/spec/mailers/invitation_mailer_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe InvitationMailer do +RSpec.describe InvitationMailer do describe "#invitation" do it "delivers an invitation email" do invitation = build_stubbed(:invitation) diff --git a/spec/mailers/weekly_iteration_drip_mailer_spec.rb b/spec/mailers/weekly_iteration_drip_mailer_spec.rb index e16c6b108b..fbc81b5e18 100644 --- a/spec/mailers/weekly_iteration_drip_mailer_spec.rb +++ b/spec/mailers/weekly_iteration_drip_mailer_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe WeeklyIterationDripMailer do +RSpec.describe WeeklyIterationDripMailer do describe "#weekly_update" do it "comes from Ben Orenstein" do message = build_message diff --git a/spec/models/attempt_spec.rb b/spec/models/attempt_spec.rb index 0517e47184..8f62bd9b71 100644 --- a/spec/models/attempt_spec.rb +++ b/spec/models/attempt_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Attempt do +RSpec.describe Attempt do it { should validate_presence_of(:user_id) } it { should validate_presence_of(:flashcard_id) } it { should validate_presence_of(:confidence) } diff --git a/spec/models/catalog_spec.rb b/spec/models/catalog_spec.rb index a650d55462..240ff7e9df 100644 --- a/spec/models/catalog_spec.rb +++ b/spec/models/catalog_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Catalog do +RSpec.describe Catalog do describe "#products" do it "returns active products in order" do catalog = Catalog.new diff --git a/spec/models/classification_spec.rb b/spec/models/classification_spec.rb index b70b19abff..2f632d4c46 100644 --- a/spec/models/classification_spec.rb +++ b/spec/models/classification_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Classification do +RSpec.describe Classification do it { should belong_to(:classifiable) } it { should belong_to(:topic) } diff --git a/spec/models/clip_spec.rb b/spec/models/clip_spec.rb index 1405e96e52..9d007f65c2 100644 --- a/spec/models/clip_spec.rb +++ b/spec/models/clip_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Clip do +RSpec.describe Clip do context "#download_url" do it "returns the download url for the video" do video = Clip.new("123") diff --git a/spec/models/completeable_with_progress_spec.rb b/spec/models/completeable_with_progress_spec.rb index 705f5d1ef4..d30414a914 100644 --- a/spec/models/completeable_with_progress_spec.rb +++ b/spec/models/completeable_with_progress_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe CompleteableWithProgress do +RSpec.describe CompleteableWithProgress do describe "#name" do it "delegates to its completeable" do name = "some-name" diff --git a/spec/models/content_recommendation_spec.rb b/spec/models/content_recommendation_spec.rb index 1eabb536be..ce5d2d7470 100644 --- a/spec/models/content_recommendation_spec.rb +++ b/spec/models/content_recommendation_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe ContentRecommendation do +RSpec.describe ContentRecommendation do it { should belong_to(:user) } it { should belong_to(:recommendable) } end diff --git a/spec/models/deck_spec.rb b/spec/models/deck_spec.rb index ac3936846b..822548e6d0 100644 --- a/spec/models/deck_spec.rb +++ b/spec/models/deck_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Deck do +RSpec.describe Deck do it { should validate_presence_of(:title) } it { should have_many(:flashcards).dependent(:destroy) } diff --git a/spec/models/exercise_spec.rb b/spec/models/exercise_spec.rb index 150ced0a09..09915e39fc 100644 --- a/spec/models/exercise_spec.rb +++ b/spec/models/exercise_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Exercise do +RSpec.describe Exercise do it { should validate_presence_of(:name) } it { should validate_presence_of(:url) } it { should have_one(:trail).through(:step) } diff --git a/spec/models/flashcard_spec.rb b/spec/models/flashcard_spec.rb index cc39ad9591..55e5a374ec 100644 --- a/spec/models/flashcard_spec.rb +++ b/spec/models/flashcard_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Flashcard do +RSpec.describe Flashcard do it { should validate_presence_of(:title) } it { should validate_presence_of(:prompt) } it { should validate_presence_of(:answer) } diff --git a/spec/models/flashcards_needing_review_query_spec.rb b/spec/models/flashcards_needing_review_query_spec.rb index 07dc4fa7eb..e72d507312 100644 --- a/spec/models/flashcards_needing_review_query_spec.rb +++ b/spec/models/flashcards_needing_review_query_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe FlashcardsNeedingReviewQuery do +RSpec.describe FlashcardsNeedingReviewQuery do describe "#run" do it "returns flashcards whose last attempt had low confidence" do user = create(:user) diff --git a/spec/models/forum_spec.rb b/spec/models/forum_spec.rb index bc4ef940ab..2379dd7853 100644 --- a/spec/models/forum_spec.rb +++ b/spec/models/forum_spec.rb @@ -1,6 +1,6 @@ require "spec_helper" -describe Forum do +RSpec.describe Forum do it "knows the url of the forum" do ClimateControl.modify FORUM_URL: "https://forum.example.com" do expect(Forum.url).to eq "https://forum.example.com/" diff --git a/spec/models/guest_spec.rb b/spec/models/guest_spec.rb index da8d9dc326..f77f5b43ec 100644 --- a/spec/models/guest_spec.rb +++ b/spec/models/guest_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Guest do +RSpec.describe Guest do describe "#admin?" do it "returns false" do guest = Guest.new diff --git a/spec/models/invitation_spec.rb b/spec/models/invitation_spec.rb index d2c69a5c3a..d5f458efeb 100644 --- a/spec/models/invitation_spec.rb +++ b/spec/models/invitation_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Invitation do +RSpec.describe Invitation do it { should validate_presence_of(:email) } it { should validate_presence_of(:sender_id) } it { should validate_presence_of(:team_id) } diff --git a/spec/models/marker_spec.rb b/spec/models/marker_spec.rb index d7c5305a13..6a8158933f 100644 --- a/spec/models/marker_spec.rb +++ b/spec/models/marker_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Marker do +RSpec.describe Marker do it { should belong_to(:video) } it { should validate_presence_of(:anchor) } it { should validate_presence_of(:time) } diff --git a/spec/models/null_attempt_spec.rb b/spec/models/null_attempt_spec.rb index d17371a592..8a24ff2810 100644 --- a/spec/models/null_attempt_spec.rb +++ b/spec/models/null_attempt_spec.rb @@ -1,6 +1,6 @@ require "spec_helper" -describe NullAttempt do +RSpec.describe NullAttempt do describe "#confidence" do it "should be a 0 to signify the user not having attempted" do expect(NullAttempt.new.confidence).to eq(0) diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb index 979bb4a11b..6bfef0619b 100644 --- a/spec/models/product_spec.rb +++ b/spec/models/product_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Product do +RSpec.describe Product do it { should have_many(:classifications).dependent(:destroy) } it { should have_many(:topics).through(:classifications) } it { should have_many(:videos).dependent(:destroy) } diff --git a/spec/models/recommendable_content_spec.rb b/spec/models/recommendable_content_spec.rb index a971064533..e7dadcef99 100644 --- a/spec/models/recommendable_content_spec.rb +++ b/spec/models/recommendable_content_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe RecommendableContent do +RSpec.describe RecommendableContent do it { should belong_to(:recommendable) } describe "uniqueness criteria" do diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 15ff86f6b5..c9a1d616cd 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Repository do +RSpec.describe Repository do it_behaves_like "a class inheriting from Product" it { should belong_to(:trail).optional } diff --git a/spec/models/return_path_finder_spec.rb b/spec/models/return_path_finder_spec.rb index c76252aeff..67c90ef4d9 100644 --- a/spec/models/return_path_finder_spec.rb +++ b/spec/models/return_path_finder_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe ReturnPathFinder do +RSpec.describe ReturnPathFinder do describe "#return_path" do it "returns the return path specified in the URL" do url = "http://www.example.com?return_to=/some_url" diff --git a/spec/models/search_result_spec.rb b/spec/models/search_result_spec.rb index c9be5a1f9b..f0da2bcd9f 100644 --- a/spec/models/search_result_spec.rb +++ b/spec/models/search_result_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe SearchResult do +RSpec.describe SearchResult do describe "#to_partial_path" do it "returns a partial path based on the model type" do video = build_stubbed(:video) diff --git a/spec/models/search_spec.rb b/spec/models/search_spec.rb index 56a1d68f91..be91876370 100644 --- a/spec/models/search_spec.rb +++ b/spec/models/search_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Search do +RSpec.describe Search do describe "#results_with_excerpts" do it "returns relevant search results" do hello_video = create(:video, notes: "Hello world") diff --git a/spec/models/show_spec.rb b/spec/models/show_spec.rb index 72009ccd3c..1784e461d0 100644 --- a/spec/models/show_spec.rb +++ b/spec/models/show_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Show do +RSpec.describe Show do it_behaves_like "a class inheriting from Product" describe ".the_weekly_iteration" do diff --git a/spec/models/status_finder_spec.rb b/spec/models/status_finder_spec.rb index dbec505f13..a5779bd65a 100644 --- a/spec/models/status_finder_spec.rb +++ b/spec/models/status_finder_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe StatusFinder do +RSpec.describe StatusFinder do describe "#current_status_for" do context "with a status in the database" do it "returns the state for the given completeable" do diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb index ab40a387ed..59f4b48349 100644 --- a/spec/models/status_spec.rb +++ b/spec/models/status_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Status do +RSpec.describe Status do it { should belong_to(:completeable) } it { should belong_to(:user) } diff --git a/spec/models/step_spec.rb b/spec/models/step_spec.rb index 187d999707..7db7e19275 100644 --- a/spec/models/step_spec.rb +++ b/spec/models/step_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Step do +RSpec.describe Step do it { should belong_to(:completeable) } it { should belong_to(:trail) } it { should validate_presence_of(:completeable) } diff --git a/spec/models/teacher_spec.rb b/spec/models/teacher_spec.rb index 8a7678ab8a..98d70d7110 100644 --- a/spec/models/teacher_spec.rb +++ b/spec/models/teacher_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Teacher do +RSpec.describe Teacher do it { should belong_to(:user) } it { should belong_to(:video) } diff --git a/spec/models/team_spec.rb b/spec/models/team_spec.rb index 82f66b8954..016ec0cf2d 100644 --- a/spec/models/team_spec.rb +++ b/spec/models/team_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Team do +RSpec.describe Team do it { should belong_to(:owner).class_name(User) } it { should have_many(:users).dependent(:nullify) } it { should validate_presence_of(:name) } diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rb index 7a9a989f5b..3de4b01007 100644 --- a/spec/models/topic_spec.rb +++ b/spec/models/topic_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Topic do +RSpec.describe Topic do # Associations it { should have_many(:classifications).dependent(:destroy) } it { should have_many(:products).through(:classifications) } diff --git a/spec/models/trail_spec.rb b/spec/models/trail_spec.rb index 2f81aa8128..6ffe268d48 100644 --- a/spec/models/trail_spec.rb +++ b/spec/models/trail_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Trail do +RSpec.describe Trail do it { should validate_presence_of(:name) } it { should validate_presence_of(:description) } diff --git a/spec/models/trail_with_progress_query_spec.rb b/spec/models/trail_with_progress_query_spec.rb index b5535a66f0..ef995f0ca3 100644 --- a/spec/models/trail_with_progress_query_spec.rb +++ b/spec/models/trail_with_progress_query_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe TrailWithProgressQuery do +RSpec.describe TrailWithProgressQuery do describe "#each" do it "yields each trail with progress" do user = create(:user) diff --git a/spec/models/trail_with_progress_spec.rb b/spec/models/trail_with_progress_spec.rb index 113473bac2..79135871dc 100644 --- a/spec/models/trail_with_progress_spec.rb +++ b/spec/models/trail_with_progress_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe TrailWithProgress do +RSpec.describe TrailWithProgress do it "decorates its component" do user = double("user") trail = build_stubbed(:trail) diff --git a/spec/models/trails_for_practice_page_query_spec.rb b/spec/models/trails_for_practice_page_query_spec.rb index d2677e9957..075bba83f3 100644 --- a/spec/models/trails_for_practice_page_query_spec.rb +++ b/spec/models/trails_for_practice_page_query_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe TrailsForPracticePageQuery do +RSpec.describe TrailsForPracticePageQuery do describe "#each" do it "yields only published trails" do create(:trail, :published, name: "published-trail") diff --git a/spec/models/unstarted_spec.rb b/spec/models/unstarted_spec.rb index 28a55ed5f8..f7957ee4e2 100644 --- a/spec/models/unstarted_spec.rb +++ b/spec/models/unstarted_spec.rb @@ -1,6 +1,6 @@ require "spec_helper" -describe Unstarted do +RSpec.describe Unstarted do it "has the state 'Unstarted'" do expect(Unstarted.new.state).to eq "Unstarted" end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 120a5e054b..8be96e4c4a 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe User do +RSpec.describe User do context "associations" do it { should belong_to(:team).optional } it { should have_many(:attempts).dependent(:destroy) } diff --git a/spec/models/video_listing_spec.rb b/spec/models/video_listing_spec.rb index 827dedeffc..d34cde6a84 100644 --- a/spec/models/video_listing_spec.rb +++ b/spec/models/video_listing_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe VideoListing do +RSpec.describe VideoListing do describe "#videos_with_status" do it "decorates videos with the current users view status" do video = create(:video, :published) diff --git a/spec/models/video_spec.rb b/spec/models/video_spec.rb index ab10549139..d467f29d2d 100644 --- a/spec/models/video_spec.rb +++ b/spec/models/video_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Video do +RSpec.describe Video do include VideoHelpers include WistiaApiClientStubs diff --git a/spec/models/video_thumbnail_spec.rb b/spec/models/video_thumbnail_spec.rb index 552db121a5..94b2a97652 100644 --- a/spec/models/video_thumbnail_spec.rb +++ b/spec/models/video_thumbnail_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe VideoThumbnail do +RSpec.describe VideoThumbnail do context "#url" do it "returns the url" do wistia_id = double("wista_id") diff --git a/spec/models/video_with_status_spec.rb b/spec/models/video_with_status_spec.rb index 454c78106b..192c4b6a96 100644 --- a/spec/models/video_with_status_spec.rb +++ b/spec/models/video_with_status_spec.rb @@ -1,6 +1,6 @@ require "spec_helper" -describe VideoWithStatus do +RSpec.describe VideoWithStatus do describe "status_class" do it "paremterizes the provided status' state" do status = double(Status, state: "In Progress") diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 83aa4006eb..8240012d67 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,6 +1,7 @@ if ENV["COVERAGE"] require "simplecov" SimpleCov.start :rails do + enable_coverage :branch add_filter "app/mailer_previews" add_filter "vendor/lib" end diff --git a/spec/requests/design_for_developers_resource_spec.rb b/spec/requests/design_for_developers_resource_spec.rb index 0866dc4ce5..a12797a1f0 100644 --- a/spec/requests/design_for_developers_resource_spec.rb +++ b/spec/requests/design_for_developers_resource_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "Design For Developers Resources" do +RSpec.describe "Design For Developers Resources" do it "handles a missing resource" do expect { get_missing_resource }.to raise_error(ActiveRecord::RecordNotFound) end diff --git a/spec/requests/sign_up_redirect_spec.rb b/spec/requests/sign_up_redirect_spec.rb index 58a996d366..e199188180 100644 --- a/spec/requests/sign_up_redirect_spec.rb +++ b/spec/requests/sign_up_redirect_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "User_signup redirect" do +RSpec.describe "User_signup redirect" do it "redirects to join path" do get "/upcase/sign_up" diff --git a/spec/requests/sitemap_spec.rb b/spec/requests/sitemap_spec.rb index b696e2e12b..365eb6b123 100644 --- a/spec/requests/sitemap_spec.rb +++ b/spec/requests/sitemap_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "The sitemap" do +RSpec.describe "The sitemap" do it "responds with an XML sitemap" do create(:show, name: Show::THE_WEEKLY_ITERATION) diff --git a/spec/requests/video_status_spec.rb b/spec/requests/video_status_spec.rb index 02e2eb6a5c..19e6bf98aa 100644 --- a/spec/requests/video_status_spec.rb +++ b/spec/requests/video_status_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "Video status" do +RSpec.describe "Video status" do before { sign_in } describe "when user started the video" do diff --git a/spec/serializers/user_serializer_spec.rb b/spec/serializers/user_serializer_spec.rb index 036163ce82..d0e3024cb4 100644 --- a/spec/serializers/user_serializer_spec.rb +++ b/spec/serializers/user_serializer_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe UserSerializer do +RSpec.describe UserSerializer do include Gravatarify::Helper it "serializes simple attributes" do diff --git a/spec/services/auth_hash_service_spec.rb b/spec/services/auth_hash_service_spec.rb index 35d91f6146..129a741b6d 100644 --- a/spec/services/auth_hash_service_spec.rb +++ b/spec/services/auth_hash_service_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe AuthHashService, "#find_or_create_user_from_auth_hash" do +RSpec.describe AuthHashService, "#find_or_create_user_from_auth_hash" do it "creates a user using nickname as a name when name is blank in auth_hash" do hash = auth_hash("info" => {"name" => nil, "email" => "user@example.com", diff --git a/spec/services/completeable_with_progress_query_spec.rb b/spec/services/completeable_with_progress_query_spec.rb index b0d711f917..11d70904e1 100644 --- a/spec/services/completeable_with_progress_query_spec.rb +++ b/spec/services/completeable_with_progress_query_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe CompleteableWithProgressQuery do +RSpec.describe CompleteableWithProgressQuery do describe "#each" do it "decorates completeables with progress" do exercise_step_1 = create(:exercise) diff --git a/spec/services/practice_spec.rb b/spec/services/practice_spec.rb index 1b201390a7..f729dee6d7 100644 --- a/spec/services/practice_spec.rb +++ b/spec/services/practice_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe Practice do +RSpec.describe Practice do describe "#has_completed_trails?" do it "returns false if there are no completed trails" do practice = build_practice(trails: []) diff --git a/spec/services/status_updater_spec.rb b/spec/services/status_updater_spec.rb index 41e3a006db..7d9031e4da 100644 --- a/spec/services/status_updater_spec.rb +++ b/spec/services/status_updater_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe StatusUpdater do +RSpec.describe StatusUpdater do describe "#update_state" do it "creates a status" do completeable = mock_completeable diff --git a/spec/services/topic_with_trails_spec.rb b/spec/services/topic_with_trails_spec.rb index 6fdf587ca7..d230e39292 100644 --- a/spec/services/topic_with_trails_spec.rb +++ b/spec/services/topic_with_trails_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe TopicWithTrails do +RSpec.describe TopicWithTrails do describe "#name" do it "finds topic by slug and delegates to it" do topic = create(:topic, :explorable) diff --git a/spec/services/video_duration_updater_spec.rb b/spec/services/video_duration_updater_spec.rb index c860696f4c..5eba270215 100644 --- a/spec/services/video_duration_updater_spec.rb +++ b/spec/services/video_duration_updater_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe VideoDurationUpdater do +RSpec.describe VideoDurationUpdater do include WistiaApiClientStubs describe ".update_all_durations" do diff --git a/spec/services/weekly_iteration_recommender_spec.rb b/spec/services/weekly_iteration_recommender_spec.rb index 110d397dd1..4319093be7 100644 --- a/spec/services/weekly_iteration_recommender_spec.rb +++ b/spec/services/weekly_iteration_recommender_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe WeeklyIterationRecommender do +RSpec.describe WeeklyIterationRecommender do describe "#recommend" do context "with video to recommend" do it "creates a recommendation" do diff --git a/spec/services/weekly_iteration_suggestions_spec.rb b/spec/services/weekly_iteration_suggestions_spec.rb index ef3e4d2051..4d3070ec61 100644 --- a/spec/services/weekly_iteration_suggestions_spec.rb +++ b/spec/services/weekly_iteration_suggestions_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe WeeklyIterationSuggestions do +RSpec.describe WeeklyIterationSuggestions do describe "#perform" do it "calls WeeklyIterationRecommender for each user" do user = create(:user) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5de52e3208..8433f80dbe 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,10 +3,26 @@ Kernel.srand config.seed - config.expect_with :rspec do |c| - c.syntax = :expect + config.expect_with :rspec do |expectations| + expectations.syntax = :expect + expectations.include_chain_clauses_in_custom_matcher_descriptions = true end + config.mock_with :rspec do |mocks| + mocks.syntax = :expect + # mocks.verify_partial_doubles = true + end + + config.shared_context_metadata_behavior = :apply_to_host_groups + + if ENV["CI"] + config.before(:example, :focus) { |example| raise "Focused spec found at #{example.location}" } + else + config.filter_run_when_matching :focus + end + + config.disable_monkey_patching! + if config.files_to_run.one? config.default_formatter = "doc" end diff --git a/spec/support/airbrake.rb b/spec/support/airbrake.rb index 1156f58663..b6ccb98e34 100644 --- a/spec/support/airbrake.rb +++ b/spec/support/airbrake.rb @@ -1,4 +1,4 @@ -shared_examples "a Delayed Job that notifies Sentry about errors" do +RSpec.shared_examples "a Delayed Job that notifies Sentry about errors" do describe "#error" do it "notifies Sentry when an error occurs" do allow(Sentry).to receive(:capture_exception) diff --git a/spec/support/must_be_team_owner.rb b/spec/support/must_be_team_owner.rb index 89fe74b518..e988b40d74 100644 --- a/spec/support/must_be_team_owner.rb +++ b/spec/support/must_be_team_owner.rb @@ -1,4 +1,4 @@ -shared_examples_for "must be team owner" do +RSpec.shared_examples_for "must be team owner" do it "allows a user with a team" do user = create(:user, :with_attached_team) sign_in_as user diff --git a/spec/support/product_shared_examples.rb b/spec/support/product_shared_examples.rb index 65d8286392..a1805505e5 100644 --- a/spec/support/product_shared_examples.rb +++ b/spec/support/product_shared_examples.rb @@ -1,4 +1,4 @@ -shared_examples "a class inheriting from Product" do +RSpec.shared_examples "a class inheriting from Product" do it { should have_many(:classifications) } it { should have_many(:topics).through(:classifications) } diff --git a/spec/support/stub_view_method.rb b/spec/support/stub_view_method.rb index 2afbd8be50..9ebbed120f 100644 --- a/spec/support/stub_view_method.rb +++ b/spec/support/stub_view_method.rb @@ -6,13 +6,12 @@ def view_stubs(method_name) def view_stub_with_return(*values) values.each do |value| value.each do |method_name, return_value| - allow(view).to receive(method_name) - .and_return(return_value) + allow(view).to receive(method_name).and_return(return_value) end end end end RSpec.configure do |config| - config.include ViewStubs + config.include ViewStubs, type: :view end diff --git a/spec/views/flashcards/show.html.erb_spec.rb b/spec/views/flashcards/show.html.erb_spec.rb index 816a29ef2f..77e9a0841f 100644 --- a/spec/views/flashcards/show.html.erb_spec.rb +++ b/spec/views/flashcards/show.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "flashcards/show.html" do +RSpec.describe "flashcards/show.html" do it "renders the prompt as markdown" do render_flashcard(prompt: "Hey **you** guys") diff --git a/spec/views/layouts/_footer.html.erb_spec.rb b/spec/views/layouts/_footer.html.erb_spec.rb index 8752ae7bf9..712561340b 100644 --- a/spec/views/layouts/_footer.html.erb_spec.rb +++ b/spec/views/layouts/_footer.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "layouts/_footer.html.erb" do +RSpec.describe "layouts/_footer.html.erb" do context "when not signed in" do it "does not show the repositories link" do view_stub_with_return(signed_in?: false) diff --git a/spec/views/layouts/_header_application_links.html.erb_spec.rb b/spec/views/layouts/_header_application_links.html.erb_spec.rb index d4842e1c2e..4004d3e727 100644 --- a/spec/views/layouts/_header_application_links.html.erb_spec.rb +++ b/spec/views/layouts/_header_application_links.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "layouts/_header_application_links.html.erb" do +RSpec.describe "layouts/_header_application_links.html.erb" do include Gravatarify::Helper let(:call_to_action_label) { "Get two months free" } diff --git a/spec/views/practice/show.html.erb_spec.rb b/spec/views/practice/show.html.erb_spec.rb index d05d45a636..83d6636057 100644 --- a/spec/views/practice/show.html.erb_spec.rb +++ b/spec/views/practice/show.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "practice/show.html" do +RSpec.describe "practice/show.html" do context "when there is a promoted trail that the user has not started" do it "renders the promoted trail at the top with a promo message" do trail = build_stubbed_promoted_trail_with_progress diff --git a/spec/views/products/_forum.html.erb_spec.rb b/spec/views/products/_forum.html.erb_spec.rb index 86bb6cc4e6..796065939d 100644 --- a/spec/views/products/_forum.html.erb_spec.rb +++ b/spec/views/products/_forum.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "products/_forum_link" do +RSpec.describe "products/_forum_link" do context "with a user" do it "includes a link to the forum" do render partial: "products/forum_link", locals: {current_user: site_user} diff --git a/spec/views/products/shows/_show.html.erb_spec.rb b/spec/views/products/shows/_show.html.erb_spec.rb index dd9ce81f0d..a25868a08d 100644 --- a/spec/views/products/shows/_show.html.erb_spec.rb +++ b/spec/views/products/shows/_show.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "products/shows/_show.html.erb" do +RSpec.describe "products/shows/_show.html.erb" do it "includes published episodes count" do show = build_stubbed(:show) create_list(:video, 2, :published, watchable: show) diff --git a/spec/views/results/_flashcard.html.erb_spec.rb b/spec/views/results/_flashcard.html.erb_spec.rb index 394ad995ae..d16655c5a2 100644 --- a/spec/views/results/_flashcard.html.erb_spec.rb +++ b/spec/views/results/_flashcard.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "results/_flashcard.html.erb" do +RSpec.describe "results/_flashcard.html.erb" do context "when the user saved it for review" do it "indicates that the flashcard was saved for review" do user = double("user") diff --git a/spec/views/shared/_flashes.html.erb_spec.rb b/spec/views/shared/_flashes.html.erb_spec.rb index 288718f94e..b5a991dcdf 100644 --- a/spec/views/shared/_flashes.html.erb_spec.rb +++ b/spec/views/shared/_flashes.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "shared/_flashes.html.erb" do +RSpec.describe "shared/_flashes.html.erb" do context "when signed out" do before do view_stub_with_return( diff --git a/spec/views/teams/_team.html.erb_spec.rb b/spec/views/teams/_team.html.erb_spec.rb index 8546205e58..6c256ab806 100644 --- a/spec/views/teams/_team.html.erb_spec.rb +++ b/spec/views/teams/_team.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "teams/_team.html.erb" do +RSpec.describe "teams/_team.html.erb" do context "when user is team owner" do it "renders link to manage users" do team = build_stubbed(:team) diff --git a/spec/views/topics/_trail.html.erb_spec.rb b/spec/views/topics/_trail.html.erb_spec.rb index 3d306674aa..d56eb0f962 100644 --- a/spec/views/topics/_trail.html.erb_spec.rb +++ b/spec/views/topics/_trail.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "topics/_trail.html" do +RSpec.describe "topics/_trail.html" do context "with a just_finished trail" do it "renders as just_finished" do trail = stub_trail(complete: true, just_finished: true) diff --git a/spec/views/topics/show.html.erb_spec.rb b/spec/views/topics/show.html.erb_spec.rb index 3fa2911731..0fb0f8f1cd 100644 --- a/spec/views/topics/show.html.erb_spec.rb +++ b/spec/views/topics/show.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "topics/show" do +RSpec.describe "topics/show" do context "when there are published trails" do it "renders a section listing the trails" do trail_name = "A great trail" diff --git a/spec/views/trails/_completeable_preview.html.erb_spec.rb b/spec/views/trails/_completeable_preview.html.erb_spec.rb index da708c7d57..24574f5b46 100644 --- a/spec/views/trails/_completeable_preview.html.erb_spec.rb +++ b/spec/views/trails/_completeable_preview.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "trails/_completeable_preview.html" do +RSpec.describe "trails/_completeable_preview.html" do include TrailHelpers it "links to the completeable page" do diff --git a/spec/views/trails/_incomplete_trail.html.erb_spec.rb b/spec/views/trails/_incomplete_trail.html.erb_spec.rb index 61b1896e1f..7ca4cd6215 100644 --- a/spec/views/trails/_incomplete_trail.html.erb_spec.rb +++ b/spec/views/trails/_incomplete_trail.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "trails/_incomplete_trail.html" do +RSpec.describe "trails/_incomplete_trail.html" do context "for a trail with only videos" do it "renders a CTA link" do view_stubs(:current_user).and_return(Guest.new) diff --git a/spec/views/trails/_progress_dot.html.erb_spec.rb b/spec/views/trails/_progress_dot.html.erb_spec.rb index 6e34be9161..fd72e9346c 100644 --- a/spec/views/trails/_progress_dot.html.erb_spec.rb +++ b/spec/views/trails/_progress_dot.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "trails/_progress_dots" do +RSpec.describe "trails/_progress_dots" do include Rails.application.routes.url_helpers include TrailHelpers diff --git a/spec/views/trails/_repositories.html.erb_spec.rb b/spec/views/trails/_repositories.html.erb_spec.rb index f5d4115cf1..d5827966c4 100644 --- a/spec/views/trails/_repositories.html.erb_spec.rb +++ b/spec/views/trails/_repositories.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "trails/_repositories.html" do +RSpec.describe "trails/_repositories.html" do context "with repositories" do it "renders a link to each repository" do repositories = build_stubbed_list(:repository, 2) diff --git a/spec/views/trails/show.html.erb_spec.rb b/spec/views/trails/show.html.erb_spec.rb index 11f9a5b97e..1bf1abd9f0 100644 --- a/spec/views/trails/show.html.erb_spec.rb +++ b/spec/views/trails/show.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "trails/show.html.erb" do +RSpec.describe "trails/show.html.erb" do context "viewed by a visitor" do it "does not render the progress bar" do render_trail(signed_in: false) diff --git a/spec/views/twitter_player_cards/_meta.html.erb_spec.rb b/spec/views/twitter_player_cards/_meta.html.erb_spec.rb index ad7f86b0a3..62cbde088f 100644 --- a/spec/views/twitter_player_cards/_meta.html.erb_spec.rb +++ b/spec/views/twitter_player_cards/_meta.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "twitter_player_cards/_meta.html.erb" do +RSpec.describe "twitter_player_cards/_meta.html.erb" do it "renders Twitter Player Card meta tags" do name = "NBA" summary = "Bird steals the ball! Underneath to DJ and he lays it in!!!" diff --git a/spec/views/twitter_player_cards/show.html.erb_spec.rb b/spec/views/twitter_player_cards/show.html.erb_spec.rb index dfa00cde75..7c306bf155 100644 --- a/spec/views/twitter_player_cards/show.html.erb_spec.rb +++ b/spec/views/twitter_player_cards/show.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "twitter_player_cards/show.html.erb" do +RSpec.describe "twitter_player_cards/show.html.erb" do it "includes a video source" do preview_wistia_id = "abc123" video = double("video", preview_wistia_id: preview_wistia_id) diff --git a/spec/views/videos/_access_callout.html.erb_spec.rb b/spec/views/videos/_access_callout.html.erb_spec.rb index e68b4fe212..70bb72c77a 100644 --- a/spec/views/videos/_access_callout.html.erb_spec.rb +++ b/spec/views/videos/_access_callout.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "videos/_access_callout" do +RSpec.describe "videos/_access_callout" do context "when there is a preview available" do it "displays the 'preview' message and CTA" do video = build_stubbed(:video, :with_preview) diff --git a/spec/views/videos/_video_player.html.erb_spec.rb b/spec/views/videos/_video_player.html.erb_spec.rb index c0dbbf817e..f5737a4ec7 100644 --- a/spec/views/videos/_video_player.html.erb_spec.rb +++ b/spec/views/videos/_video_player.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "videos/_video_player" do +RSpec.describe "videos/_video_player" do include VideoHelpers describe "trail progress bar" do diff --git a/spec/views/videos/show.html.erb_spec.rb b/spec/views/videos/show.html.erb_spec.rb index 3edfbda08d..4d76a4a616 100644 --- a/spec/views/videos/show.html.erb_spec.rb +++ b/spec/views/videos/show.html.erb_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -describe "videos/show" do +RSpec.describe "videos/show" do include VideoHelpers it "sets the page title to the video title" do From 87e3a5c0a240e5166abf10114963f17c9c09127f Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Mon, 27 Oct 2025 11:56:02 -0600 Subject: [PATCH 02/30] upgrade to Ruby 3.4.7 --- .ruby-version | 2 +- .tool-versions | 2 +- Gemfile | 2 +- Gemfile.lock | 8 +++----- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.ruby-version b/.ruby-version index 9c25013dbb..2aa5131992 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.6 +3.4.7 diff --git a/.tool-versions b/.tool-versions index cbc003219c..ce930236b1 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,3 @@ nodejs 20.18.0 -ruby 3.3.6 +ruby 3.4.7 yarn 1.22.22 diff --git a/Gemfile b/Gemfile index 87abca9fdf..99374077e9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source "https://rubygems.org" -ruby "3.3.6" +ruby "3.4.7" git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" diff --git a/Gemfile.lock b/Gemfile.lock index 53c8ec536d..562ec3a294 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -170,9 +170,7 @@ GEM dotenv (= 3.1.7) railties (>= 6.1) drb (2.2.1) - dynamic_form (1.3.1) - actionview (> 5.2.0) - activemodel (> 5.2.0) + dynamic_form (1.2.0) em-websocket (0.5.2) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) @@ -694,7 +692,7 @@ DEPENDENCIES wrapped RUBY VERSION - ruby 3.3.6p108 + ruby 3.4.7p58 BUNDLED WITH - 2.5.23 + 2.7.2 From 9a2c408600c9406f9e8942e7386c9896da6f0c3f Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Mon, 27 Oct 2025 12:32:04 -0600 Subject: [PATCH 03/30] updated minor versions or minor gems in Gemfile; RSpec still passes --- Gemfile | 5 +- Gemfile.lock | 322 +++++++++++++++++++++++++++------------------------ 2 files changed, 173 insertions(+), 154 deletions(-) diff --git a/Gemfile b/Gemfile index 99374077e9..cf61fb867e 100644 --- a/Gemfile +++ b/Gemfile @@ -14,6 +14,7 @@ gem "bootsnap" gem "bourbon" gem "clearance" gem "coffee-rails" +gem "concurrent-ruby", "1.3.4" gem "csv" gem "delayed_job_active_record" gem "drb" @@ -35,7 +36,7 @@ gem "logger" gem "mime-types" gem "mimemagic" gem "mutex_m" -gem "neat" +gem "neat", "< 2.0" gem "net-imap", ">= 0.5.7" gem "nokogiri", ">= 1.18.8" gem "octokit" @@ -74,7 +75,7 @@ group :development do gem "guard-livereload", require: false gem "rack-livereload" gem "rack-mini-profiler", require: false - gem "spring" + gem "spring", "~> 4.2.1" gem "spring-commands-rspec" gem "webrick" end diff --git a/Gemfile.lock b/Gemfile.lock index 562ec3a294..d33f8c06f8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -71,37 +71,40 @@ GEM i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - acts_as_list (1.2.4) + acts_as_list (1.2.6) activerecord (>= 6.1) activesupport (>= 6.1) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) - argon2 (2.3.0) + argon2 (2.3.2) ffi (~> 1.15) ffi-compiler (~> 1.0) - ast (2.4.2) - autoprefixer-rails (10.4.19.0) + ast (2.4.3) + autoprefixer-rails (10.4.21.0) execjs (~> 2) - aws-eventstream (1.3.0) - aws-partitions (1.1015.0) - aws-sdk-core (3.214.0) + aws-eventstream (1.4.0) + aws-partitions (1.1177.0) + aws-sdk-core (3.235.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) + base64 + bigdecimal jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.96.0) - aws-sdk-core (~> 3, >= 3.210.0) + logger + aws-sdk-kms (1.115.0) + aws-sdk-core (~> 3, >= 3.234.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.175.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-s3 (1.201.0) + aws-sdk-core (~> 3, >= 3.234.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sigv4 (1.10.1) + aws-sigv4 (1.12.1) aws-eventstream (~> 1, >= 1.0.2) - base64 (0.2.0) + base64 (0.3.0) bcrypt (3.1.20) - bigdecimal (3.1.9) - bootsnap (1.18.4) + bigdecimal (3.3.1) + bootsnap (1.18.6) msgpack (~> 1.2) bourbon (7.3.0) thor (~> 1.0) @@ -127,7 +130,7 @@ GEM activesupport childprocess (5.1.0) logger (~> 1.5) - clearance (2.9.3) + clearance (2.11.0) actionmailer (>= 5.0) activemodel (>= 5.0) activerecord (>= 5.0) @@ -145,17 +148,17 @@ GEM execjs coffee-script-source (1.12.2) concurrent-ruby (1.3.4) - connection_pool (2.4.1) - crack (1.0.0) + connection_pool (2.5.4) + crack (1.0.1) bigdecimal rexml crass (1.0.6) - csv (3.3.2) + csv (3.3.5) database_cleaner (2.1.0) database_cleaner-active_record (>= 2, < 3) - database_cleaner-active_record (2.2.0) + database_cleaner-active_record (2.2.2) activerecord (>= 5.a) - database_cleaner-core (~> 2.0.0) + database_cleaner-core (~> 2.0) database_cleaner-core (2.0.1) date (3.4.1) delayed_job (4.1.13) @@ -163,17 +166,17 @@ GEM delayed_job_active_record (4.1.11) activerecord (>= 3.0, < 9.0) delayed_job (>= 3.0, < 5) - diff-lcs (1.5.1) - docile (1.4.0) - dotenv (3.1.7) - dotenv-rails (3.1.7) - dotenv (= 3.1.7) + diff-lcs (1.6.2) + docile (1.4.1) + dotenv (3.1.8) + dotenv-rails (3.1.8) + dotenv (= 3.1.8) railties (>= 6.1) - drb (2.2.1) + drb (2.2.3) dynamic_form (1.2.0) - em-websocket (0.5.2) + em-websocket (0.5.3) eventmachine (>= 0.12.9) - http_parser.rb (~> 0.6.0) + http_parser.rb (~> 0) email_spec (2.3.0) htmlentities (~> 4.3.3) launchy (>= 2.1, < 4.0) @@ -182,46 +185,49 @@ GEM activemodel erubi (1.13.1) eventmachine (1.2.7) - execjs (2.9.1) - factory_bot (6.5.0) - activesupport (>= 5.0.0) - factory_bot_rails (6.4.4) + execjs (2.10.0) + factory_bot (6.5.6) + activesupport (>= 6.1.0) + factory_bot_rails (6.5.1) factory_bot (~> 6.5) - railties (>= 5.0.0) - faraday (2.12.0) - faraday-net_http (>= 2.0, < 3.4) + railties (>= 6.1.0) + faraday (2.14.0) + faraday-net_http (>= 2.0, < 3.5) json logger - faraday-multipart (1.1.0) + faraday-multipart (1.1.1) multipart-post (~> 2.0) - faraday-net_http (3.3.0) - net-http - faraday-retry (2.2.1) + faraday-net_http (3.4.1) + net-http (>= 0.5.0) + faraday-retry (2.3.2) faraday (~> 2.0) - ffi (1.17.0) - ffi (1.17.0-x86_64-darwin) - ffi (1.17.0-x86_64-linux-gnu) + ffi (1.17.2) + ffi (1.17.2-x86_64-darwin) + ffi (1.17.2-x86_64-linux-gnu) ffi-compiler (1.3.2) ffi (>= 1.15.5) rake - flutie (2.2.0) + flutie (2.2.1) font-awesome-rails (4.7.0.9) railties (>= 3.2, < 9.0) - formatador (0.2.5) + formatador (1.2.1) + reline formtastic (5.0.0) actionpack (>= 6.0.0) friendly_id (5.5.1) activerecord (>= 4.0.0) - globalid (1.2.1) + globalid (1.3.0) activesupport (>= 6.1) gravatarify (3.1.1) - guard (2.16.2) + guard (2.19.1) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) + logger (~> 1.6) lumberjack (>= 1.0.12, < 2.0) nenv (~> 0.1) notiffany (~> 0.0) - pry (>= 0.9.12) + ostruct (~> 0.6) + pry (>= 0.13.0) shellany (~> 0.0) thor (>= 0.18.1) guard-compat (1.2.1) @@ -230,26 +236,27 @@ GEM guard (~> 2.8) guard-compat (~> 1.0) multi_json (~> 1.8) - hashdiff (1.1.1) + hashdiff (1.2.1) hashie (5.0.0) high_voltage (4.0.0) htmlentities (4.3.4) - http_parser.rb (0.6.0) - i18n (1.14.6) + http_parser.rb (0.8.0) + i18n (1.14.7) concurrent-ruby (~> 1.0) inline_svg (1.10.0) activesupport (>= 3.0) nokogiri (>= 1.6) + io-console (0.8.1) jmespath (1.6.2) - jquery-rails (4.6.0) + jquery-rails (4.6.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (7.0.0) railties (>= 3.2.16) - json (2.9.0) + json (2.15.2) jsonapi-renderer (0.2.2) - jwt (2.8.1) + jwt (3.1.2) base64 kaminari (1.2.2) activesupport (>= 4.1.0) @@ -263,84 +270,89 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) - language_server-protocol (3.17.0.3) - launchy (3.0.1) + language_server-protocol (3.17.0.5) + launchy (3.1.1) addressable (~> 2.8) childprocess (~> 5.0) + logger (~> 1.6) lint_roller (1.1.0) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) lodash-rails (4.17.21) railties (>= 3.1) - logger (1.6.4) - loofah (2.23.1) + logger (1.7.0) + loofah (2.24.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) - lumberjack (1.2.8) - mail (2.8.1) + lumberjack (1.4.2) + mail (2.9.0) + logger mini_mime (>= 0.1.1) net-imap net-pop net-smtp - marcel (1.0.4) - matrix (0.4.2) + marcel (1.1.0) + matrix (0.4.3) method_source (1.1.0) - mime-types (3.6.0) + mime-types (3.7.0) logger - mime-types-data (~> 3.2015) - mime-types-data (3.2024.1001) + mime-types-data (~> 3.2025, >= 3.2025.0507) + mime-types-data (3.2025.0924) mimemagic (0.3.10) nokogiri (~> 1) rake mini_mime (1.1.5) mini_portile2 (2.8.9) - minitest (5.25.4) - msgpack (1.7.2) - multi_json (1.15.0) - multi_xml (0.6.0) + minitest (5.26.0) + msgpack (1.8.0) + multi_json (1.17.0) + multi_xml (0.7.2) + bigdecimal (~> 3.1) multipart-post (2.4.1) - mustermann (3.0.0) + mustermann (3.0.4) ruby2_keywords (~> 0.0.1) mutex_m (0.3.0) neat (1.7.4) bourbon (>= 4.0) sass (>= 3.3) nenv (0.3.0) - net-http (0.5.0) + net-http (0.6.0) uri - net-imap (0.5.9) + net-imap (0.5.12) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol nio4r (2.7.4) - nokogiri (1.18.8) + nokogiri (1.18.10) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.18.8-x86_64-darwin) + nokogiri (1.18.10-x86_64-darwin) racc (~> 1.4) - nokogiri (1.18.8-x86_64-linux-gnu) + nokogiri (1.18.10-x86_64-linux-gnu) racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) - oauth2 (2.0.9) - faraday (>= 0.17.3, < 3.0) - jwt (>= 1.0, < 3.0) + oauth2 (2.0.17) + faraday (>= 0.17.3, < 4.0) + jwt (>= 1.0, < 4.0) + logger (~> 1.2) multi_xml (~> 0.5) rack (>= 1.2, < 4) - snaky_hash (~> 2.0) - version_gem (~> 1.1) + snaky_hash (~> 2.0, >= 2.0.3) + version_gem (~> 1.1, >= 1.1.9) octokit (9.2.0) faraday (>= 1, < 3) sawyer (~> 0.9) - omniauth (2.1.2) + omniauth (2.1.4) hashie (>= 3.4.6) + logger rack (>= 2.2.3) rack-protection omniauth-github (2.0.1) @@ -352,32 +364,35 @@ GEM omniauth-rails_csrf_protection (1.0.2) actionpack (>= 4.2) omniauth (~> 2.0) - ostruct (0.6.1) + ostruct (0.6.3) paperclip (6.1.0) activemodel (>= 4.2.0) activesupport (>= 4.2.0) mime-types mimemagic (~> 0.3.0) terrapin (~> 0.6.0) - parallel (1.26.3) - parser (3.3.6.0) + parallel (1.27.0) + parser (3.3.10.0) ast (~> 2.4.1) racc - pg (1.5.9) + pg (1.6.2) + pg (1.6.2-x86_64-darwin) + pg (1.6.2-x86_64-linux) pg_search (2.3.7) activerecord (>= 6.1) activesupport (>= 6.1) - pry (0.14.2) + prism (1.6.0) + pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) - psych (5.2.2) + psych (5.2.6) date stringio - public_suffix (6.0.1) + public_suffix (6.0.2) puma (6.5.0) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.17) + rack (2.2.20) rack-cors (2.0.2) rack (>= 2.0.0) rack-livereload (0.5.2) @@ -388,7 +403,7 @@ GEM base64 (>= 0.1.0) rack (~> 2.2, >= 2.2.4) rack-rewrite (1.5.1) - rack-test (2.1.0) + rack-test (2.2.0) rack (>= 1.3) rails (7.0.8.7) actioncable (= 7.0.8.7) @@ -408,7 +423,7 @@ GEM actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.2.0) + rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) @@ -424,33 +439,35 @@ GEM thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) - rake (13.2.1) + rake (13.3.0) rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) recipient_interceptor (0.3.3) mail - redcarpet (3.6.0) - redis (5.3.0) + redcarpet (3.6.1) + redis (5.4.1) redis-client (>= 0.22.0) - redis-client (0.22.2) + redis-client (0.26.1) connection_pool - regexp_parser (2.9.3) + regexp_parser (2.11.3) + reline (0.6.2) + io-console (~> 0.5) request_store (1.7.0) rack (>= 1.4) - responders (3.1.1) - actionpack (>= 5.2) - railties (>= 5.2) - rexml (3.4.1) - rspec-core (3.13.2) + responders (3.2.0) + actionpack (>= 7.0) + railties (>= 7.0) + rexml (3.4.4) + rspec-core (3.13.6) rspec-support (~> 3.13.0) - rspec-expectations (3.13.3) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.2) + rspec-mocks (3.13.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (7.1.0) + rspec-rails (7.1.1) actionpack (>= 7.0) activesupport (>= 7.0) railties (>= 7.0) @@ -458,27 +475,30 @@ GEM rspec-expectations (~> 3.13) rspec-mocks (~> 3.13) rspec-support (~> 3.13) - rspec-support (3.13.1) + rspec-support (3.13.6) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.69.2) + 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.9.3, < 3.0) - rubocop-ast (>= 1.36.2, < 2.0) + rubocop-ast (>= 1.46.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.37.0) - parser (>= 3.3.1.0) - rubocop-performance (1.23.0) - rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) + rubocop-ast (1.47.1) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-performance (1.25.0) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - rubyzip (2.4.1) + rubyzip (3.2.1) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) @@ -492,48 +512,48 @@ GEM sprockets (> 3.0) sprockets-rails tilt - sawyer (0.9.2) + sawyer (0.9.3) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) - scenic (1.8.0) + scenic (1.9.0) activerecord (>= 4.0.0) railties (>= 4.0.0) - selenium-webdriver (4.29.1) + selenium-webdriver (4.38.0) base64 (~> 0.2) logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2, < 3.0) + rubyzip (>= 1.2.2, < 4.0) websocket (~> 1.0) - sentry-rails (5.22.0) - railties (>= 5.0) - sentry-ruby (~> 5.22.0) - sentry-ruby (5.22.1) + sentry-rails (6.0.0) + railties (>= 5.2.0) + sentry-ruby (~> 6.0.0) + sentry-ruby (6.0.0) bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) shellany (0.0.1) - shoulda-matchers (6.4.0) + shoulda-matchers (6.5.0) activesupport (>= 5.2.0) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) + simplecov-html (0.13.2) simplecov_json_formatter (0.1.4) - simpleidn (0.2.2) - unf (~> 0.1.4) + simpleidn (0.2.3) sinatra (3.2.0) mustermann (~> 3.0) rack (~> 2.2, >= 2.2.4) rack-protection (= 3.2.0) tilt (~> 2.0) - snaky_hash (2.0.1) - hashie - version_gem (~> 1.1, >= 1.1.1) + snaky_hash (2.0.3) + hashie (>= 0.1.0, < 6) + version_gem (>= 1.1.8, < 3) spring (4.2.1) spring-commands-rspec (1.0.4) spring (>= 0.9.1) - sprockets (4.2.1) + sprockets (4.2.2) concurrent-ruby (~> 1.0) + logger rack (>= 2.2.4, < 4) sprockets-rails (3.5.2) actionpack (>= 6.1) @@ -542,44 +562,41 @@ GEM sprockets-redirect (1.0.0) activesupport (>= 3.1.0) rack - stackprof (0.2.26) - standard (1.43.0) + stackprof (0.2.27) + standard (1.51.1) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.69.1) + rubocop (~> 1.80.2) standard-custom (~> 1.0.0) - standard-performance (~> 1.6) + standard-performance (~> 1.8) standard-custom (1.0.2) lint_roller (~> 1.0) rubocop (~> 1.50) - standard-performance (1.6.0) + standard-performance (1.8.0) lint_roller (~> 1.1) - rubocop-performance (~> 1.23.0) - stringio (3.1.2) + rubocop-performance (~> 1.25.0) + stringio (3.1.7) terrapin (0.6.0) climate_control (>= 0.0.3, < 1.0) - thor (1.3.2) - tilt (2.3.0) + thor (1.4.0) + tilt (2.6.1) timecop (0.9.10) timeout (0.4.3) tzinfo (2.0.6) concurrent-ruby (~> 1.0) uglifier (4.2.1) execjs (>= 0.3.0, < 3) - unf (0.1.4) - unf_ext - unf_ext (0.0.9.1) - unicode-display_width (3.1.2) - unicode-emoji (~> 4.0, >= 4.0.4) - unicode-emoji (4.0.4) - uri (1.0.3) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.1.0) + uri (1.0.4) validates_email_format_of (1.8.2) i18n (>= 0.8.0) simpleidn vanity (4.0.4) i18n - version_gem (1.1.4) - webmock (3.24.0) + version_gem (1.1.9) + webmock (3.26.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -591,7 +608,7 @@ GEM wrapped (0.1.0) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.7.1) + zeitwerk (2.7.3) PLATFORMS ruby @@ -612,6 +629,7 @@ DEPENDENCIES clearance climate_control coffee-rails + concurrent-ruby (= 1.3.4) csv database_cleaner delayed_job_active_record @@ -639,7 +657,7 @@ DEPENDENCIES mime-types mimemagic mutex_m - neat + neat (< 2.0) net-imap (>= 0.5.7) nokogiri (>= 1.18.8) octokit @@ -677,7 +695,7 @@ DEPENDENCIES shoulda-matchers simplecov sinatra - spring + spring (~> 4.2.1) spring-commands-rspec sprockets-rails sprockets-redirect From efac88c116463680b3a8295bbd1728bcbe566ecb Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:44:47 -0600 Subject: [PATCH 04/30] address StandardRB linting issues --- app/models/flashcard.rb | 1 + app/models/video.rb | 2 +- spec/controllers/memberships_controller_spec.rb | 5 +---- spec/helpers/trails_helper_spec.rb | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/models/flashcard.rb b/app/models/flashcard.rb index bb0bbbbe7b..38c435dc6a 100644 --- a/app/models/flashcard.rb +++ b/app/models/flashcard.rb @@ -1,5 +1,6 @@ class Flashcard < ApplicationRecord include PgSearch::Model + multisearchable against: [:title, :prompt, :answer], if: :search_visible? validates :title, presence: true diff --git a/app/models/video.rb b/app/models/video.rb index 96beedd24d..76bcfb8a5c 100644 --- a/app/models/video.rb +++ b/app/models/video.rb @@ -1,7 +1,7 @@ class Video < ApplicationRecord extend FriendlyId - include PgSearch::Model + multisearchable against: [:name, :summary, :notes], if: :search_visible? belongs_to :watchable, polymorphic: true, optional: true diff --git a/spec/controllers/memberships_controller_spec.rb b/spec/controllers/memberships_controller_spec.rb index 50c9518e79..fa034a4742 100644 --- a/spec/controllers/memberships_controller_spec.rb +++ b/spec/controllers/memberships_controller_spec.rb @@ -54,10 +54,7 @@ def remove_other_user_from_team user_to_remove = create(:user, :with_github) - if @controller.current_user&.team - @controller.current_user.team.add_user(user_to_remove) - end - + @controller.current_user&.team&.add_user(user_to_remove) delete :destroy, params: {id: user_to_remove} end end diff --git a/spec/helpers/trails_helper_spec.rb b/spec/helpers/trails_helper_spec.rb index 9ae369e85e..c1ac853396 100644 --- a/spec/helpers/trails_helper_spec.rb +++ b/spec/helpers/trails_helper_spec.rb @@ -95,7 +95,7 @@ page = Capybara.string(helper.auth_to_access_button(video)) expect(page).to have_button(I18n.t("trails.start_for_free")) - expect(page).to have_css("form") { _1["action"] == "/fake/auth/path" } + expect(page).to have_css("form") { it["action"] == "/fake/auth/path" } end it "can override CTA" do From 12ec0283cecc3c1d5a190eac4c28dda51e68c3b3 Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:48:12 -0600 Subject: [PATCH 05/30] finish updating gems as far as possible under Rails 7.0 --- Gemfile | 4 +++- Gemfile.lock | 42 +++++++++++++++++++++++++++++------------- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index cf61fb867e..61a86b26d8 100644 --- a/Gemfile +++ b/Gemfile @@ -36,7 +36,7 @@ gem "logger" gem "mime-types" gem "mimemagic" gem "mutex_m" -gem "neat", "< 2.0" +gem "neat" gem "net-imap", ">= 0.5.7" gem "nokogiri", ">= 1.18.8" gem "octokit" @@ -73,6 +73,7 @@ gem "wrapped" group :development do gem "guard-livereload", require: false + gem "irb" gem "rack-livereload" gem "rack-mini-profiler", require: false gem "spring", "~> 4.2.1" @@ -81,6 +82,7 @@ group :development do end group :development, :test do + gem "benchmark" gem "bundler-audit", require: false gem "dotenv-rails" gem "rspec-rails" diff --git a/Gemfile.lock b/Gemfile.lock index d33f8c06f8..4066449b6c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -103,6 +103,7 @@ GEM aws-eventstream (~> 1, >= 1.0.2) base64 (0.3.0) bcrypt (3.1.20) + benchmark (0.5.0) bigdecimal (3.3.1) bootsnap (1.18.6) msgpack (~> 1.2) @@ -138,7 +139,8 @@ GEM bcrypt (>= 3.1.1) email_validator (~> 2.0) railties (>= 5.0) - climate_control (0.2.0) + climate_control (1.2.0) + cocaine (0.4.2) coderay (1.1.3) coffee-rails (5.0.0) coffee-script (>= 2.2.0) @@ -183,6 +185,7 @@ GEM mail (~> 2.7) email_validator (2.2.4) activemodel + erb (5.1.1) erubi (1.13.1) eventmachine (1.2.7) execjs (2.10.0) @@ -247,6 +250,10 @@ GEM 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) jmespath (1.6.2) jquery-rails (4.6.1) rails-dom-testing (>= 1, < 3) @@ -347,7 +354,7 @@ GEM rack (>= 1.2, < 4) snaky_hash (~> 2.0, >= 2.0.3) version_gem (~> 1.1, >= 1.1.9) - octokit (9.2.0) + octokit (10.0.0) faraday (>= 1, < 3) sawyer (~> 0.9) omniauth (2.1.4) @@ -365,12 +372,12 @@ GEM actionpack (>= 4.2) omniauth (~> 2.0) ostruct (0.6.3) - paperclip (6.1.0) - activemodel (>= 4.2.0) - activesupport (>= 4.2.0) + paperclip (3.4.0) + activemodel (>= 3.0.0) + activerecord (>= 3.0.0) + activesupport (>= 3.0.0) + cocaine (~> 0.4.0) mime-types - mimemagic (~> 0.3.0) - terrapin (~> 0.6.0) parallel (1.27.0) parser (3.3.10.0) ast (~> 2.4.1) @@ -381,6 +388,9 @@ GEM pg_search (2.3.7) activerecord (>= 6.1) activesupport (>= 6.1) + pp (0.6.3) + prettyprint + prettyprint (0.2.0) prism (1.6.0) pry (0.15.2) coderay (~> 1.1) @@ -389,7 +399,7 @@ GEM date stringio public_suffix (6.0.2) - puma (6.5.0) + puma (7.1.0) nio4r (~> 2.0) racc (1.8.1) rack (2.2.20) @@ -397,7 +407,7 @@ GEM rack (>= 2.0.0) rack-livereload (0.5.2) rack (< 3) - rack-mini-profiler (3.3.1) + rack-mini-profiler (4.0.1) rack (>= 1.2.0) rack-protection (3.2.0) base64 (>= 0.1.0) @@ -443,6 +453,10 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) + rdoc (6.15.0) + erb + psych (>= 4.0.0) + tsort recipient_interceptor (0.3.3) mail redcarpet (3.6.1) @@ -576,12 +590,11 @@ GEM lint_roller (~> 1.1) rubocop-performance (~> 1.25.0) stringio (3.1.7) - terrapin (0.6.0) - climate_control (>= 0.0.3, < 1.0) thor (1.4.0) tilt (2.6.1) timecop (0.9.10) timeout (0.4.3) + tsort (0.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) uglifier (4.2.1) @@ -602,7 +615,8 @@ GEM hashdiff (>= 0.4.0, < 2.0.0) webrick (1.9.1) websocket (1.2.11) - websocket-driver (0.7.6) + websocket-driver (0.8.0) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) wrapped (0.1.0) @@ -620,6 +634,7 @@ DEPENDENCIES acts_as_list autoprefixer-rails aws-sdk-s3 + benchmark bootsnap bourbon bundler-audit @@ -648,6 +663,7 @@ DEPENDENCIES guard-livereload high_voltage inline_svg + irb jquery-rails jquery-ui-rails kaminari @@ -657,7 +673,7 @@ DEPENDENCIES mime-types mimemagic mutex_m - neat (< 2.0) + neat net-imap (>= 0.5.7) nokogiri (>= 1.18.8) octokit From 4d418a96675add2254874d7c8bce328d6bceb7c0 Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Mon, 27 Oct 2025 13:57:02 -0600 Subject: [PATCH 06/30] make sure at the end of Rails 7.0 --- Gemfile | 2 +- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 61a86b26d8..c5a672e15d 100644 --- a/Gemfile +++ b/Gemfile @@ -51,7 +51,7 @@ gem "psych" gem "puma" gem "rack", ">= 2.2.14", "< 3.0" gem "rack-rewrite" -gem "rails", "7.0.8.7" +gem "rails", ">= 7.0.8.7", "< 7.1" gem "recipient_interceptor" gem "redcarpet" gem "redis" diff --git a/Gemfile.lock b/Gemfile.lock index 4066449b6c..d91ee8cbf5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -691,7 +691,7 @@ DEPENDENCIES rack-livereload rack-mini-profiler rack-rewrite - rails (= 7.0.8.7) + rails (>= 7.0.8.7, < 7.1) rails-controller-testing rails_stdout_logging recipient_interceptor From c64d20510319d1742eafd373b7c24cb6f7e76233 Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Wed, 29 Oct 2025 08:27:28 -0600 Subject: [PATCH 07/30] break down factories --- spec/factories.rb | 288 ---------------------- spec/factories/attempts.rb | 7 + spec/factories/classifications.rb | 6 + spec/factories/content_recommendations.rb | 6 + spec/factories/decks.rb | 6 + spec/factories/exercises.rb | 12 + spec/factories/flashcards.rb | 8 + spec/factories/invitations.rb | 16 ++ spec/factories/markers.rb | 7 + spec/factories/products.rb | 33 +++ spec/factories/recommendable_content.rb | 6 + spec/factories/statuses.rb | 14 ++ spec/factories/steps.rb | 7 + spec/factories/teachers.rb | 6 + spec/factories/teams.rb | 8 + spec/factories/topics.rb | 15 ++ spec/factories/trails.rb | 47 ++++ spec/factories/users.rb | 33 +++ spec/factories/videos.rb | 32 +++ 19 files changed, 269 insertions(+), 288 deletions(-) delete mode 100644 spec/factories.rb create mode 100644 spec/factories/attempts.rb create mode 100644 spec/factories/classifications.rb create mode 100644 spec/factories/content_recommendations.rb create mode 100644 spec/factories/decks.rb create mode 100644 spec/factories/exercises.rb create mode 100644 spec/factories/flashcards.rb create mode 100644 spec/factories/invitations.rb create mode 100644 spec/factories/markers.rb create mode 100644 spec/factories/products.rb create mode 100644 spec/factories/recommendable_content.rb create mode 100644 spec/factories/statuses.rb create mode 100644 spec/factories/steps.rb create mode 100644 spec/factories/teachers.rb create mode 100644 spec/factories/teams.rb create mode 100644 spec/factories/topics.rb create mode 100644 spec/factories/trails.rb create mode 100644 spec/factories/users.rb create mode 100644 spec/factories/videos.rb diff --git a/spec/factories.rb b/spec/factories.rb deleted file mode 100644 index b67b6959ba..0000000000 --- a/spec/factories.rb +++ /dev/null @@ -1,288 +0,0 @@ -FactoryBot.use_parent_strategy = false - -FactoryBot.define do - sequence :bio do |n| - "The Amazing Brian the #{n}th" - end - - sequence :code do |n| - "code#{n}" - end - - sequence :email do |n| - "user#{n}@example.com" - end - - sequence :name do |n| - "name #{n}" - end - - sequence :uuid do |n| - "uuid_#{n}" - end - - sequence :github_username do |n| - "github_#{n}" - end - - sequence :tagline do |n| - "tagline #{n}" - end - - sequence :title do |n| - "title #{n}" - end - - sequence :external_url do |n| - "http://robots.thoughtbot.com/#{n}" - end - - factory :classification do - association :classifiable, factory: :product - topic - end - - factory :product, traits: [:active], class: "Show" do - after(:stub) { |product| product.slug = product.name.parameterize } - description { "Solve 8-Queens over and over again" } - tagline - - trait :active do - active { true } - end - - trait :inactive do - active { false } - end - - trait :promoted do - promoted { true } - end - - name { generate(:name) } - sku { "TEST" } - - factory :show, class: "Show" do - factory :the_weekly_iteration do - name { Show::THE_WEEKLY_ITERATION } - end - end - - factory :repository, class: "Repository" do - github_repository { "thoughtbot/upcase" } - github_url { "https://github.com/thoughtbot/upcase" } - end - end - - factory :invitation, class: "Invitation" do - email - sender factory: :user - team - - after :stub do |invitation| - invitation.code = "abc" - end - - trait :accepted do - recipient factory: :user - accepted_at { Time.current } - end - end - - factory :team, class: "Team" do - owner factory: :user - name { "Google" } - end - - factory :teacher do - user - video - end - - factory :topic do - name - page_title { "Learn #{name}" } - summary { "short yet descriptive" } - - trait :explorable do - explorable { true } - end - - after :stub do |topic| - topic.slug ||= topic.name.parameterize - end - end - - factory :user do - email - name - password { "password" } - github_username - - factory :admin do - admin { true } - end - - trait :admin do - admin { true } - end - - trait :with_github do - github_username - end - - trait :with_attached_team do - team - after(:create) do |user| - user.team.update(owner: user) - end - end - - trait :with_github_auth do - github_username - auth_provider { "github" } - auth_uid { 1 } - end - end - - factory :video, aliases: [:recommendable] do - association :watchable, factory: :show - sequence(:name) { |n| "Video #{n}" } - wistia_id { "1194803" } - published_on { 1.day.from_now } - - trait :published do - published_on { 1.day.ago } - end - - trait :with_trail do - after :create do |video| - create(:step, trail: create(:trail), completeable: video) - end - end - - trait :with_progress do - state { Status::UNSTARTED } - - initialize_with do - CompleteableWithProgress.new(new(attributes.except(:state)), state) - end - end - - trait :with_preview do - sequence(:preview_wistia_id) { |n| "preview-#{n}" } - end - - after(:stub) { |video| video.slug = video.id.to_s } - end - - factory :exercise do - transient do - slug { name.downcase.gsub(/\s+/, "-") } - end - - summary { "Exercise summary" } - sequence(:name) { |n| "Exercise #{n}" } - url { "http://localhost:7000/exercises/#{slug}" } - uuid - end - - factory :status do - user - association :completeable, factory: :exercise - - trait :in_progress do - state { Status::IN_PROGRESS } - end - - trait :completed do - state { Status::COMPLETE } - end - end - - factory :trail do - sequence(:name) { |n| "Trail number #{n}" } - description { "Trail description" } - complete_text { "Way to go!" } - - trait :with_topic do - after(:build) do |trail| - trail.topics = [build(:topic)] - end - end - - trait :published do - published { true } - end - - trait :promoted do - promoted { true } - end - - trait :unpublished do - published { false } - end - - trait :completed do - after :create do |instance| - Timecop.travel(1.week.ago) do - create(:status, :completed, completeable: instance) - end - end - end - - trait :video do - after :create do |trail| - video = create(:video, watchable: nil) - create(:step, trail: trail, completeable: video) - end - end - - trait :with_sample_video do - after :create do |trail| - video = create(:video, watchable: nil) - create(:step, trail: trail, completeable: video) - end - end - end - - factory :step do - association :completeable, factory: :exercise - trail - sequence(:position) { |n| n } - end - - factory :deck do - title - published { true } - end - - factory :flashcard do - sequence(:title) { |n| "Flashcard Title #{n}" } - prompt { "How could you avoid testing for nil in these lines" } - answer { "Use the Null Object pattern!" } - deck - end - - factory :attempt do - confidence { 3 } - flashcard - user - end - - factory :marker do - video - anchor { "configuration-options" } - time { 322 } - end - - factory :content_recommendation do - recommendable - user - end - - factory :recommendable_content do - sequence(:position) - recommendable - end -end diff --git a/spec/factories/attempts.rb b/spec/factories/attempts.rb new file mode 100644 index 0000000000..62cb50394e --- /dev/null +++ b/spec/factories/attempts.rb @@ -0,0 +1,7 @@ +FactoryBot.define do + factory :attempt do + confidence { 3 } + flashcard + user + end +end diff --git a/spec/factories/classifications.rb b/spec/factories/classifications.rb new file mode 100644 index 0000000000..f3da41458b --- /dev/null +++ b/spec/factories/classifications.rb @@ -0,0 +1,6 @@ +FactoryBot.define do + factory :classification do + association :classifiable, factory: :product + topic + end +end diff --git a/spec/factories/content_recommendations.rb b/spec/factories/content_recommendations.rb new file mode 100644 index 0000000000..f42f8342e6 --- /dev/null +++ b/spec/factories/content_recommendations.rb @@ -0,0 +1,6 @@ +FactoryBot.define do + factory :content_recommendation do + recommendable + user + end +end diff --git a/spec/factories/decks.rb b/spec/factories/decks.rb new file mode 100644 index 0000000000..91911cb6b3 --- /dev/null +++ b/spec/factories/decks.rb @@ -0,0 +1,6 @@ +FactoryBot.define do + factory :deck do + sequence(:title) { |n| "Deck title #{n}" } + published { true } + end +end diff --git a/spec/factories/exercises.rb b/spec/factories/exercises.rb new file mode 100644 index 0000000000..30c8cbf7b2 --- /dev/null +++ b/spec/factories/exercises.rb @@ -0,0 +1,12 @@ +FactoryBot.define do + factory :exercise do + transient do + slug { name.downcase.gsub(/\s+/, "-") } + end + + summary { "Exercise summary" } + sequence(:name) { |n| "Exercise #{n}" } + url { "http://localhost:7000/exercises/#{slug}" } + sequence(:uuid) { |n| "exercise_uuid_#{n}" } + end +end diff --git a/spec/factories/flashcards.rb b/spec/factories/flashcards.rb new file mode 100644 index 0000000000..29f3992d0c --- /dev/null +++ b/spec/factories/flashcards.rb @@ -0,0 +1,8 @@ +FactoryBot.define do + factory :flashcard do + sequence(:title) { |n| "Flashcard Title #{n}" } + prompt { "How could you avoid testing for nil in these lines" } + answer { "Use the Null Object pattern!" } + deck + end +end diff --git a/spec/factories/invitations.rb b/spec/factories/invitations.rb new file mode 100644 index 0000000000..d3cb28b32b --- /dev/null +++ b/spec/factories/invitations.rb @@ -0,0 +1,16 @@ +FactoryBot.define do + factory :invitation, class: "Invitation" do + sequence(:email) { |n| "invitee#{n}@example.com" } + sender factory: :user + team + + after :stub do |invitation| + invitation.code = "abc" + end + + trait :accepted do + recipient factory: :user + accepted_at { Time.current } + end + end +end diff --git a/spec/factories/markers.rb b/spec/factories/markers.rb new file mode 100644 index 0000000000..a99a22a6b2 --- /dev/null +++ b/spec/factories/markers.rb @@ -0,0 +1,7 @@ +FactoryBot.define do + factory :marker do + video + anchor { "configuration-options" } + time { 322 } + end +end diff --git a/spec/factories/products.rb b/spec/factories/products.rb new file mode 100644 index 0000000000..712a09b16a --- /dev/null +++ b/spec/factories/products.rb @@ -0,0 +1,33 @@ +FactoryBot.define do + factory :product, traits: [:active], class: "Show" do + sequence(:name) { |n| "Product #{n}" } + description { "Solve 8-Queens over and over again" } + sequence(:tagline) { |n| "Product tagline #{n}" } + sku { "TEST" } + + trait :active do + active { true } + end + + trait :inactive do + active { false } + end + + trait :promoted do + promoted { true } + end + + factory :show, class: "Show" do + factory :the_weekly_iteration do + name { Show::THE_WEEKLY_ITERATION } + end + end + + factory :repository, class: "Repository" do + github_repository { "thoughtbot/upcase" } + github_url { "https://github.com/thoughtbot/upcase" } + end + + after(:stub) { |product| product.slug = product.name.parameterize } + end +end diff --git a/spec/factories/recommendable_content.rb b/spec/factories/recommendable_content.rb new file mode 100644 index 0000000000..d205445dc9 --- /dev/null +++ b/spec/factories/recommendable_content.rb @@ -0,0 +1,6 @@ +FactoryBot.define do + factory :recommendable_content do + sequence(:position) + recommendable + end +end diff --git a/spec/factories/statuses.rb b/spec/factories/statuses.rb new file mode 100644 index 0000000000..8ecae5266a --- /dev/null +++ b/spec/factories/statuses.rb @@ -0,0 +1,14 @@ +FactoryBot.define do + factory :status do + user + association :completeable, factory: :exercise + + trait :in_progress do + state { Status::IN_PROGRESS } + end + + trait :completed do + state { Status::COMPLETE } + end + end +end diff --git a/spec/factories/steps.rb b/spec/factories/steps.rb new file mode 100644 index 0000000000..ca19efc78c --- /dev/null +++ b/spec/factories/steps.rb @@ -0,0 +1,7 @@ +FactoryBot.define do + factory :step do + association :completeable, factory: :exercise + trail + sequence(:position) + end +end diff --git a/spec/factories/teachers.rb b/spec/factories/teachers.rb new file mode 100644 index 0000000000..31f527abd5 --- /dev/null +++ b/spec/factories/teachers.rb @@ -0,0 +1,6 @@ +FactoryBot.define do + factory :teacher do + user + video + end +end diff --git a/spec/factories/teams.rb b/spec/factories/teams.rb new file mode 100644 index 0000000000..34ba21cd9a --- /dev/null +++ b/spec/factories/teams.rb @@ -0,0 +1,8 @@ +FactoryBot.define do + factory :team, class: "Team" do + # sequence(:name) { |n| "Team #{n}" } + + owner factory: :user + name { "Google" } + end +end diff --git a/spec/factories/topics.rb b/spec/factories/topics.rb new file mode 100644 index 0000000000..6493e125dc --- /dev/null +++ b/spec/factories/topics.rb @@ -0,0 +1,15 @@ +FactoryBot.define do + factory :topic do + sequence(:name) { |n| "Topic #{n}" } + page_title { "Learn #{name}" } + summary { "short yet descriptive" } + + trait :explorable do + explorable { true } + end + + after :stub do |topic| + topic.slug ||= topic.name.parameterize + end + end +end diff --git a/spec/factories/trails.rb b/spec/factories/trails.rb new file mode 100644 index 0000000000..64b818d256 --- /dev/null +++ b/spec/factories/trails.rb @@ -0,0 +1,47 @@ +FactoryBot.define do + factory :trail do + sequence(:name) { |n| "Trail number #{n}" } + description { "Trail description" } + complete_text { "Way to go!" } + + trait :with_topic do + after(:build) do |trail| + trail.topics = [build(:topic)] + end + end + + trait :published do + published { true } + end + + trait :promoted do + promoted { true } + end + + trait :unpublished do + published { false } + end + + trait :completed do + after :create do |instance| + Timecop.travel(1.week.ago) do + create(:status, :completed, completeable: instance) + end + end + end + + trait :video do + after :create do |trail| + video = create(:video, watchable: nil) + create(:step, trail: trail, completeable: video) + end + end + + trait :with_sample_video do + after :create do |trail| + video = create(:video, watchable: nil) + create(:step, trail: trail, completeable: video) + end + end + end +end diff --git a/spec/factories/users.rb b/spec/factories/users.rb new file mode 100644 index 0000000000..7c8c2e133c --- /dev/null +++ b/spec/factories/users.rb @@ -0,0 +1,33 @@ +FactoryBot.define do + factory :user do + sequence(:email) { |n| "user#{n}@example.com" } + sequence(:name) { |n| "User #{n}" } + password { "password" } + sequence(:github_username) { |n| "github_user_#{n}" } + + factory :admin do + admin { true } + end + + trait :admin do + admin { true } + end + + trait :with_github do + sequence(:github_username) { |n| "with_github_user_#{n}" } + end + + trait :with_attached_team do + team + after(:create) do |user| + user.team.update(owner: user) + end + end + + trait :with_github_auth do + sequence(:github_username) { |n| "with_github_auth_user_#{n}" } + auth_provider { "github" } + auth_uid { 1 } + end + end +end diff --git a/spec/factories/videos.rb b/spec/factories/videos.rb new file mode 100644 index 0000000000..a4ef8a9cdc --- /dev/null +++ b/spec/factories/videos.rb @@ -0,0 +1,32 @@ +FactoryBot.define do + factory :video, aliases: [:recommendable] do + association :watchable, factory: :show + sequence(:name) { |n| "Video #{n}" } + wistia_id { "1194803" } + published_on { 1.day.from_now } + + trait :published do + published_on { 1.day.ago } + end + + trait :with_trail do + after :create do |video| + create(:step, trail: create(:trail), completeable: video) + end + end + + trait :with_progress do + state { Status::UNSTARTED } + + initialize_with do + CompleteableWithProgress.new(new(attributes.except(:state)), state) + end + end + + trait :with_preview do + sequence(:preview_wistia_id) { |n| "preview-#{n}" } + end + + after(:stub) { |video| video.slug = video.id.to_s } + end +end From 33932815c7043245575c565da6560d2b7ba1b22f Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Wed, 29 Oct 2025 08:30:01 -0600 Subject: [PATCH 08/30] break down factories --- spec/support/factory_bot.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/factory_bot.rb b/spec/support/factory_bot.rb index 6f427eaa17..2a3249d475 100644 --- a/spec/support/factory_bot.rb +++ b/spec/support/factory_bot.rb @@ -1,4 +1,4 @@ -require "factory_bot_rails" +FactoryBot.use_parent_strategy = false RSpec.configure do |config| config.include FactoryBot::Syntax::Methods From b90f7f6653cde3e25f7a6431f51ab49519233774 Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 6 Nov 2025 08:12:38 -0700 Subject: [PATCH 09/30] upgrade to Rails 7.1, aligning to 7.1 conventions and settings --- Gemfile | 6 +- Gemfile.lock | 166 ++++++----- app/controllers/application_controller.rb | 11 - app/controllers/vanity_controller.rb | 16 + app/models/marker.rb | 4 +- bin/rails | 3 +- bin/rake | 1 - bin/setup | 37 +++ config/application.rb | 21 +- config/environments/development.rb | 13 +- config/environments/production.rb | 57 ++-- config/environments/test.rb | 22 +- config/initializers/assets.rb | 5 +- .../initializers/content_security_policy.rb | 47 ++- .../initializers/filter_parameter_logging.rb | 4 +- config/initializers/inflections.rb | 8 +- .../new_framework_defaults_7_1.rb | 279 ++++++++++++++++++ config/initializers/permissions_policy.rb | 20 +- config/routes.rb | 24 +- ..._to_active_storage_blobs.active_storage.rb | 22 ++ ..._storage_variant_records.active_storage.rb | 28 ++ ...e_storage_blobs_checksum.active_storage.rb | 8 + db/migrate/20251105220922_update_sql_views.rb | 5 + db/schema.rb | 33 ++- db/views/slugs_v02.sql | 12 + {vendor/lib => lib}/single_sign_on.rb | 27 +- .../repositories_controller_spec.rb | 29 +- spec/factories/users.rb | 5 + spec/features/admin_creates_deck_spec.rb | 12 - .../subscriber_views_trail_details_spec.rb | 2 +- spec/rails_helper.rb | 4 +- spec/requests/admin_decks_spec.rb | 19 ++ .../design_for_developers_resource_spec.rb | 6 +- spec/requests/vanity_spec.rb | 9 + spec/views/flashcards/show.html.erb_spec.rb | 2 +- ..._header_application_links.html.erb_spec.rb | 15 +- spec/views/trails/show.html.erb_spec.rb | 2 +- 37 files changed, 727 insertions(+), 257 deletions(-) create mode 100644 config/initializers/new_framework_defaults_7_1.rb create mode 100644 db/migrate/20251027203754_add_service_name_to_active_storage_blobs.active_storage.rb create mode 100644 db/migrate/20251027203755_create_active_storage_variant_records.active_storage.rb create mode 100644 db/migrate/20251027203756_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb create mode 100644 db/migrate/20251105220922_update_sql_views.rb create mode 100644 db/views/slugs_v02.sql rename {vendor/lib => lib}/single_sign_on.rb (66%) create mode 100644 spec/requests/admin_decks_spec.rb create mode 100644 spec/requests/vanity_spec.rb diff --git a/Gemfile b/Gemfile index c5a672e15d..7845e9d680 100644 --- a/Gemfile +++ b/Gemfile @@ -51,7 +51,7 @@ gem "psych" gem "puma" gem "rack", ">= 2.2.14", "< 3.0" gem "rack-rewrite" -gem "rails", ">= 7.0.8.7", "< 7.1" +gem "rails", "7.1.2" gem "recipient_interceptor" gem "redcarpet" gem "redis" @@ -76,8 +76,8 @@ group :development do gem "irb" gem "rack-livereload" gem "rack-mini-profiler", require: false - gem "spring", "~> 4.2.1" - gem "spring-commands-rspec" + # gem "spring", "~> 4.2.1" + # gem "spring-commands-rspec" gem "webrick" end diff --git a/Gemfile.lock b/Gemfile.lock index d91ee8cbf5..affe1b2912 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,75 +1,84 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8.7) - actionpack (= 7.0.8.7) - activesupport (= 7.0.8.7) + actioncable (7.1.2) + actionpack (= 7.1.2) + activesupport (= 7.1.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8.7) - actionpack (= 7.0.8.7) - activejob (= 7.0.8.7) - activerecord (= 7.0.8.7) - activestorage (= 7.0.8.7) - activesupport (= 7.0.8.7) + zeitwerk (~> 2.6) + actionmailbox (7.1.2) + actionpack (= 7.1.2) + activejob (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.8.7) - actionpack (= 7.0.8.7) - actionview (= 7.0.8.7) - activejob (= 7.0.8.7) - activesupport (= 7.0.8.7) + actionmailer (7.1.2) + actionpack (= 7.1.2) + actionview (= 7.1.2) + activejob (= 7.1.2) + activesupport (= 7.1.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.8.7) - actionview (= 7.0.8.7) - activesupport (= 7.0.8.7) - rack (~> 2.0, >= 2.2.4) + rails-dom-testing (~> 2.2) + actionpack (7.1.2) + actionview (= 7.1.2) + activesupport (= 7.1.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.7) - actionpack (= 7.0.8.7) - activerecord (= 7.0.8.7) - activestorage (= 7.0.8.7) - activesupport (= 7.0.8.7) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.2) + actionpack (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8.7) - activesupport (= 7.0.8.7) + actionview (7.1.2) + activesupport (= 7.1.2) 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_model_serializers (0.10.15) actionpack (>= 4.1) activemodel (>= 4.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (7.0.8.7) - activesupport (= 7.0.8.7) + activejob (7.1.2) + activesupport (= 7.1.2) globalid (>= 0.3.6) - activemodel (7.0.8.7) - activesupport (= 7.0.8.7) - activerecord (7.0.8.7) - activemodel (= 7.0.8.7) - activesupport (= 7.0.8.7) - activestorage (7.0.8.7) - actionpack (= 7.0.8.7) - activejob (= 7.0.8.7) - activerecord (= 7.0.8.7) - activesupport (= 7.0.8.7) + activemodel (7.1.2) + activesupport (= 7.1.2) + activerecord (7.1.2) + activemodel (= 7.1.2) + activesupport (= 7.1.2) + timeout (>= 0.4.0) + activestorage (7.1.2) + actionpack (= 7.1.2) + activejob (= 7.1.2) + activerecord (= 7.1.2) + activesupport (= 7.1.2) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.8.7) + activesupport (7.1.2) + 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) acts_as_list (1.2.6) activerecord (>= 6.1) @@ -162,7 +171,7 @@ GEM activerecord (>= 5.a) database_cleaner-core (~> 2.0) database_cleaner-core (2.0.1) - date (3.4.1) + date (3.5.0) delayed_job (4.1.13) activesupport (>= 3.0, < 9.0) delayed_job_active_record (4.1.11) @@ -185,7 +194,7 @@ GEM mail (~> 2.7) email_validator (2.2.4) activemodel - erb (5.1.1) + erb (5.1.3) erubi (1.13.1) eventmachine (1.2.7) execjs (2.10.0) @@ -250,7 +259,7 @@ GEM activesupport (>= 3.0) nokogiri (>= 1.6) io-console (0.8.1) - irb (1.15.2) + irb (1.15.3) pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) @@ -402,7 +411,7 @@ GEM puma (7.1.0) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.20) + rack (2.2.21) rack-cors (2.0.2) rack (>= 2.0.0) rack-livereload (0.5.2) @@ -413,22 +422,27 @@ GEM base64 (>= 0.1.0) rack (~> 2.2, >= 2.2.4) rack-rewrite (1.5.1) + rack-session (1.0.2) + rack (< 3) rack-test (2.2.0) rack (>= 1.3) - rails (7.0.8.7) - actioncable (= 7.0.8.7) - actionmailbox (= 7.0.8.7) - actionmailer (= 7.0.8.7) - actionpack (= 7.0.8.7) - actiontext (= 7.0.8.7) - actionview (= 7.0.8.7) - activejob (= 7.0.8.7) - activemodel (= 7.0.8.7) - activerecord (= 7.0.8.7) - activestorage (= 7.0.8.7) - activesupport (= 7.0.8.7) + rackup (1.0.1) + rack (< 3) + webrick + rails (7.1.2) + actioncable (= 7.1.2) + actionmailbox (= 7.1.2) + actionmailer (= 7.1.2) + actionpack (= 7.1.2) + actiontext (= 7.1.2) + actionview (= 7.1.2) + activejob (= 7.1.2) + activemodel (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) bundler (>= 1.15.0) - railties (= 7.0.8.7) + railties (= 7.1.2) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -441,19 +455,20 @@ GEM loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) rails_stdout_logging (0.0.5) - railties (7.0.8.7) - actionpack (= 7.0.8.7) - activesupport (= 7.0.8.7) - method_source + railties (7.1.2) + actionpack (= 7.1.2) + activesupport (= 7.1.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.3.0) + rake (13.3.1) rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rdoc (6.15.0) + rdoc (6.15.1) erb psych (>= 4.0.0) tsort @@ -478,7 +493,7 @@ GEM rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.6) + rspec-mocks (3.13.7) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-rails (7.1.1) @@ -562,9 +577,6 @@ GEM snaky_hash (2.0.3) hashie (>= 0.1.0, < 6) version_gem (>= 1.1.8, < 3) - spring (4.2.1) - spring-commands-rspec (1.0.4) - spring (>= 0.9.1) sprockets (4.2.2) concurrent-ruby (~> 1.0) logger @@ -593,7 +605,7 @@ GEM thor (1.4.0) tilt (2.6.1) timecop (0.9.10) - timeout (0.4.3) + timeout (0.4.4) tsort (0.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) @@ -691,7 +703,7 @@ DEPENDENCIES rack-livereload rack-mini-profiler rack-rewrite - rails (>= 7.0.8.7, < 7.1) + rails (= 7.1.2) rails-controller-testing rails_stdout_logging recipient_interceptor @@ -711,8 +723,6 @@ DEPENDENCIES shoulda-matchers simplecov sinatra - spring (~> 4.2.1) - spring-commands-rspec sprockets-rails sprockets-redirect stackprof diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c5c1f3c00c..4095360322 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -9,13 +9,6 @@ def current_user protected - def must_be_admin - unless current_user_is_admin? - flash[:error] = "You do not have permission to view that page." - redirect_to root_url - end - end - def must_be_team_owner require_login if signed_in? @@ -30,10 +23,6 @@ def current_user_has_access_to?(feature) end helper_method :current_user_has_access_to? - def current_user_is_admin? - current_user&.admin? - end - def topics Topic.explorable end diff --git a/app/controllers/vanity_controller.rb b/app/controllers/vanity_controller.rb index 048407f0f0..8f60abb686 100644 --- a/app/controllers/vanity_controller.rb +++ b/app/controllers/vanity_controller.rb @@ -1,7 +1,23 @@ class VanityController < ApplicationController + before_action :deprecated before_action :must_be_admin include Vanity::Rails::Dashboard layout false + + private + + def deprecated + warning = "#{self.class.name}##{action_name} is deprecated." + flash[:error] = "WARNING: #{warning}" + ActiveSupport::Deprecation.new.warn(warning) + end + + def must_be_admin + unless current_user&.admin? + flash[:error] = "You do not have permission to view that page." + redirect_to root_url + end + end end diff --git a/app/models/marker.rb b/app/models/marker.rb index d942b8f99c..1b29d8436a 100644 --- a/app/models/marker.rb +++ b/app/models/marker.rb @@ -4,7 +4,7 @@ class Marker < ApplicationRecord validates :anchor, presence: true validates :time, presence: true - def as_json(_options) - super(only: [:anchor, :time]) + def as_json(*) + super({only: [:anchor, :time]}) end end diff --git a/bin/rails b/bin/rails index 21d3e02d89..efc0377492 100755 --- a/bin/rails +++ b/bin/rails @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -load File.expand_path("spring", __dir__) -APP_PATH = File.expand_path('../config/application', __dir__) +APP_PATH = File.expand_path("../config/application", __dir__) require_relative "../config/boot" require "rails/commands" diff --git a/bin/rake b/bin/rake index 7327f471e4..4fbf10b960 100755 --- a/bin/rake +++ b/bin/rake @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -load File.expand_path("spring", __dir__) require_relative "../config/boot" require "rake" Rake.application.run diff --git a/bin/setup b/bin/setup index 17c592f085..179adf0174 100755 --- a/bin/setup +++ b/bin/setup @@ -74,3 +74,40 @@ fi if ! grep -qs 'port' .foreman; then printf 'port: 5000\n' >> .foreman fi + +#================================= +# Rails 7.1 default bin/setup +#================================= +# #!/usr/bin/env ruby +# require "fileutils" + +# # path to your application root. +# APP_ROOT = File.expand_path("..", __dir__) + +# def system!(*args) +# system(*args, exception: true) +# end + +# FileUtils.chdir APP_ROOT do +# # This script is a way to set up or update your development environment automatically. +# # This script is idempotent, so that you can run it at any time and get an expectable outcome. +# # Add necessary setup steps to this file. + +# puts "== Installing dependencies ==" +# system! "gem install bundler --conservative" +# system("bundle check") || system!("bundle install") + +# # puts "\n== Copying sample files ==" +# # unless File.exist?("config/database.yml") +# # FileUtils.cp "config/database.yml.sample", "config/database.yml" +# # end + +# puts "\n== Preparing database ==" +# system! "bin/rails db:prepare" + +# puts "\n== Removing old logs and tempfiles ==" +# system! "bin/rails log:clear tmp:clear" + +# puts "\n== Restarting application server ==" +# system! "bin/rails restart" +# end diff --git a/config/application.rb b/config/application.rb index e44cd70dd0..1f44dad60d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -9,7 +9,12 @@ module Upcase class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 6.1 + config.load_defaults 7.1 + + # 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. # @@ -18,12 +23,18 @@ class Application < Rails::Application # # config.time_zone = "Central Time (US & Canada)" # config.eager_load_paths << Rails.root.join("extras") - config.eager_load_paths += [ - "#{config.root}/lib", - "#{config.root}/vendor/lib" - ] + + # config.eager_load_paths += [ + # "#{config.root}/lib", + # "#{config.root}/vendor/lib" + # ] config.action_mailer.default_url_options = {host: ENV["APP_DOMAIN"]} config.assets.prefix = "/upcase/assets" + # config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews" + + # Bypass protection from open redirect attacks + # in `redirect_back_or_to` and `redirect_to`. + config.action_controller.raise_on_open_redirects = false end end diff --git a/config/environments/development.rb b/config/environments/development.rb index b3f626903e..31e287fa65 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -14,7 +14,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 @@ -22,9 +22,12 @@ # Show full error reports. config.consider_all_requests_local = true + # Enable server timing + config.server_timing = true + # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. - if Rails.root.join("tmp", "caching-dev.txt").exist? + if Rails.root.join("tmp/caching-dev.txt").exist? config.action_controller.perform_caching = true config.action_controller.enable_fragment_cache_logging = true @@ -61,6 +64,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 + # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. @@ -83,4 +89,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 6b58caeb03..f60fd5e79b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -14,7 +14,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 @@ -26,12 +26,14 @@ 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 - # Apache or NGINX already handles this. + # Disable serving static files from `public/` by default, relying on + # NGINX/Apache to do so instead. config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? # Compress CSS using a preprocessor. @@ -41,36 +43,46 @@ config.assets.compile = false # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.asset_host = 'http://assets.example.com' + # config.asset_host = "http://assets.example.com" # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache + # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX # Store uploaded files on the local file system (see config/storage.yml for options). config.active_storage.service = :local # Mount Action Cable outside main process or domain. # config.action_cable.mount_path = nil - # config.action_cable.url = 'wss://example.com/cable' - # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + # 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 include 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 config.cache_store = :redis_cache_store, {url: ENV.fetch("REDIS_URL")} # Use a real queuing backend for Active Job (and separate queues per environment). - # config.active_job.queue_adapter = :resque + # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "upcase_production" config.action_mailer.perform_caching = false @@ -83,8 +95,11 @@ # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify + # Don't log any deprecations. + config.active_support.report_deprecations = false + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false # Log disallowed deprecations. config.active_support.disallowed_deprecation = :log @@ -95,6 +110,14 @@ # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new + # 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" } } + # Use a different logger for distributed setups. # require "syslog/logger" # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') diff --git a/config/environments/test.rb b/config/environments/test.rb index 5f9ccd5631..123729b31c 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -16,13 +16,16 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - config.cache_classes = false - config.action_view.cache_template_loading = true + # While tests run files are not watched, reloading is not necessary. + config.enable_reloading = false - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. - config.eager_load = false + # config.action_view.cache_template_loading = true + + # 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. config.public_file_server.enabled = true @@ -35,8 +38,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 @@ -66,6 +69,9 @@ # 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 + # Below added to stock configuration # Run jobs right away in test env diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index c1f948d018..ba974a73c2 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -5,8 +5,9 @@ # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path -# Add Yarn node_modules folder to the asset load path. -Rails.application.config.assets.paths << Rails.root.join("node_modules") + +# # Add Yarn node_modules folder to the asset load path. +# Rails.application.config.assets.paths << Rails.root.join("node_modules") # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 35d0f26fcd..b3076b38fe 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,30 +1,25 @@ # 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.config.content_security_policy do |policy| -# policy.default_src :self, :https -# policy.font_src :self, :https, :data -# policy.img_src :self, :https, :data -# policy.object_src :none -# policy.script_src :self, :https -# policy.style_src :self, :https -# # If you are using webpack-dev-server then specify webpack-dev-server host -# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? - -# # Specify URI for violation reports -# # policy.report_uri "/csp-violation-report-endpoint" +# Rails.application.configure do +# config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end +# +# # 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 style-src) +# +# # Report violations without enforcing the policy. +# # config.content_security_policy_report_only = true # end - -# If you are using UJS then enable automatic nonce generation -# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } - -# Set the nonce only to specific directives -# Rails.application.config.content_security_policy_nonce_directives = %w(script-src) - -# Report CSP violations to a specified URI -# For further information see the following documentation: -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only -# Rails.application.config.content_security_policy_report_only = true diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4b34a03668..c2d89e28a2 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,6 +1,8 @@ # Be sure to restart your server when you modify this file. -# Configure sensitive parameters which will be filtered from the log file. +# 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/inflections.rb b/config/initializers/inflections.rb index ac033bf9dc..3860f659ea 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -4,13 +4,13 @@ # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym 'RESTful' +# inflect.acronym "RESTful" # end diff --git a/config/initializers/new_framework_defaults_7_1.rb b/config/initializers/new_framework_defaults_7_1.rb new file mode 100644 index 0000000000..e39bd17a21 --- /dev/null +++ b/config/initializers/new_framework_defaults_7_1.rb @@ -0,0 +1,279 @@ +# Be sure to restart your server when you modify this file. +# +# This file eases your Rails 7.1 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.1`. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. +# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html + +### +# 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. +#++ +# Rails.application.config.add_autoload_paths_to_load_path = false + +### +# Remove the default X-Download-Options headers since it is used only by Internet Explorer. +# If you need to support Internet Explorer, add back `"X-Download-Options" => "noopen"`. +#++ +# Rails.application.config.action_dispatch.default_headers = { +# "X-Frame-Options" => "SAMEORIGIN", +# "X-XSS-Protection" => "0", +# "X-Content-Type-Options" => "nosniff", +# "X-Permitted-Cross-Domain-Policies" => "none", +# "Referrer-Policy" => "strict-origin-when-cross-origin" +# } + +### +# Do not treat an `ActionController::Parameters` instance +# as equal to an equivalent `Hash` by default. +#++ +# Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality = false + +### +# Active Record Encryption now uses SHA-256 as its hash digest algorithm. +# +# There are 3 scenarios to consider. +# +# 1. If you have data encrypted with previous Rails versions, and you have +# +config.active_support.key_generator_hash_digest_class+ configured as SHA1 (the default +# before Rails 7.0), you need to configure SHA-1 for Active Record Encryption too: +#++ +# Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA1 +# +# 2. If you have +config.active_support.key_generator_hash_digest_class+ configured as SHA256 (the new default +# in 7.0), then you need to configure SHA-256 for Active Record Encryption: +#++ +# Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA256 +# +# 3. If you don't currently have data encrypted with Active Record encryption, you can disable this setting to +# configure the default behavior starting 7.1+: +#++ +# Rails.application.config.active_record.encryption.support_sha1_for_non_deterministic_encryption = false + +### +# No longer run after_commit callbacks on the first of multiple Active Record +# instances to save changes to the same database row within a transaction. +# Instead, run these callbacks on the instance most likely to have internal +# state which matches what was committed to the database, typically the last +# instance to save. +#++ +# Rails.application.config.active_record.run_commit_callbacks_on_first_saved_instances_in_transaction = false + +### +# Configures SQLite with a strict strings mode, which disables double-quoted string literals. +# +# SQLite has some quirks around double-quoted string literals. +# It first tries to consider double-quoted strings as identifier names, but if they don't exist +# it then considers them as string literals. Because of this, typos can silently go unnoticed. +# For example, it is possible to create an index for a non existing column. +# See https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted for more details. +#++ +# Rails.application.config.active_record.sqlite3_adapter_strict_strings_by_default = true + +### +# Disable deprecated singular associations names. +#++ +# Rails.application.config.active_record.allow_deprecated_singular_associations_name = false + +### +# Enable the Active Job `BigDecimal` argument serializer, which guarantees +# roundtripping. Without this serializer, some queue adapters may serialize +# `BigDecimal` arguments as simple (non-roundtrippable) strings. +# +# When deploying an application with multiple replicas, old (pre-Rails 7.1) +# replicas will not be able to deserialize `BigDecimal` arguments from this +# serializer. Therefore, this setting should only be enabled after all replicas +# have been successfully upgraded to Rails 7.1. +#++ +# Rails.application.config.active_job.use_big_decimal_serializer = true + +### +# Specify if an `ArgumentError` should be raised if `Rails.cache` `fetch` or +# `write` are given an invalid `expires_at` or `expires_in` time. +# Options are `true`, and `false`. If `false`, the exception will be reported +# as `handled` and logged instead. +#++ +# Rails.application.config.active_support.raise_on_invalid_cache_expiration_time = true + +### +# Specify whether Query Logs will format tags using the SQLCommenter format +# (https://open-telemetry.github.io/opentelemetry-sqlcommenter/), or using the legacy format. +# Options are `:legacy` and `:sqlcommenter`. +#++ +# Rails.application.config.active_record.query_log_tags_format = :sqlcommenter + +### +# Specify the default serializer used by `MessageEncryptor` and `MessageVerifier` +# instances. +# +# The legacy default is `:marshal`, which is a potential vector for +# deserialization attacks in cases where a message signing secret has been +# leaked. +# +# In Rails 7.1, the new default is `:json_allow_marshal` which serializes and +# deserializes with `ActiveSupport::JSON`, but can fall back to deserializing +# with `Marshal` so that legacy messages can still be read. +# +# In Rails 7.2, the default will become `:json` which serializes and +# deserializes with `ActiveSupport::JSON` only. +# +# Alternatively, you can choose `:message_pack` or `:message_pack_allow_marshal`, +# which serialize with `ActiveSupport::MessagePack`. `ActiveSupport::MessagePack` +# can roundtrip some Ruby types that are not supported by JSON, and may provide +# improved performance, but it requires the `msgpack` gem. +# +# For more information, see +# https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer +# +# If you are performing a rolling deploy of a Rails 7.1 upgrade, wherein servers +# that have not yet been upgraded must be able to read messages from upgraded +# servers, first deploy without changing the serializer, then set the serializer +# in a subsequent deploy. +#++ +# Rails.application.config.active_support.message_serializer = :json_allow_marshal + +### +# Enable a performance optimization that serializes message data and metadata +# together. This changes the message format, so messages serialized this way +# cannot be read by older versions of Rails. However, messages that use the old +# format can still be read, regardless of whether this optimization is enabled. +# +# To perform a rolling deploy of a Rails 7.1 upgrade, wherein servers that have +# not yet been upgraded must be able to read messages from upgraded servers, +# leave this optimization off on the first deploy, then enable it on a +# subsequent deploy. +#++ +# Rails.application.config.active_support.use_message_serializer_for_metadata = true + +### +# Set the maximum size for Rails log files. +# +# `config.load_defaults 7.1` does not set this value for environments other than +# development and test. +#++ +# if Rails.env.local? +# Rails.application.config.log_file_size = 100 * 1024 * 1024 +# end + +### +# Enable raising on assignment to attr_readonly attributes. The previous +# behavior would allow assignment but silently not persist changes to the +# database. +#++ +# Rails.application.config.active_record.raise_on_assign_to_attr_readonly = true + +### +# Enable validating only parent-related columns for presence when the parent is mandatory. +# The previous behavior was to validate the presence of the parent record, which performed an extra query +# to get the parent every time the child record was updated, even when parent has not changed. +#++ +# Rails.application.config.active_record.belongs_to_required_validates_foreign_key = false + +### +# Enable precompilation of `config.filter_parameters`. Precompilation can +# improve filtering performance, depending on the quantity and types of filters. +#++ +# Rails.application.config.precompile_filter_parameters = true + +### +# Enable before_committed! callbacks on all enrolled records in a transaction. +# The previous behavior was to only run the callbacks on the first copy of a record +# if there were multiple copies of the same record enrolled in the transaction. +#++ +# Rails.application.config.active_record.before_committed_on_all_records = true + +### +# Disable automatic column serialization into YAML. +# To keep the historic behavior, you can set it to `YAML`, however it is +# recommended to explicitly define the serialization method for each column +# rather than to rely on a global default. +#++ +# Rails.application.config.active_record.default_column_serializer = nil + +### +# Enable a performance optimization that serializes Active Record models +# in a faster and more compact way. +# +# To perform a rolling deploy of a Rails 7.1 upgrade, wherein servers that have +# not yet been upgraded must be able to read caches from upgraded servers, +# leave this optimization off on the first deploy, then enable it on a +# subsequent deploy. +#++ +# Rails.application.config.active_record.marshalling_format_version = 7.1 + +### +# Run `after_commit` and `after_*_commit` callbacks in the order they are defined in a model. +# This matches the behaviour of all other callbacks. +# In previous versions of Rails, they ran in the inverse order. +#++ +# Rails.application.config.active_record.run_after_transaction_callbacks_in_order_defined = true + +### +# Whether a `transaction` block is committed or rolled back when exited via `return`, `break` or `throw`. +#++ +# Rails.application.config.active_record.commit_transaction_on_non_local_return = true + +### +# Controls when to generate a value for has_secure_token declarations. +#++ +# Rails.application.config.active_record.generate_secure_token_on = :initialize + +### +# ** Please read carefully, this must be configured in config/application.rb ** +# +# Change the format of the cache entry. +# +# Changing this default means that all new cache entries added to the cache +# will have a different format that is not supported by Rails 7.0 +# applications. +# +# Only change this value after your application is fully deployed to Rails 7.1 +# and you have no plans to rollback. +# When you're ready to change format, add this to `config/application.rb` (NOT +# this file): +# config.active_support.cache_format_version = 7.1 + +### +# Configure Action View to use HTML5 standards-compliant sanitizers when they are supported on your +# platform. +# +# `Rails::HTML::Sanitizer.best_supported_vendor` will cause Action View to use HTML5-compliant +# sanitizers if they are supported, else fall back to HTML4 sanitizers. +# +# In previous versions of Rails, Action View always used `Rails::HTML4::Sanitizer` as its vendor. +#++ +# Rails.application.config.action_view.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor + +### +# Configure Action Text to use an HTML5 standards-compliant sanitizer when it is supported on your +# platform. +# +# `Rails::HTML::Sanitizer.best_supported_vendor` will cause Action Text to use HTML5-compliant +# sanitizers if they are supported, else fall back to HTML4 sanitizers. +# +# In previous versions of Rails, Action Text always used `Rails::HTML4::Sanitizer` as its vendor. +#++ +# Rails.application.config.action_text.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor + +### +# Configure the log level used by the DebugExceptions middleware when logging +# uncaught exceptions during requests. +#++ +# Rails.application.config.action_dispatch.debug_exception_log_level = :error + +### +# Configure the test helpers in Action View, Action Dispatch, and rails-dom-testing to use HTML5 +# parsers. +# +# Nokogiri::HTML5 isn't supported on JRuby, so JRuby applications must set this to :html4. +# +# In previous versions of Rails, these test helpers always used an HTML4 parser. +#++ +# Rails.application.config.dom_testing_default_html_version = :html5 diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb index 00f64d71b0..7db3b9577e 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/config/routes.rb b/config/routes.rb index 76dd78a4ba..387cc0b286 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -123,14 +123,6 @@ end resources :passwords, controller: "passwords", only: [:create, :new] - get "/vanity" => "vanity#index" - get "/vanity/participant/:id" => "vanity#participant" - post "/vanity/complete" - post "/vanity/chooses" - post "/vanity/reset" - post "/vanity/add_participant" - get "/vanity/image" - resources :videos, only: [:show] do resource :twitter_player_card, only: [:show] resources :completions, only: [:create], controller: "video_completions" @@ -151,9 +143,23 @@ only: [:index] ) + get( + ":id" => "topics#show", + :as => :topic, + :constraints => SlugConstraint.new(Topic) + ) + get "/practice" => "practice#show", :as => :practice get "sitemap.xml" => "sitemaps#show", :as => :sitemap, :format => "xml" - get ":id" => "topics#show", :as => :topic get "/auth/:provider/callback", to: "auth_callbacks#create" + + # DEPRECATED as of 1/1/2024 (https://github.com/assaf/vanity) + get "/vanity" => "vanity#index", :as => :vanity_index + get "/vanity/participant/:id" => "vanity#participant", :as => :vanity_participant + post "/vanity/complete" + post "/vanity/chooses" + post "/vanity/reset" + post "/vanity/add_participant" + get "/vanity/image" end end diff --git a/db/migrate/20251027203754_add_service_name_to_active_storage_blobs.active_storage.rb b/db/migrate/20251027203754_add_service_name_to_active_storage_blobs.active_storage.rb new file mode 100644 index 0000000000..0267f12870 --- /dev/null +++ b/db/migrate/20251027203754_add_service_name_to_active_storage_blobs.active_storage.rb @@ -0,0 +1,22 @@ +# This migration comes from active_storage (originally 20190112182829) +class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] + def up + return unless table_exists?(:active_storage_blobs) + + unless column_exists?(:active_storage_blobs, :service_name) + add_column :active_storage_blobs, :service_name, :string + + if (configured_service = ActiveStorage::Blob.service.name) + ActiveStorage::Blob.unscoped.update_all(service_name: configured_service) + end + + change_column :active_storage_blobs, :service_name, :string, null: false + end + end + + def down + return unless table_exists?(:active_storage_blobs) + + remove_column :active_storage_blobs, :service_name + end +end diff --git a/db/migrate/20251027203755_create_active_storage_variant_records.active_storage.rb b/db/migrate/20251027203755_create_active_storage_variant_records.active_storage.rb new file mode 100644 index 0000000000..95fd27fa6d --- /dev/null +++ b/db/migrate/20251027203755_create_active_storage_variant_records.active_storage.rb @@ -0,0 +1,28 @@ +# This migration comes from active_storage (originally 20191206030411) +class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] + def change + return unless table_exists?(:active_storage_blobs) + + # Use Active Record's configured type for primary key + create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t| + t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type + t.string :variation_digest, null: false + + t.index %i[blob_id variation_digest], name: "index_active_storage_variant_records_uniqueness", unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + end + + private + + def primary_key_type + config = Rails.configuration.generators + config.options[config.orm][:primary_key_type] || :primary_key + end + + def blobs_primary_key_type + pkey_name = connection.primary_key(:active_storage_blobs) + pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name } + pkey_column.bigint? ? :bigint : pkey_column.type + end +end diff --git a/db/migrate/20251027203756_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb b/db/migrate/20251027203756_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb new file mode 100644 index 0000000000..93c8b85ade --- /dev/null +++ b/db/migrate/20251027203756_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb @@ -0,0 +1,8 @@ +# This migration comes from active_storage (originally 20211119233751) +class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0] + def change + return unless table_exists?(:active_storage_blobs) + + change_column_null(:active_storage_blobs, :checksum, true) + end +end diff --git a/db/migrate/20251105220922_update_sql_views.rb b/db/migrate/20251105220922_update_sql_views.rb new file mode 100644 index 0000000000..7948e06dd0 --- /dev/null +++ b/db/migrate/20251105220922_update_sql_views.rb @@ -0,0 +1,5 @@ +class UpdateSqlViews < ActiveRecord::Migration[7.1] + def change + replace_view :slugs, version: 2, revert_to_version: 1 + end +end diff --git a/db/schema.rb b/db/schema.rb index 0d02451ad2..20990f4b84 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,16 +2,15 @@ # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_02_09_195453) do - +ActiveRecord::Schema[7.1].define(version: 2025_11_05_220922) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" enable_extension "plpgsql" @@ -389,14 +388,14 @@ add_foreign_key "markers", "videos", on_delete: :cascade create_view "latest_attempts", sql_definition: <<-SQL - SELECT DISTINCT ON (attempts.user_id, attempts.flashcard_id) attempts.id, - attempts.confidence, - attempts.flashcard_id, - attempts.user_id, - attempts.created_at, - attempts.updated_at + SELECT DISTINCT ON (user_id, flashcard_id) id, + confidence, + flashcard_id, + user_id, + created_at, + updated_at FROM attempts - ORDER BY attempts.user_id, attempts.flashcard_id, attempts.updated_at DESC; + ORDER BY user_id, flashcard_id, updated_at DESC; SQL create_view "slugs", sql_definition: <<-SQL SELECT products.slug, @@ -405,6 +404,10 @@ UNION ALL SELECT trails.slug, 'Trail'::character varying AS model - FROM trails; + FROM trails + UNION ALL + SELECT topics.slug, + 'Topic'::character varying AS model + FROM topics; SQL end diff --git a/db/views/slugs_v02.sql b/db/views/slugs_v02.sql new file mode 100644 index 0000000000..4c284a08d4 --- /dev/null +++ b/db/views/slugs_v02.sql @@ -0,0 +1,12 @@ +SELECT slug, type as model +FROM products + +UNION ALL + +SELECT slug, 'Trail' as model +FROM trails + +UNION ALL + +SELECT slug, 'Topic' as model +FROM topics diff --git a/vendor/lib/single_sign_on.rb b/lib/single_sign_on.rb similarity index 66% rename from vendor/lib/single_sign_on.rb rename to lib/single_sign_on.rb index 6bcc525823..656c7dc76f 100644 --- a/vendor/lib/single_sign_on.rb +++ b/lib/single_sign_on.rb @@ -3,8 +3,8 @@ class SingleSignOn ACCESSORS = [:nonce, :name, :username, :email, :avatar_url, :avatar_force_update, :require_activation, - :bio, :external_id, :return_sso_url, :admin, :moderator, :suppress_welcome_message, :title, - :add_groups, :remove_groups, :groups, :profile_background_url, :card_background_url, :website] + :bio, :external_id, :return_sso_url, :admin, :moderator, :suppress_welcome_message, :title, + :add_groups, :remove_groups, :groups, :profile_background_url, :card_background_url, :website] FIXNUMS = [] BOOLS = [:avatar_force_update, :admin, :moderator, :require_activation, :suppress_welcome_message] NONCE_EXPIRY_TIME = 10.minutes @@ -13,11 +13,11 @@ class SingleSignOn attr_writer :sso_secret, :sso_url def self.sso_secret - raise RuntimeError, "sso_secret not implemented on class, be sure to set it on instance" + raise "sso_secret not implemented on class, be sure to set it on instance" end def self.sso_url - raise RuntimeError, "sso_url not implemented on class, be sure to set it on instance" + raise "sso_url not implemented on class, be sure to set it on instance" end def self.parse(payload, sso_secret = nil) @@ -27,10 +27,10 @@ def self.parse(payload, sso_secret = nil) parsed = Rack::Utils.parse_query(payload) if sso.sign(parsed["sso"]) != parsed["sig"] diags = "\n\nsso: #{parsed["sso"]}\n\nsig: #{parsed["sig"]}\n\nexpected sig: #{sso.sign(parsed["sso"])}" - if parsed["sso"] =~ /[^a-zA-Z0-9=\r\n\/+]/m - raise RuntimeError, "The SSO field should be Base64 encoded, using only A-Z, a-z, 0-9, +, /, and = characters. Your input contains characters we don't understand as Base64, see http://en.wikipedia.org/wiki/Base64 #{diags}" + if /[^a-zA-Z0-9=\r\n\/+]/m.match?(parsed["sso"]) + raise "The SSO field should be Base64 encoded, using only A-Z, a-z, 0-9, +, /, and = characters. Your input contains characters we don't understand as Base64, see http://en.wikipedia.org/wiki/Base64 #{diags}" else - raise RuntimeError, "Bad signature for payload #{diags}" + raise "Bad signature for payload #{diags}" end end @@ -47,7 +47,7 @@ def self.parse(payload, sso_secret = nil) end decoded_hash.each do |k, v| - if field = k[/^custom\.(.+)$/, 1] + if (field = k[/^custom\.(.+)$/, 1]) sso.custom_fields[field] = v end end @@ -76,21 +76,21 @@ def sign(payload) end def to_url(base_url = nil) - base = "#{base_url || sso_url}" - "#{base}#{base.include?('?') ? '&' : '?'}#{payload}" + base = (base_url || sso_url).to_s + "#{base}#{base.include?("?") ? "&" : "?"}#{payload}" end def payload payload = Base64.strict_encode64(unsigned_payload) - "sso=#{CGI::escape(payload)}&sig=#{sign(payload)}" + "sso=#{CGI.escape(payload)}&sig=#{sign(payload)}" end def unsigned_payload payload = {} ACCESSORS.each do |k| - next if (val = send k) == nil - payload[k] = val + next if (val = send k).nil? + payload[k] = val end @custom_fields&.each do |k, v| @@ -99,5 +99,4 @@ def unsigned_payload Rack::Utils.build_query(payload) end - end diff --git a/spec/controllers/repositories_controller_spec.rb b/spec/controllers/repositories_controller_spec.rb index 94b4104d7c..62b9cab134 100644 --- a/spec/controllers/repositories_controller_spec.rb +++ b/spec/controllers/repositories_controller_spec.rb @@ -3,27 +3,20 @@ RSpec.describe RepositoriesController do describe "#show" do it "redirects to the repository on GitHub" do - repository = stub_repository + repository = build_stubbed(:repository) + finder = double("finder") + allow(finder) + .to receive(:find) + .with(repository.to_param) + .and_return(repository) + allow(Repository) + .to receive(:friendly) + .and_return(finder) + sign_in_as build_stubbed(:user) - show_repository repository + get :show, params: {id: repository.to_param} expect(response).to redirect_to(repository.github_url) end end - - def stub_repository - build_stubbed(:repository).tap do |repository| - finder = double("finder") - allow(finder).to receive(:find).with(repository.to_param) - .and_return(repository) - allow(Repository).to receive(:friendly).and_return(finder) - end - end - - def show_repository(repository, params = {}) - sign_in_as current_user - get :show, params: params.merge(id: repository.to_param) - end - - let(:current_user) { build_stubbed(:user) } end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 7c8c2e133c..125291608c 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -4,6 +4,7 @@ sequence(:name) { |n| "User #{n}" } password { "password" } sequence(:github_username) { |n| "github_user_#{n}" } + admin { false } factory :admin do admin { true } @@ -13,6 +14,10 @@ admin { true } end + trait :with_bio do + sequence(:bio) { |n| "The Amazing Brian the #{n}th" } + end + trait :with_github do sequence(:github_username) { |n| "with_github_user_#{n}" } end diff --git a/spec/features/admin_creates_deck_spec.rb b/spec/features/admin_creates_deck_spec.rb index 24127985e7..1e76f5f816 100644 --- a/spec/features/admin_creates_deck_spec.rb +++ b/spec/features/admin_creates_deck_spec.rb @@ -1,18 +1,6 @@ require "rails_helper" RSpec.feature "Admin creates a deck" do - scenario "is 404 if not an admin" do - expect do - visit new_admin_deck_path(as: create(:user)) - end.to raise_error(ActionController::RoutingError) - end - - scenario "is 404 if not a user" do - expect do - visit new_admin_deck_path - end.to raise_error(ActionController::RoutingError) - end - scenario "successfully" do visit admin_decks_path(as: create(:admin)) diff --git a/spec/features/subscriber_views_trail_details_spec.rb b/spec/features/subscriber_views_trail_details_spec.rb index b5712825b7..0069d55e8a 100644 --- a/spec/features/subscriber_views_trail_details_spec.rb +++ b/spec/features/subscriber_views_trail_details_spec.rb @@ -15,7 +15,7 @@ exercises: exercises, videos: [video] ) - teacher = create(:user, bio: generate(:bio)) + teacher = create(:user, :with_bio) create(:teacher, user: teacher, video: video) user = create(:user) exercises.first.statuses.create!(user: user, state: Status::COMPLETE) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 8240012d67..5684e73fe4 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -57,9 +57,11 @@ ActiveRecord::Migration.maintain_test_schema! RSpec.configure do |config| + config.raise_errors_for_deprecations! + config.use_transactional_fixtures = false config.use_instantiated_fixtures = false - config.fixture_path = "#{::Rails.root}/spec/fixtures" + config.fixture_paths = ["#{::Rails.root}/spec/fixtures"] config.include Clearance::Testing::Matchers, type: :request config.include Paperclip::Shoulda::Matchers diff --git a/spec/requests/admin_decks_spec.rb b/spec/requests/admin_decks_spec.rb new file mode 100644 index 0000000000..417693a754 --- /dev/null +++ b/spec/requests/admin_decks_spec.rb @@ -0,0 +1,19 @@ +require "rails_helper" + +RSpec.describe "new_admin_deck_path" do + context "if user is not an admin" do + it "is not found" do + get new_admin_deck_path(as: create(:user, admin: false)) + + expect(response).to have_http_status(:not_found) + end + end + + context "if user is an admin" do + it "is not found" do + get new_admin_deck_path(as: create(:user, admin: true)) + + expect(response).to have_http_status(:ok) + end + end +end diff --git a/spec/requests/design_for_developers_resource_spec.rb b/spec/requests/design_for_developers_resource_spec.rb index a12797a1f0..486e2ba317 100644 --- a/spec/requests/design_for_developers_resource_spec.rb +++ b/spec/requests/design_for_developers_resource_spec.rb @@ -2,10 +2,8 @@ RSpec.describe "Design For Developers Resources" do it "handles a missing resource" do - expect { get_missing_resource }.to raise_error(ActiveRecord::RecordNotFound) - end - - def get_missing_resource get "/upcase/design-for-developers-resources/missing-resource" + + expect(response).to have_http_status(:not_found) end end diff --git a/spec/requests/vanity_spec.rb b/spec/requests/vanity_spec.rb new file mode 100644 index 0000000000..a229fdfb60 --- /dev/null +++ b/spec/requests/vanity_spec.rb @@ -0,0 +1,9 @@ +require "rails_helper" + +RSpec.describe "Vanity pages" do + it "raise a deprecation warning" do + expect { + get vanity_index_path + }.to output(/^DEPRECATION WARNING/).to_stderr + end +end diff --git a/spec/views/flashcards/show.html.erb_spec.rb b/spec/views/flashcards/show.html.erb_spec.rb index 77e9a0841f..4a36b2fe76 100644 --- a/spec/views/flashcards/show.html.erb_spec.rb +++ b/spec/views/flashcards/show.html.erb_spec.rb @@ -23,6 +23,6 @@ def render_flashcard(attributes) end def rendered_content - Capybara.string(rendered) + Capybara.string(rendered.to_s) end end diff --git a/spec/views/layouts/_header_application_links.html.erb_spec.rb b/spec/views/layouts/_header_application_links.html.erb_spec.rb index 4004d3e727..0f3cd7e6ea 100644 --- a/spec/views/layouts/_header_application_links.html.erb_spec.rb +++ b/spec/views/layouts/_header_application_links.html.erb_spec.rb @@ -3,19 +3,14 @@ RSpec.describe "layouts/_header_application_links.html.erb" do include Gravatarify::Helper - let(:call_to_action_label) { "Get two months free" } - it "renders the user's avatar" do - email = generate(:email) - + user = build_stubbed(:user) + view_stub_with_return(current_user: user) view_stub_with_return(signed_in?: true) - view_stub_with_return( - current_user: double("user", email: email) - ) + render template: "layouts/_header_application_links" - expect(rendered).to have_css(<<-CSS.strip) - img[src='#{gravatar_url(email, size: "30")}'] - CSS + expected_url = gravatar_url(user.email, size: "30") + expect(rendered).to have_css("img[src='#{expected_url}']") end end diff --git a/spec/views/trails/show.html.erb_spec.rb b/spec/views/trails/show.html.erb_spec.rb index 1bf1abd9f0..51f5631e71 100644 --- a/spec/views/trails/show.html.erb_spec.rb +++ b/spec/views/trails/show.html.erb_spec.rb @@ -28,7 +28,7 @@ def have_progress_bar end def rendered_content - Capybara.string(rendered) + Capybara.string(rendered.to_s) end def build_trail_with_steps From 2e32083eebe54ed73806edc8c398f03ed1bfc891 Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 11:49:36 -0700 Subject: [PATCH 10/30] try to resolve CI build issues for 7.1 --- Gemfile.lock | 44 +++++++++---------- config/initializers/assets.rb | 4 +- spec/lib/wistia_api_client/media_spec.rb | 33 ++++++++++++++ spec/services/video_duration_updater_spec.rb | 7 +++ ...a_client.rb => wistia_api_client_stubs.rb} | 0 5 files changed, 64 insertions(+), 24 deletions(-) rename spec/support/{wistia_client.rb => wistia_api_client_stubs.rb} (100%) diff --git a/Gemfile.lock b/Gemfile.lock index affe1b2912..a37279e3fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -92,8 +92,8 @@ GEM autoprefixer-rails (10.4.21.0) execjs (~> 2) aws-eventstream (1.4.0) - aws-partitions (1.1177.0) - aws-sdk-core (3.235.0) + aws-partitions (1.1181.0) + aws-sdk-core (3.237.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) @@ -101,10 +101,10 @@ GEM bigdecimal jmespath (~> 1, >= 1.6.1) logger - aws-sdk-kms (1.115.0) + aws-sdk-kms (1.117.0) aws-sdk-core (~> 3, >= 3.234.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.201.0) + aws-sdk-s3 (1.203.1) aws-sdk-core (~> 3, >= 3.234.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) @@ -209,8 +209,8 @@ GEM logger faraday-multipart (1.1.1) multipart-post (~> 2.0) - faraday-net_http (3.4.1) - net-http (>= 0.5.0) + faraday-net_http (3.4.2) + net-http (~> 0.5) faraday-retry (2.3.2) faraday (~> 2.0) ffi (1.17.2) @@ -222,7 +222,7 @@ GEM flutie (2.2.1) font-awesome-rails (4.7.0.9) railties (>= 3.2, < 9.0) - formatador (1.2.1) + formatador (1.2.3) reline formtastic (5.0.0) actionpack (>= 6.0.0) @@ -270,7 +270,7 @@ GEM thor (>= 0.14, < 2.0) jquery-ui-rails (7.0.0) railties (>= 3.2.16) - json (2.15.2) + json (2.16.0) jsonapi-renderer (0.2.2) jwt (3.1.2) base64 @@ -315,12 +315,12 @@ GEM logger mime-types-data (~> 3.2025, >= 3.2025.0507) mime-types-data (3.2025.0924) - mimemagic (0.3.10) + mimemagic (0.4.3) nokogiri (~> 1) rake mini_mime (1.1.5) mini_portile2 (2.8.9) - minitest (5.26.0) + minitest (5.26.1) msgpack (1.8.0) multi_json (1.17.0) multi_xml (0.7.2) @@ -333,8 +333,8 @@ GEM bourbon (>= 4.0) sass (>= 3.3) nenv (0.3.0) - net-http (0.6.0) - uri + net-http (0.8.0) + uri (>= 0.11.1) net-imap (0.5.12) date net-protocol @@ -344,7 +344,7 @@ GEM timeout net-smtp (0.5.1) net-protocol - nio4r (2.7.4) + nio4r (2.7.5) nokogiri (1.18.10) mini_portile2 (~> 2.8.2) racc (~> 1.4) @@ -480,7 +480,7 @@ GEM redis-client (0.26.1) connection_pool regexp_parser (2.11.3) - reline (0.6.2) + reline (0.6.3) io-console (~> 0.5) request_store (1.7.0) rack (>= 1.4) @@ -518,7 +518,7 @@ GEM rubocop-ast (>= 1.46.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.47.1) + rubocop-ast (1.48.0) parser (>= 3.3.7.2) prism (~> 1.4) rubocop-performance (1.25.0) @@ -527,7 +527,7 @@ GEM rubocop-ast (>= 1.38.0, < 2.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - rubyzip (3.2.1) + rubyzip (3.2.2) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) @@ -553,10 +553,10 @@ GEM rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 4.0) websocket (~> 1.0) - sentry-rails (6.0.0) + sentry-rails (6.1.0) railties (>= 5.2.0) - sentry-ruby (~> 6.0.0) - sentry-ruby (6.0.0) + sentry-ruby (~> 6.1.0) + sentry-ruby (6.1.0) bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) shellany (0.0.1) @@ -601,7 +601,7 @@ GEM standard-performance (1.8.0) lint_roller (~> 1.1) rubocop-performance (~> 1.25.0) - stringio (3.1.7) + stringio (3.1.8) thor (1.4.0) tilt (2.6.1) timecop (0.9.10) @@ -614,14 +614,14 @@ GEM unicode-display_width (3.2.0) unicode-emoji (~> 4.1) unicode-emoji (4.1.0) - uri (1.0.4) + uri (1.1.1) validates_email_format_of (1.8.2) i18n (>= 0.8.0) simpleidn vanity (4.0.4) i18n version_gem (1.1.9) - webmock (3.26.0) + webmock (3.26.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index ba974a73c2..b0bf5885db 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -6,8 +6,8 @@ # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path -# # Add Yarn node_modules folder to the asset load path. -# Rails.application.config.assets.paths << Rails.root.join("node_modules") +# Add Yarn node_modules folder to the asset load path. +Rails.application.config.assets.paths << Rails.root.join("node_modules") # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets diff --git a/spec/lib/wistia_api_client/media_spec.rb b/spec/lib/wistia_api_client/media_spec.rb index 89cdc6517e..94bb4481e8 100644 --- a/spec/lib/wistia_api_client/media_spec.rb +++ b/spec/lib/wistia_api_client/media_spec.rb @@ -4,8 +4,17 @@ RSpec.describe WistiaApiClient::Media do describe "#list" do it "returns a parsed JSON response" do + pending "needs mocking" + media_client = described_class.new + mock_wistia_api_response_with( + uri: "https://api.wistia.com/v1/medias.json?limit=100&page=1", + response: { + body: {hi: "there"}.to_json + } + ) + result = media_client.list expect(result).to respond_to :each @@ -13,6 +22,8 @@ end it "combines multi-page responses into a single response" do + pending "needs mocking" + media_client = described_class.new result = media_client.list(limit: 1, starting_page: 1) @@ -23,6 +34,8 @@ describe "#show" do it "returns a parsed JSON response for a single media object" do + pending "needs mocking" + media_client = described_class.new wistia_id = "123foo" @@ -32,4 +45,24 @@ expect(result.keys).to include("name", "duration", "hashed_id") end end + + def mock_wistia_api_response_with(uri:, response: {}) + mock_response = { body: "", headers: {} }.merge(response) + + stub_request(:get, uri) + .with( + headers: { + 'Accept'=>'*/*', + 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', + 'Authorization'=>'Basic YXBpOmFwaV9rZXk=', + 'Host'=>'api.wistia.com', + 'User-Agent'=>'Ruby' + } + ) + .to_return( + status: 200, + body: mock_response.fetch(:body), + headers: mock_response.fetch(:headers) + ) + end end diff --git a/spec/services/video_duration_updater_spec.rb b/spec/services/video_duration_updater_spec.rb index 5eba270215..340e23fb98 100644 --- a/spec/services/video_duration_updater_spec.rb +++ b/spec/services/video_duration_updater_spec.rb @@ -112,6 +112,13 @@ length_in_minutes: nil ) + show_response = { + "name" => video.name, + "duration" => 4_265 # seconds + } + + stub_wistia_api_client(response: show_response) + described_class.update_duration(video) video.reload diff --git a/spec/support/wistia_client.rb b/spec/support/wistia_api_client_stubs.rb similarity index 100% rename from spec/support/wistia_client.rb rename to spec/support/wistia_api_client_stubs.rb From c4ce4fadfacbad273bd0a16fe3c56e990e45229b Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 11:51:34 -0700 Subject: [PATCH 11/30] fix linting --- spec/lib/wistia_api_client/media_spec.rb | 12 ++++++------ spec/services/video_duration_updater_spec.rb | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/lib/wistia_api_client/media_spec.rb b/spec/lib/wistia_api_client/media_spec.rb index 94bb4481e8..01e153c6db 100644 --- a/spec/lib/wistia_api_client/media_spec.rb +++ b/spec/lib/wistia_api_client/media_spec.rb @@ -47,16 +47,16 @@ end def mock_wistia_api_response_with(uri:, response: {}) - mock_response = { body: "", headers: {} }.merge(response) + mock_response = {body: "", headers: {}}.merge(response) stub_request(:get, uri) .with( headers: { - 'Accept'=>'*/*', - 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', - 'Authorization'=>'Basic YXBpOmFwaV9rZXk=', - 'Host'=>'api.wistia.com', - 'User-Agent'=>'Ruby' + "Accept" => "*/*", + "Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3", + "Authorization" => "Basic YXBpOmFwaV9rZXk=", + "Host" => "api.wistia.com", + "User-Agent" => "Ruby" } ) .to_return( diff --git a/spec/services/video_duration_updater_spec.rb b/spec/services/video_duration_updater_spec.rb index 340e23fb98..fb035f2476 100644 --- a/spec/services/video_duration_updater_spec.rb +++ b/spec/services/video_duration_updater_spec.rb @@ -113,8 +113,8 @@ ) show_response = { - "name" => video.name, - "duration" => 4_265 # seconds + "name" => video.name, + "duration" => 4_265 # seconds } stub_wistia_api_client(response: show_response) From 8cfdbfb360bf446c55967bf4a56c9a17aa09bffb Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:01:28 -0700 Subject: [PATCH 12/30] try to resolve CI build issues for 7.1 --- .github/workflows/rspec-tests.yml | 5 ++++- spec/spec_helper.rb | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rspec-tests.yml b/.github/workflows/rspec-tests.yml index 55476c0c4d..46298224d9 100644 --- a/.github/workflows/rspec-tests.yml +++ b/.github/workflows/rspec-tests.yml @@ -31,4 +31,7 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true - - run: bundle exec rspec + - name: Run tests + run: | + bin/rails bootsnap:precompile + bundle exec rspec diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8433f80dbe..ec872f078f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -31,3 +31,10 @@ config.example_status_persistence_file_path = "tmp/rspec_examples.txt" end + +Rails.application.config.before_initialize do + if ENV["CI"] + Rails.logger.debug "Load paths frozen: #{$LOAD_PATH.frozen?}" + Rails.logger.debug "Autoload paths: #{Rails.application.config.autoload_paths.frozen?}" + end +end From a1cfac5d02987b544e85888f8d7ea29a46ee4db5 Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:03:31 -0700 Subject: [PATCH 13/30] try to resolve CI build issues for 7.1 --- .github/workflows/rspec-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rspec-tests.yml b/.github/workflows/rspec-tests.yml index 46298224d9..e7efc6ada5 100644 --- a/.github/workflows/rspec-tests.yml +++ b/.github/workflows/rspec-tests.yml @@ -33,5 +33,5 @@ jobs: bundler-cache: true - name: Run tests run: | - bin/rails bootsnap:precompile + rm -rf tmp/cache/bootsnap* bundle exec rspec From 8919787531a721365c628f165777893bfc1003fb Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:05:57 -0700 Subject: [PATCH 14/30] move diagnostic code to a better spot --- spec/rails_helper.rb | 8 ++++++++ spec/spec_helper.rb | 7 ------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 5684e73fe4..2a087c24e2 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -73,3 +73,11 @@ config.infer_spec_type_from_file_location! end + + +Rails.application.config.before_initialize do + if ENV["CI"] + Rails.logger.debug "Load paths frozen: #{$LOAD_PATH.frozen?}" + Rails.logger.debug "Autoload paths: #{Rails.application.config.autoload_paths.frozen?}" + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ec872f078f..8433f80dbe 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -31,10 +31,3 @@ config.example_status_persistence_file_path = "tmp/rspec_examples.txt" end - -Rails.application.config.before_initialize do - if ENV["CI"] - Rails.logger.debug "Load paths frozen: #{$LOAD_PATH.frozen?}" - Rails.logger.debug "Autoload paths: #{Rails.application.config.autoload_paths.frozen?}" - end -end From bdada1aea79c54cb07ad3988c0120770f5c6c348 Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:10:50 -0700 Subject: [PATCH 15/30] retry diagnostic code --- spec/rails_helper.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 2a087c24e2..3202f00cbf 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -74,10 +74,9 @@ config.infer_spec_type_from_file_location! end - Rails.application.config.before_initialize do if ENV["CI"] - Rails.logger.debug "Load paths frozen: #{$LOAD_PATH.frozen?}" - Rails.logger.debug "Autoload paths: #{Rails.application.config.autoload_paths.frozen?}" + $stderr.puts "Load paths frozen: #{$LOAD_PATH.frozen?}" + $stderr.puts "Autoload paths: #{Rails.application.config.autoload_paths.frozen?}" end end From 7ffbd4f231dfcddb98f2a8911e17fe39bbaf3d67 Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:17:46 -0700 Subject: [PATCH 16/30] try to resolve CI build issues for 7.1 --- config/application.rb | 7 +++---- spec/rails_helper.rb | 7 ------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/config/application.rb b/config/application.rb index 1f44dad60d..699dda8dcb 100644 --- a/config/application.rb +++ b/config/application.rb @@ -24,10 +24,9 @@ class Application < Rails::Application # config.time_zone = "Central Time (US & Canada)" # config.eager_load_paths << Rails.root.join("extras") - # config.eager_load_paths += [ - # "#{config.root}/lib", - # "#{config.root}/vendor/lib" - # ] + config.eager_load_paths += [ + "#{config.root}/lib" + ] config.action_mailer.default_url_options = {host: ENV["APP_DOMAIN"]} config.assets.prefix = "/upcase/assets" diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 3202f00cbf..5684e73fe4 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -73,10 +73,3 @@ config.infer_spec_type_from_file_location! end - -Rails.application.config.before_initialize do - if ENV["CI"] - $stderr.puts "Load paths frozen: #{$LOAD_PATH.frozen?}" - $stderr.puts "Autoload paths: #{Rails.application.config.autoload_paths.frozen?}" - end -end From 7cefbf86c2a3b76a5ec203d275caa7e5dd0df19d Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:31:09 -0700 Subject: [PATCH 17/30] restore the older way of load lib directory in case the newer way is overly strict --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 699dda8dcb..2b9133e7b5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -14,7 +14,7 @@ class Application < Rails::Application # 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]) + # config.autoload_lib(ignore: %w[assets tasks]) # Configuration for the application, engines, and railties goes here. # From 5a7b6f626fed911769260a63616d7d5074024fb2 Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:39:41 -0700 Subject: [PATCH 18/30] try to resolve CI build issues for 7.1 --- .github/workflows/rspec-tests.yml | 6 +++++- config/application.rb | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rspec-tests.yml b/.github/workflows/rspec-tests.yml index e7efc6ada5..c7a808372c 100644 --- a/.github/workflows/rspec-tests.yml +++ b/.github/workflows/rspec-tests.yml @@ -27,10 +27,14 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + - name: Clear caches + run: | + rm -rf vendor/bundle + rm -rf ~/.bundle - name: Install Ruby and gems uses: ruby/setup-ruby@v1 with: - bundler-cache: true + bundler-cache: false - name: Run tests run: | rm -rf tmp/cache/bootsnap* diff --git a/config/application.rb b/config/application.rb index 2b9133e7b5..ad853c34a6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -25,7 +25,8 @@ class Application < Rails::Application # config.eager_load_paths << Rails.root.join("extras") config.eager_load_paths += [ - "#{config.root}/lib" + "#{config.root}/lib", + "#{config.root}/vendor/lib" ] config.action_mailer.default_url_options = {host: ENV["APP_DOMAIN"]} From ec4928acb9d91b76628ecadd202a9e93e979b842 Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:42:15 -0700 Subject: [PATCH 19/30] try to resolve CI build issues for 7.1 --- .github/workflows/rspec-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rspec-tests.yml b/.github/workflows/rspec-tests.yml index c7a808372c..d5a4e7b958 100644 --- a/.github/workflows/rspec-tests.yml +++ b/.github/workflows/rspec-tests.yml @@ -38,4 +38,5 @@ jobs: - name: Run tests run: | rm -rf tmp/cache/bootsnap* + bundle install bundle exec rspec From 254a6e638cb3aa0eef444c56fc8b9a6ef58f25cb Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:50:09 -0700 Subject: [PATCH 20/30] try to resolve CI build issues for 7.1 --- config/initializers/new_framework_defaults_7_1.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/initializers/new_framework_defaults_7_1.rb b/config/initializers/new_framework_defaults_7_1.rb index e39bd17a21..85efc2bb72 100644 --- a/config/initializers/new_framework_defaults_7_1.rb +++ b/config/initializers/new_framework_defaults_7_1.rb @@ -17,6 +17,7 @@ # of the bootsnap cache if you use it. #++ # Rails.application.config.add_autoload_paths_to_load_path = false +Rails.application.config.add_autoload_paths_to_load_path = true ### # Remove the default X-Download-Options headers since it is used only by Internet Explorer. From 2ce194267303df23b8460c722643577e6824cd35 Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 12:54:00 -0700 Subject: [PATCH 21/30] try to resolve CI build issues for 7.1 --- config/initializers/new_framework_defaults_7_1.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/config/initializers/new_framework_defaults_7_1.rb b/config/initializers/new_framework_defaults_7_1.rb index 85efc2bb72..e39bd17a21 100644 --- a/config/initializers/new_framework_defaults_7_1.rb +++ b/config/initializers/new_framework_defaults_7_1.rb @@ -17,7 +17,6 @@ # of the bootsnap cache if you use it. #++ # Rails.application.config.add_autoload_paths_to_load_path = false -Rails.application.config.add_autoload_paths_to_load_path = true ### # Remove the default X-Download-Options headers since it is used only by Internet Explorer. From 840f7572a13096735ef6d23fe38e271c201fe16a Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 14:31:21 -0700 Subject: [PATCH 22/30] try to resolve CI build issues for 7.1 --- config/application.rb | 2 +- config/environments/test.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/application.rb b/config/application.rb index ad853c34a6..4cb4fefe08 100644 --- a/config/application.rb +++ b/config/application.rb @@ -31,7 +31,7 @@ class Application < Rails::Application config.action_mailer.default_url_options = {host: ENV["APP_DOMAIN"]} config.assets.prefix = "/upcase/assets" - # config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews" + config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews" # Bypass protection from open redirect attacks # in `redirect_back_or_to` and `redirect_to`. diff --git a/config/environments/test.rb b/config/environments/test.rb index 123729b31c..aec69da596 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -17,9 +17,9 @@ # Settings specified here will take precedence over those in config/application.rb. # While tests run files are not watched, reloading is not necessary. - config.enable_reloading = false + config.enable_reloading = true - # config.action_view.cache_template_loading = true + config.action_view.cache_template_loading = true # 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 From c1b604e8d60e4f728094e0dc8a8d4bc276ed170b Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 14:46:04 -0700 Subject: [PATCH 23/30] try to resolve CI build issues for 7.1 --- spec/rails_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 5684e73fe4..76ebdf282f 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -9,7 +9,8 @@ ENV["RAILS_ENV"] ||= "test" require "spec_helper" -require File.expand_path("../../config/environment", __FILE__) +# require File.expand_path("../../config/environment", __FILE__) +require_relative "../config/environment" require "clearance/rspec" require "email_spec" require "paperclip/matchers" From 7b1462058884481aa334b41b70a8c2795a39df6f Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Thu, 13 Nov 2025 14:53:42 -0700 Subject: [PATCH 24/30] try to diagnose CI build issues for 7.1 --- spec/rails_helper.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 76ebdf282f..9a278857a0 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -7,10 +7,33 @@ end end +TracePoint.trace(:raise) do |tp| + if tp.raised_exception.is_a?(FrozenError) && tp.raised_exception.message.include?("can't modify frozen Array") + puts "=" * 80 + puts "FROZEN ERROR CAUGHT" + puts "Message: #{tp.raised_exception.message}" + puts "Location: #{tp.path}:#{tp.lineno}" + puts "\nBacktrace (first 30 lines):" + puts tp.raised_exception.backtrace.first(30).join("\n") + puts "=" * 80 + end +end +trace = TracePoint.new(:call, :return) do |tp| + if tp.defined_class == Array && tp.method_id == :freeze + caller_info = caller(1, 5).join("\n ") + puts "ARRAY FROZEN at #{tp.path}:#{tp.lineno}" + puts " Caller:\n #{caller_info}" + end +end + ENV["RAILS_ENV"] ||= "test" require "spec_helper" # require File.expand_path("../../config/environment", __FILE__) + +trace.enable require_relative "../config/environment" +trace.disable + require "clearance/rspec" require "email_spec" require "paperclip/matchers" From 66eaa0814447f569b1c981f22ddeeb187325b69c Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Fri, 14 Nov 2025 07:58:12 -0700 Subject: [PATCH 25/30] try to diagnose CI build issues for 7.1 --- config/application.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 4cb4fefe08..806f332212 100644 --- a/config/application.rb +++ b/config/application.rb @@ -31,7 +31,12 @@ class Application < Rails::Application config.action_mailer.default_url_options = {host: ENV["APP_DOMAIN"]} config.assets.prefix = "/upcase/assets" - config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews" +Rails.logger.warn "888888888" +puts "8888888888" +Rails.logger.warn config.action_mailer.preview_paths +puts config.action_mailer.preview_paths + config.action_mailer.preview_paths += "#{Rails.root}/lib/mailer_previews" + # config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews" # Bypass protection from open redirect attacks # in `redirect_back_or_to` and `redirect_to`. From 589a916346fe8ae3c845e44e6fad10c7e21b679a Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Fri, 14 Nov 2025 08:12:13 -0700 Subject: [PATCH 26/30] try to diagnose CI build issues for 7.1 --- config/application.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/config/application.rb b/config/application.rb index 806f332212..5167fe4fcb 100644 --- a/config/application.rb +++ b/config/application.rb @@ -31,11 +31,9 @@ class Application < Rails::Application config.action_mailer.default_url_options = {host: ENV["APP_DOMAIN"]} config.assets.prefix = "/upcase/assets" -Rails.logger.warn "888888888" puts "8888888888" -Rails.logger.warn config.action_mailer.preview_paths puts config.action_mailer.preview_paths - config.action_mailer.preview_paths += "#{Rails.root}/lib/mailer_previews" + config.action_mailer.preview_paths += ["#{Rails.root}/lib/mailer_previews"] # config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews" # Bypass protection from open redirect attacks From d31cb29f9b02c098adf40db88a6a98256c2af61e Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Fri, 14 Nov 2025 08:42:23 -0700 Subject: [PATCH 27/30] try to diagnose CI build issues for 7.1 --- config/application.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/config/application.rb b/config/application.rb index 5167fe4fcb..e1464b80cd 100644 --- a/config/application.rb +++ b/config/application.rb @@ -26,15 +26,13 @@ class Application < Rails::Application config.eager_load_paths += [ "#{config.root}/lib", - "#{config.root}/vendor/lib" + "#{config.root}/vendor/lib", + "#{config.root}/app/mailer_previews" ] config.action_mailer.default_url_options = {host: ENV["APP_DOMAIN"]} config.assets.prefix = "/upcase/assets" -puts "8888888888" -puts config.action_mailer.preview_paths - config.action_mailer.preview_paths += ["#{Rails.root}/lib/mailer_previews"] - # config.action_mailer.preview_paths << "#{Rails.root}/lib/mailer_previews" + config.action_mailer.preview_paths += ["#{Rails.root}/app/mailer_previews"] # Bypass protection from open redirect attacks # in `redirect_back_or_to` and `redirect_to`. From 05e861bd178fbf01de4cd0cf3260a88527f733fe Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Fri, 14 Nov 2025 09:04:17 -0700 Subject: [PATCH 28/30] revert to original workflow re bundling; try remove previews in test to resolve 7.1 build on CI --- .github/workflows/rspec-tests.yml | 11 ++--------- config/environments/test.rb | 3 +++ spec/rails_helper.rb | 23 ----------------------- 3 files changed, 5 insertions(+), 32 deletions(-) diff --git a/.github/workflows/rspec-tests.yml b/.github/workflows/rspec-tests.yml index d5a4e7b958..347c4ce729 100644 --- a/.github/workflows/rspec-tests.yml +++ b/.github/workflows/rspec-tests.yml @@ -27,16 +27,9 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - - name: Clear caches - run: | - rm -rf vendor/bundle - rm -rf ~/.bundle - name: Install Ruby and gems uses: ruby/setup-ruby@v1 with: - bundler-cache: false + bundler-cache: true - name: Run tests - run: | - rm -rf tmp/cache/bootsnap* - bundle install - bundle exec rspec + run: bundle exec rspec diff --git a/config/environments/test.rb b/config/environments/test.rb index aec69da596..8c7ff0e754 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -49,6 +49,9 @@ config.action_mailer.perform_caching = false + config.action_mailer.show_previews = false + config.action_mailer.preview_paths = [] + # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 9a278857a0..76ebdf282f 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -7,33 +7,10 @@ end end -TracePoint.trace(:raise) do |tp| - if tp.raised_exception.is_a?(FrozenError) && tp.raised_exception.message.include?("can't modify frozen Array") - puts "=" * 80 - puts "FROZEN ERROR CAUGHT" - puts "Message: #{tp.raised_exception.message}" - puts "Location: #{tp.path}:#{tp.lineno}" - puts "\nBacktrace (first 30 lines):" - puts tp.raised_exception.backtrace.first(30).join("\n") - puts "=" * 80 - end -end -trace = TracePoint.new(:call, :return) do |tp| - if tp.defined_class == Array && tp.method_id == :freeze - caller_info = caller(1, 5).join("\n ") - puts "ARRAY FROZEN at #{tp.path}:#{tp.lineno}" - puts " Caller:\n #{caller_info}" - end -end - ENV["RAILS_ENV"] ||= "test" require "spec_helper" # require File.expand_path("../../config/environment", __FILE__) - -trace.enable require_relative "../config/environment" -trace.disable - require "clearance/rspec" require "email_spec" require "paperclip/matchers" From 0f20d4b8325a509b7f85b0e80843906b265aae00 Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Fri, 14 Nov 2025 14:50:42 -0700 Subject: [PATCH 29/30] try to fix CI build issues for 7.1 --- Gemfile | 2 +- Gemfile.lock | 112 ++++++++++++----------- spec/lib/wistia_api_client/media_spec.rb | 6 -- 3 files changed, 59 insertions(+), 61 deletions(-) diff --git a/Gemfile b/Gemfile index 7845e9d680..02e45c190b 100644 --- a/Gemfile +++ b/Gemfile @@ -51,7 +51,7 @@ gem "psych" gem "puma" gem "rack", ">= 2.2.14", "< 3.0" gem "rack-rewrite" -gem "rails", "7.1.2" +gem "rails", "7.1.5" gem "recipient_interceptor" gem "redcarpet" gem "redis" diff --git a/Gemfile.lock b/Gemfile.lock index a37279e3fb..6c25ef771e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,35 +1,35 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.1.2) - actionpack (= 7.1.2) - activesupport (= 7.1.2) + actioncable (7.1.5) + actionpack (= 7.1.5) + activesupport (= 7.1.5) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.2) - actionpack (= 7.1.2) - activejob (= 7.1.2) - activerecord (= 7.1.2) - activestorage (= 7.1.2) - activesupport (= 7.1.2) + actionmailbox (7.1.5) + actionpack (= 7.1.5) + activejob (= 7.1.5) + activerecord (= 7.1.5) + activestorage (= 7.1.5) + activesupport (= 7.1.5) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.2) - actionpack (= 7.1.2) - actionview (= 7.1.2) - activejob (= 7.1.2) - activesupport (= 7.1.2) + actionmailer (7.1.5) + actionpack (= 7.1.5) + actionview (= 7.1.5) + activejob (= 7.1.5) + activesupport (= 7.1.5) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.2) - actionview (= 7.1.2) - activesupport (= 7.1.2) + actionpack (7.1.5) + actionview (= 7.1.5) + activesupport (= 7.1.5) nokogiri (>= 1.8.5) racc rack (>= 2.2.4) @@ -37,15 +37,15 @@ GEM rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.2) - actionpack (= 7.1.2) - activerecord (= 7.1.2) - activestorage (= 7.1.2) - activesupport (= 7.1.2) + actiontext (7.1.5) + actionpack (= 7.1.5) + activerecord (= 7.1.5) + activestorage (= 7.1.5) + activesupport (= 7.1.5) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.2) - activesupport (= 7.1.2) + actionview (7.1.5) + activesupport (= 7.1.5) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) @@ -55,30 +55,33 @@ GEM activemodel (>= 4.1) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (7.1.2) - activesupport (= 7.1.2) + activejob (7.1.5) + activesupport (= 7.1.5) globalid (>= 0.3.6) - activemodel (7.1.2) - activesupport (= 7.1.2) - activerecord (7.1.2) - activemodel (= 7.1.2) - activesupport (= 7.1.2) + activemodel (7.1.5) + activesupport (= 7.1.5) + activerecord (7.1.5) + activemodel (= 7.1.5) + activesupport (= 7.1.5) timeout (>= 0.4.0) - activestorage (7.1.2) - actionpack (= 7.1.2) - activejob (= 7.1.2) - activerecord (= 7.1.2) - activesupport (= 7.1.2) + activestorage (7.1.5) + actionpack (= 7.1.5) + activejob (= 7.1.5) + activerecord (= 7.1.5) + activesupport (= 7.1.5) marcel (~> 1.0) - activesupport (7.1.2) + activesupport (7.1.5) 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) acts_as_list (1.2.6) activerecord (>= 6.1) @@ -429,20 +432,20 @@ GEM rackup (1.0.1) rack (< 3) webrick - rails (7.1.2) - actioncable (= 7.1.2) - actionmailbox (= 7.1.2) - actionmailer (= 7.1.2) - actionpack (= 7.1.2) - actiontext (= 7.1.2) - actionview (= 7.1.2) - activejob (= 7.1.2) - activemodel (= 7.1.2) - activerecord (= 7.1.2) - activestorage (= 7.1.2) - activesupport (= 7.1.2) + rails (7.1.5) + actioncable (= 7.1.5) + actionmailbox (= 7.1.5) + actionmailer (= 7.1.5) + actionpack (= 7.1.5) + actiontext (= 7.1.5) + actionview (= 7.1.5) + activejob (= 7.1.5) + activemodel (= 7.1.5) + activerecord (= 7.1.5) + activestorage (= 7.1.5) + activesupport (= 7.1.5) bundler (>= 1.15.0) - railties (= 7.1.2) + railties (= 7.1.5) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -455,9 +458,9 @@ GEM loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) rails_stdout_logging (0.0.5) - railties (7.1.2) - actionpack (= 7.1.2) - activesupport (= 7.1.2) + railties (7.1.5) + actionpack (= 7.1.5) + activesupport (= 7.1.5) irb rackup (>= 1.0.0) rake (>= 12.2) @@ -547,6 +550,7 @@ GEM scenic (1.9.0) activerecord (>= 4.0.0) railties (>= 4.0.0) + securerandom (0.4.1) selenium-webdriver (4.38.0) base64 (~> 0.2) logger (~> 1.4) @@ -703,7 +707,7 @@ DEPENDENCIES rack-livereload rack-mini-profiler rack-rewrite - rails (= 7.1.2) + rails (= 7.1.5) rails-controller-testing rails_stdout_logging recipient_interceptor diff --git a/spec/lib/wistia_api_client/media_spec.rb b/spec/lib/wistia_api_client/media_spec.rb index 01e153c6db..79f42c5bda 100644 --- a/spec/lib/wistia_api_client/media_spec.rb +++ b/spec/lib/wistia_api_client/media_spec.rb @@ -4,8 +4,6 @@ RSpec.describe WistiaApiClient::Media do describe "#list" do it "returns a parsed JSON response" do - pending "needs mocking" - media_client = described_class.new mock_wistia_api_response_with( @@ -22,8 +20,6 @@ end it "combines multi-page responses into a single response" do - pending "needs mocking" - media_client = described_class.new result = media_client.list(limit: 1, starting_page: 1) @@ -34,8 +30,6 @@ describe "#show" do it "returns a parsed JSON response for a single media object" do - pending "needs mocking" - media_client = described_class.new wistia_id = "123foo" From 8fbdb6636b59996de0fe187a2917c9fd36eb1429 Mon Sep 17 00:00:00 2001 From: Richard Newman <114449566+rdnewmanbot@users.noreply.github.com> Date: Fri, 14 Nov 2025 15:00:29 -0700 Subject: [PATCH 30/30] try to fix CI build issues for 7.1 --- config/application.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index e1464b80cd..7bf46a500c 100644 --- a/config/application.rb +++ b/config/application.rb @@ -27,7 +27,8 @@ class Application < Rails::Application config.eager_load_paths += [ "#{config.root}/lib", "#{config.root}/vendor/lib", - "#{config.root}/app/mailer_previews" + "#{config.root}/app/mailer_previews", + "#{config.root}/test/mailers/previews" ] config.action_mailer.default_url_options = {host: ENV["APP_DOMAIN"]}