Skip to content

Commit ca58eb5

Browse files
committed
[sentry-ruby] fix and improve spec suite setup
1 parent 4e520fc commit ca58eb5

File tree

69 files changed

+11
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+11
-132
lines changed

sentry-ruby/.rspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
--format documentation
1+
--require spec_helper
2+
--format progress
23
--color
4+
--order rand

sentry-ruby/Rakefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ Bundler::GemHelper.install_tasks(name: "sentry-ruby")
88

99
require "rspec/core/rake_task"
1010

11+
ISOLATED_SPECS = "spec/isolated/**/*_spec.rb"
12+
1113
RSpec::Core::RakeTask.new(:spec).tap do |task|
12-
task.rspec_opts = "--order rand"
13-
task.exclude_pattern = "spec/isolated/**/*_spec.rb"
14+
task.exclude_pattern = ISOLATED_SPECS
1415
end
1516

16-
task :isolated_specs do
17-
Dir["spec/isolated/**/*_spec.rb"].each do |file|
18-
sh "bundle exec rspec #{file}"
19-
end
17+
RSpec::Core::RakeTask.new(:isolated_specs).tap do |task|
18+
task.pattern = ISOLATED_SPECS
2019
end
2120

2221
task default: [:spec, :isolated_specs]

sentry-ruby/spec/initialization_check_spec.rb

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

3-
require "spec_helper"
4-
53
RSpec.describe "with uninitialized SDK" do
64
before do
75
# completely nuke any initialized hubs

sentry-ruby/spec/isolated/init_spec.rb

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

3-
require_relative "../spec_helper"
4-
53
# isolated tests need a SimpleCov name otherwise they will overwrite coverage
64
SimpleCov.command_name "RSpecIsolatedInit"
75

sentry-ruby/spec/isolated/puma_spec.rb

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

33
require "puma"
4-
require_relative "../spec_helper"
4+
5+
# Force-load the patches so that we don't depend on require order
6+
load Pathname(__FILE__).join("../../../lib/sentry/puma.rb").realpath
57

68
# Because puma doesn't have any dependency, if Rack is not installed the entire test won't work
79
return if ENV["RACK_VERSION"] == "0"

sentry-ruby/spec/sentry/background_worker_spec.rb

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

3-
require "spec_helper"
4-
53
RSpec.describe Sentry::BackgroundWorker do
64
let(:string_io) { StringIO.new }
75

sentry-ruby/spec/sentry/backpressure_monitor_spec.rb

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

3-
require 'spec_helper'
4-
53
RSpec.describe Sentry::BackpressureMonitor do
64
let(:string_io) { StringIO.new }
75

sentry-ruby/spec/sentry/backtrace/lines_spec.rb

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

3-
require "spec_helper"
4-
53
RSpec.describe Sentry::Backtrace::Line do
64
before do
75
perform_basic_setup

sentry-ruby/spec/sentry/backtrace_spec.rb

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

3-
require 'spec_helper'
4-
53
RSpec.describe Sentry::Backtrace do
64
let(:fixture_root) { File.join(Dir.pwd, "spec", "support") }
75
let(:fixture_file) { File.join(fixture_root, "stacktrace_test_fixture.rb") }

sentry-ruby/spec/sentry/baggage_spec.rb

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

3-
require "spec_helper"
4-
53
RSpec.describe Sentry::Baggage do
64
let(:malformed_baggage) { "," }
75
let(:third_party_baggage) { "other-vendor-value-1=foo;bar;baz, other-vendor-value-2=foo;bar;" }

0 commit comments

Comments
 (0)