Skip to content

Commit a31088b

Browse files
committed
Improve spec descriptions
1 parent d0830d5 commit a31088b

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

sentry-ruby/spec/sentry/transactions/sample_rand_propagation_spec.rb

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,26 @@
4141
expect(propagation_context.sample_rand).to eq(expected)
4242
end
4343

44-
it "properly handles sampling decisions" do
45-
test_cases = [
46-
{ sample_rand: 0.1, sample_rate: 0.5, should_sample: true },
47-
{ sample_rand: 0.7, sample_rate: 0.5, should_sample: false },
48-
{ sample_rand: 0.5, sample_rate: 0.5, should_sample: false },
49-
{ sample_rand: 0.499999, sample_rate: 0.5, should_sample: true }
50-
]
51-
52-
test_cases.each do |test_case|
53-
Sentry.configuration.traces_sample_rate = test_case[:sample_rate]
44+
[
45+
{ sample_rand: 0.1, sample_rate: 0.5, should_sample: true },
46+
{ sample_rand: 0.7, sample_rate: 0.5, should_sample: false },
47+
{ sample_rand: 0.5, sample_rate: 0.5, should_sample: false },
48+
{ sample_rand: 0.499999, sample_rate: 0.5, should_sample: true }
49+
].each do |test_case|
50+
it "with #{test_case.inspect} - properly handles sampling decisions" do
51+
Sentry.configuration.traces_sample_rate = test_case[:sample_rate]
5452

55-
env = {
56-
"HTTP_SENTRY_TRACE" => "771a43a4192642f0b136d5159a501700-7c51afd529da4a2a-",
57-
"HTTP_BAGGAGE" => "sentry-trace_id=771a43a4192642f0b136d5159a501700,sentry-sample_rand=#{test_case[:sample_rand]}"
58-
}
53+
env = {
54+
"HTTP_SENTRY_TRACE" => "771a43a4192642f0b136d5159a501700-7c51afd529da4a2a-",
55+
"HTTP_BAGGAGE" => "sentry-trace_id=771a43a4192642f0b136d5159a501700,sentry-sample_rand=#{test_case[:sample_rand]}"
56+
}
5957

60-
transaction = Sentry.continue_trace(env, name: "test")
61-
Sentry.start_transaction(transaction: transaction)
58+
transaction = Sentry.continue_trace(env, name: "test")
59+
Sentry.start_transaction(transaction: transaction)
6260

63-
expect(transaction.sampled).to eq(test_case[:should_sample])
64-
end
61+
expect(transaction.sampled).to eq(test_case[:should_sample])
6562
end
63+
end
6664

6765
it "ensures baggage propagation includes correct sample_rand" do
6866
env = {

0 commit comments

Comments
 (0)