From 771a18d57ad35c01d0f19758cdd2aea458fc42af Mon Sep 17 00:00:00 2001 From: Peter Solnica Date: Fri, 31 Oct 2025 08:53:45 +0100 Subject: [PATCH 1/5] fix(rails): set correct rspec-rails version specs --- sentry-rails/Gemfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sentry-rails/Gemfile b/sentry-rails/Gemfile index b4059bf4f..68109dc2b 100644 --- a/sentry-rails/Gemfile +++ b/sentry-rails/Gemfile @@ -31,14 +31,14 @@ rails_version = Gem::Version.new(rails_version) gem "rails", "~> #{rails_version}" if rails_version >= Gem::Version.new("8.0.0") - gem "rspec-rails" + gem "rspec-rails", "~> 8.0" gem "sqlite3", "~> 2.1.1", platform: :ruby elsif rails_version >= Gem::Version.new("7.1.0") gem "psych", "~> 4.0.0" - gem "rspec-rails" + gem "rspec-rails", "~> 7.0" gem "sqlite3", "~> 1.7.3", platform: :ruby elsif rails_version >= Gem::Version.new("6.1.0") - gem "rspec-rails", "~> 4.0" + gem "rspec-rails", "~> 6.0" gem "sqlite3", "~> 1.7.3", platform: :ruby else From d0fea2ede9c92654e01dd0e259b8b1b023261be3 Mon Sep 17 00:00:00 2001 From: Peter Solnica Date: Fri, 31 Oct 2025 14:31:26 +0100 Subject: [PATCH 2/5] chore(rails): support 8.1 in the Gemfile --- sentry-rails/Gemfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sentry-rails/Gemfile b/sentry-rails/Gemfile index 68109dc2b..d58657d5b 100644 --- a/sentry-rails/Gemfile +++ b/sentry-rails/Gemfile @@ -30,8 +30,11 @@ rails_version = Gem::Version.new(rails_version) gem "rails", "~> #{rails_version}" -if rails_version >= Gem::Version.new("8.0.0") - gem "rspec-rails", "~> 8.0" +if rails_version >= Gem::Version.new("8.1.0") + gem "rspec-rails", "~> 8.0.0" + gem "sqlite3", "~> 2.1.1", platform: :ruby +elsif rails_version >= Gem::Version.new("8.0.0") + gem "rspec-rails", "~> 8.0.0" gem "sqlite3", "~> 2.1.1", platform: :ruby elsif rails_version >= Gem::Version.new("7.1.0") gem "psych", "~> 4.0.0" @@ -39,7 +42,6 @@ elsif rails_version >= Gem::Version.new("7.1.0") gem "sqlite3", "~> 1.7.3", platform: :ruby elsif rails_version >= Gem::Version.new("6.1.0") gem "rspec-rails", "~> 6.0" - gem "sqlite3", "~> 1.7.3", platform: :ruby else gem "psych", "~> 3.0.0" From 8d9eeaeac3ed07fb0b0fe96d2e944fa91e5d93c3 Mon Sep 17 00:00:00 2001 From: Peter Solnica Date: Thu, 30 Oct 2025 16:00:41 +0100 Subject: [PATCH 3/5] chore(rails): update versions in bin/test --- sentry-rails/bin/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sentry-rails/bin/test b/sentry-rails/bin/test index 0e7cafce2..1eb52afb3 100755 --- a/sentry-rails/bin/test +++ b/sentry-rails/bin/test @@ -24,7 +24,7 @@ require 'optparse' require 'fileutils' class RailsVersionTester - SUPPORTED_VERSIONS = %w[5.0 5.1 5.2 6.0 6.1 7.0 7.1 7.2 8.0].freeze + SUPPORTED_VERSIONS = %w[5.2 6.0 6.1 7.0 7.1 7.2 8.0 8.1].freeze def initialize @options = {} From f51588969a4b0954c7a6be9b5025c8420894fdf9 Mon Sep 17 00:00:00 2001 From: Peter Solnica Date: Fri, 31 Oct 2025 14:36:07 +0100 Subject: [PATCH 4/5] chore(rails): add 8.1.0 to matrix --- .github/workflows/sentry_rails_test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/sentry_rails_test.yml b/.github/workflows/sentry_rails_test.yml index 30d9ea4da..5f9d80c58 100644 --- a/.github/workflows/sentry_rails_test.yml +++ b/.github/workflows/sentry_rails_test.yml @@ -51,6 +51,8 @@ jobs: rails_version: "8.0.0" - ruby_version: "3.4" rails_version: "8.0.0" + - ruby_version: "3.4" + rails_version: "8.1.0" - ruby_version: "3.2" rails_version: 7.1.0 options: From 2bdf4ff8f3959cbdac079226d68e2f01da39bea9 Mon Sep 17 00:00:00 2001 From: Peter Solnica Date: Mon, 3 Nov 2025 12:45:36 +0100 Subject: [PATCH 5/5] fix(rails): avoid filter_parameters accumulation between spec runs --- sentry-rails/spec/dummy/test_rails_app/app.rb | 19 +++++++++---------- .../spec/dummy/test_rails_app/configs/7-1.rb | 4 ++++ .../spec/dummy/test_rails_app/configs/7-2.rb | 4 ++++ sentry-rails/spec/spec_helper.rb | 2 ++ 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/sentry-rails/spec/dummy/test_rails_app/app.rb b/sentry-rails/spec/dummy/test_rails_app/app.rb index 2d46ceb11..1522bb73d 100644 --- a/sentry-rails/spec/dummy/test_rails_app/app.rb +++ b/sentry-rails/spec/dummy/test_rails_app/app.rb @@ -58,7 +58,6 @@ def self.name app.config.active_job.queue_adapter = :test app.config.cache_store = :memory_store app.config.action_controller.perform_caching = true - app.config.filter_parameters += [:password, :secret] # Eager load namespaces can be accumulated after repeated initializations and make initialization # slower after each run @@ -70,15 +69,15 @@ def self.name configure_app(app) # Configure parameter filtering for consistent test behavior - app.config.filter_parameters.concat( - [:custom_secret, - :api_key, - :credit_card, - :authorization, - :password, - :token] - ) - app.config.filter_parameters.uniq! + app.config.filter_parameters = [ + :password, + :secret, + :custom_secret, + :api_key, + :credit_card, + :authorization, + :token + ] app.routes.append do get "/exception", to: "hello#exception" diff --git a/sentry-rails/spec/dummy/test_rails_app/configs/7-1.rb b/sentry-rails/spec/dummy/test_rails_app/configs/7-1.rb index d0126d985..4a0a79580 100644 --- a/sentry-rails/spec/dummy/test_rails_app/configs/7-1.rb +++ b/sentry-rails/spec/dummy/test_rails_app/configs/7-1.rb @@ -30,6 +30,10 @@ def run_pre_initialize_cleanup # Rails 7.1 stores the error reporter directly under the ActiveSupport class. # So we need to make sure the subscriber is not subscribed unexpectedly before any tests ActiveSupport.error_reporter.unsubscribe(Sentry::Rails::ErrorSubscriber) + + if ActiveSupport.respond_to?(:filter_parameters) + ActiveSupport.filter_parameters.clear + end end def configure_app(app) diff --git a/sentry-rails/spec/dummy/test_rails_app/configs/7-2.rb b/sentry-rails/spec/dummy/test_rails_app/configs/7-2.rb index d0126d985..4a0a79580 100644 --- a/sentry-rails/spec/dummy/test_rails_app/configs/7-2.rb +++ b/sentry-rails/spec/dummy/test_rails_app/configs/7-2.rb @@ -30,6 +30,10 @@ def run_pre_initialize_cleanup # Rails 7.1 stores the error reporter directly under the ActiveSupport class. # So we need to make sure the subscriber is not subscribed unexpectedly before any tests ActiveSupport.error_reporter.unsubscribe(Sentry::Rails::ErrorSubscriber) + + if ActiveSupport.respond_to?(:filter_parameters) + ActiveSupport.filter_parameters.clear + end end def configure_app(app) diff --git a/sentry-rails/spec/spec_helper.rb b/sentry-rails/spec/spec_helper.rb index 4a8640f5f..85760781a 100644 --- a/sentry-rails/spec/spec_helper.rb +++ b/sentry-rails/spec/spec_helper.rb @@ -64,6 +64,8 @@ end reset_sentry_globals! + + Rails.application = nil end config.before :each do