Skip to content

Commit e9b0899

Browse files
committed
Fix coverage by making sure isolated specs have SimpleCov.command_name
1 parent c509ce1 commit e9b0899

File tree

6 files changed

+11
-5
lines changed

6 files changed

+11
-5
lines changed

sentry-rails/Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace :spec do
2626
end
2727

2828
task :isolated_specs do
29-
Dir["spec/isolated/*"].each do |file|
29+
Dir["spec/isolated/**/*_spec.rb"].each do |file|
3030
sh "bundle exec ruby #{file}"
3131
end
3232
end

sentry-rails/spec/isolated/active_job_activation.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
require "sentry/rails"
1414
require "minitest/autorun"
1515

16+
# isolated tests need a SimpleCov name otherwise they will overwrite coverage
17+
SimpleCov.command_name "RailsIsolatedActiveJobActivation"
18+
1619
class TestApp < Rails::Application
1720
end
1821

sentry-ruby/Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RSpec::Core::RakeTask.new(:spec).tap do |task|
1414
end
1515

1616
task :isolated_specs do
17-
Dir["spec/isolated/*"].each do |file|
17+
Dir["spec/isolated/**/*_spec.rb"].each do |file|
1818
sh "bundle exec rspec #{file}"
1919
end
2020
end

sentry-ruby/spec/isolated/init.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

3-
require_relative "../spec_helper"
3+
require "sentry-ruby"
4+
require "sentry/test_helper"
45

56
Sentry.init do |config|
67
config.dsn = Sentry::TestHelper::DUMMY_DSN

sentry-ruby/spec/isolated/init_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
require_relative "../spec_helper"
44

5-
SimpleCov.command_name "RSpecIsolated"
5+
# isolated tests need a SimpleCov name otherwise they will overwrite coverage
6+
SimpleCov.command_name "RSpecIsolatedInit"
67

78
RSpec.describe Sentry do
89
context "works within a trap context", when: { ruby_engine?: "ruby" } do

sentry-ruby/spec/isolated/puma_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
# Because puma doesn't have any dependency, if Rack is not installed the entire test won't work
77
return if ENV["RACK_VERSION"] == "0"
88

9-
SimpleCov.command_name "RSpecIsolated"
9+
# isolated tests need a SimpleCov name otherwise they will overwrite coverage
10+
SimpleCov.command_name "RSpecIsolatedPuma"
1011

1112
RSpec.describe Puma::Server do
1213
class TestServer

0 commit comments

Comments
 (0)