Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/sentry_rails_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 7 additions & 5 deletions sentry-rails/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion sentry-rails/bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down
19 changes: 9 additions & 10 deletions sentry-rails/spec/dummy/test_rails_app/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions sentry-rails/spec/dummy/test_rails_app/configs/7-1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions sentry-rails/spec/dummy/test_rails_app/configs/7-2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions sentry-rails/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
end

reset_sentry_globals!

Rails.application = nil
end

config.before :each do
Expand Down
Loading