Skip to content

Commit 5f0c121

Browse files
committed
squash: remove global vars
1 parent ee4690a commit 5f0c121

File tree

7 files changed

+8
-12
lines changed

7 files changed

+8
-12
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
# Appraisals
1414
instrumentation/**/gemfiles
15+
instrumentation/**/tmp/**/*
1516

1617
# Sqlite file for tests
1718
instrumentation/active_record/db
@@ -26,3 +27,4 @@ instrumentation/active_record/db
2627
.ruby-version
2728

2829
tags
30+
!**/*/.gitkeep

instrumentation/rails/test/instrumentation/opentelemetry/instrumentation/rails/patches/action_controller/metal_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
let(:exporter) { EXPORTER }
1313
let(:spans) { exporter.finished_spans }
1414
let(:span) { exporter.finished_spans.last }
15-
let(:rails_app) { DEFAULT_RAILS_APP }
15+
let(:rails_app) { AppConfig.initialize_app }
1616

1717
# Clear captured spans
1818
before { exporter.reset }

instrumentation/rails/test/instrumentation/test_helper.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,3 @@
2323
c.use_all
2424
c.add_span_processor span_processor
2525
end
26-
27-
# Create a globally available Rails app, this should be used in test unless
28-
# specifically testing behaviour with different initialization configs.
29-
DEFAULT_RAILS_APP = AppConfig.initialize_app
30-
Rails.application = DEFAULT_RAILS_APP

instrumentation/rails/test/instrumentation/test_helpers/app_config.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
#
55
# SPDX-License-Identifier: Apache-2.0
66

7-
class Application < Rails::Application; end
87
require 'action_controller/railtie'
8+
class Application < Rails::Application; end
9+
910
require_relative 'middlewares'
1011
require_relative 'controllers'
1112
require_relative 'routes'
@@ -46,9 +47,7 @@ def initialize_app(use_exceptions_app: false, remove_rack_tracer_middleware: fal
4647
private
4748

4849
def remove_rack_middleware(application)
49-
application.middleware.delete(
50-
OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware
51-
)
50+
application.middleware.delete(Rack::Events)
5251
end
5352

5453
def add_exceptions_app(application)

instrumentation/rails/test/instrumentation/test_helpers/controllers/example_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ def ok
1212
end
1313

1414
def internal_server_error
15-
raise :internal_server_error
15+
raise 'internal_server_error'
1616
end
1717
end

instrumentation/rails/test/instrumentation/test_helpers/routes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def draw_routes(rails_app)
88
rails_app.routes.draw do
9-
get '/ok', to: 'example#ok'
9+
get 'ok', to: 'example#ok'
1010
get '/internal_server_error', to: 'example#internal_server_error'
1111
end
1212
end

instrumentation/rails/test/railtie/dummy/tmp/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)