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: diff --git a/sentry-rails/Gemfile b/sentry-rails/Gemfile index b4059bf4f..d58657d5b 100644 --- a/sentry-rails/Gemfile +++ b/sentry-rails/Gemfile @@ -30,16 +30,18 @@ rails_version = Gem::Version.new(rails_version) gem "rails", "~> #{rails_version}" -if rails_version >= Gem::Version.new("8.0.0") - gem "rspec-rails" +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" - 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 gem "psych", "~> 3.0.0" 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 = {} 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