Skip to content

Commit c83cd46

Browse files
committed
WIP
1 parent 8b4883d commit c83cd46

12 files changed

Lines changed: 26 additions & 441 deletions

File tree

sentry-rails/spec/dummy/test_rails_app/app.rb

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@
99
require "action_view/railtie"
1010
require "action_controller/railtie"
1111

12-
require 'sentry/rails'
12+
require "sentry/rails"
13+
14+
ENV["DATABASE_URL"] = "sqlite3::memory:"
1315

1416
ActiveRecord::Base.logger = Logger.new(nil)
1517
ActiveRecord::Migration.verbose = false
1618

17-
class TestApp < Rails::Application
18-
end
19-
2019
v5_2 = Gem::Version.new("5.2")
2120
v6_0 = Gem::Version.new("6.0")
2221
v6_1 = Gem::Version.new("6.1")
2322
v7_0 = Gem::Version.new("7.0")
2423
v7_1 = Gem::Version.new("7.1")
2524

25+
SCHEMA_FILE = File.expand_path("../db/schema.rb", __FILE__)
26+
2627
FILE_NAME =
2728
case Gem::Version.new(Rails.version)
2829
when ->(v) { v.between?(v5_2, v6_0) }
@@ -34,7 +35,7 @@ class TestApp < Rails::Application
3435
when ->(v) { v > v7_0 && v < v7_1 }
3536
"7-0"
3637
when ->(v) { v >= v7_1 }
37-
"7-1"
38+
"latest"
3839
end
3940

4041
# require files and defined relevant setup methods for the Rails version
@@ -43,38 +44,33 @@ class TestApp < Rails::Application
4344
def make_basic_app(&block)
4445
run_pre_initialize_cleanup
4546

46-
app = Class.new(TestApp) do
47+
app = Class.new(Rails::Application) do
4748
def self.name
4849
"RailsTestApp"
4950
end
5051

5152
def load_test_schema
52-
@__test_rails_app_schema_loaded__ ||=
53-
begin
54-
# Load schema from db/schema.rb into the current connection
55-
schema_file = File.expand_path("../db/schema.rb", __FILE__)
56-
load schema_file
57-
58-
Post.all.to_a # to run the sqlite version query first
53+
# Load schema from db/schema.rb into the current connection
54+
load SCHEMA_FILE
5955

60-
# and then clear breadcrumbs in case the above query is recorded
61-
Sentry.get_current_scope.clear_breadcrumbs if Sentry.initialized?
56+
Post.all.to_a # to run the sqlite version query first
6257

63-
true
64-
end
58+
# and then clear breadcrumbs in case the above query is recorded
59+
Sentry.get_current_scope.clear_breadcrumbs if Sentry.initialized?
6560
end
6661
end
6762

63+
app.config.root = Pathname(__dir__).expand_path
64+
app.config.logger = ActiveSupport::Logger.new(nil)
6865
app.config.active_support.deprecation = :silence
6966
app.config.action_controller.view_paths = "spec/dummy/test_rails_app"
7067
app.config.hosts = nil
7168
app.config.secret_key_base = "test"
7269
app.config.sdk_logger = ActiveSupport::Logger.new(nil)
73-
app.config.eager_load = false
70+
app.config.eager_load = true
7471
app.config.active_job.queue_adapter = :test
7572
app.config.cache_store = :memory_store
7673
app.config.action_controller.perform_caching = true
77-
app.config.filter_parameters += [:password, :secret]
7874

7975
# Eager load namespaces can be accumulated after repeated initializations and make initialization
8076
# slower after each run
@@ -87,11 +83,12 @@ def load_test_schema
8783

8884
# Configure parameter filtering for consistent test behavior
8985
app.config.filter_parameters.concat(
90-
[:custom_secret,
86+
[:password,
87+
:secret,
88+
:custom_secret,
9189
:api_key,
9290
:credit_card,
9391
:authorization,
94-
:password,
9592
:token]
9693
)
9794
app.config.filter_parameters.uniq!

sentry-rails/spec/dummy/test_rails_app/apps/5-2.rb

Lines changed: 0 additions & 74 deletions
This file was deleted.

sentry-rails/spec/dummy/test_rails_app/apps/6-0.rb

Lines changed: 0 additions & 74 deletions
This file was deleted.

sentry-rails/spec/dummy/test_rails_app/apps/6-1.rb

Lines changed: 0 additions & 75 deletions
This file was deleted.

sentry-rails/spec/dummy/test_rails_app/apps/7-0.rb

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)