Skip to content

Commit 7d6edaf

Browse files
committed
Fix specs after rebase
1 parent d7522f9 commit 7d6edaf

File tree

7 files changed

+25
-25
lines changed

7 files changed

+25
-25
lines changed

sentry-rails/spec/sentry/rails/tracing/active_support_subscriber_spec.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
transaction.finish
2424

2525
expect(transport.events.count).to eq(1)
26-
cache_transaction = transport.events.first.to_hash
26+
cache_transaction = transport.events.first.to_h
2727
expect(cache_transaction[:type]).to eq("transaction")
2828

2929
expect(cache_transaction[:spans].count).to eq(1)
@@ -45,7 +45,7 @@
4545

4646
expect(Rails.cache.read("my_cache_key")).to eq(1)
4747
expect(transport.events.count).to eq(1)
48-
cache_transaction = transport.events.first.to_hash
48+
cache_transaction = transport.events.first.to_h
4949
expect(cache_transaction[:type]).to eq("transaction")
5050
expect(cache_transaction[:spans].count).to eq(1)
5151
expect(cache_transaction[:spans][0][:op]).to eq("cache.put")
@@ -64,7 +64,7 @@
6464
transaction.finish
6565

6666
expect(transport.events.count).to eq(1)
67-
cache_transaction = transport.events.first.to_hash
67+
cache_transaction = transport.events.first.to_h
6868
expect(cache_transaction[:type]).to eq("transaction")
6969
expect(cache_transaction[:spans].count).to eq(1)
7070
expect(cache_transaction[:spans][0][:op]).to eq("cache.put")
@@ -79,7 +79,7 @@
7979
transaction.finish
8080

8181
expect(transport.events.count).to eq(1)
82-
cache_transaction = transport.events.first.to_hash
82+
cache_transaction = transport.events.first.to_h
8383
expect(cache_transaction[:type]).to eq("transaction")
8484
expect(cache_transaction[:spans].count).to eq(1)
8585
expect(cache_transaction[:spans][0][:op]).to eq("cache.get")
@@ -95,7 +95,7 @@
9595
transaction.finish
9696

9797
expect(transport.events.count).to eq(1)
98-
cache_transaction = transport.events.first.to_hash
98+
cache_transaction = transport.events.first.to_h
9999
expect(cache_transaction[:type]).to eq("transaction")
100100
expect(cache_transaction[:spans].count).to eq(1)
101101
expect(cache_transaction[:spans][0][:op]).to eq("cache.get")
@@ -112,7 +112,7 @@
112112
transaction.finish
113113

114114
expect(transport.events.count).to eq(1)
115-
cache_transaction = transport.events.first.to_hash
115+
cache_transaction = transport.events.first.to_h
116116
expect(cache_transaction[:type]).to eq("transaction")
117117
expect(cache_transaction[:spans].count).to eq(2)
118118
expect(cache_transaction[:spans][1][:op]).to eq("cache.flush")
@@ -130,7 +130,7 @@
130130

131131
transaction.finish
132132
expect(transport.events.count).to eq(1)
133-
cache_transaction = transport.events.first.to_hash
133+
cache_transaction = transport.events.first.to_h
134134
expect(cache_transaction[:type]).to eq("transaction")
135135
expect(cache_transaction[:spans].count).to eq(2)
136136
expect(cache_transaction[:spans][0][:op]).to eq("cache.get")
@@ -152,7 +152,7 @@
152152

153153
transaction.finish
154154
expect(transport.events.count).to eq(1)
155-
cache_transaction = transport.events.first.to_hash
155+
cache_transaction = transport.events.first.to_h
156156
expect(cache_transaction[:type]).to eq("transaction")
157157
expect(cache_transaction[:spans].count).to eq(1)
158158
expect(cache_transaction[:spans][0][:op]).to eq("cache.remove")

sentry-rails/spec/sentry/rails/tracing_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117

118118
it "does not record sensitive params" do
119119
get "/posts?foo=bar&password=42&secret=baz"
120-
transaction = transport.events.last.to_hash
120+
transaction = transport.events.last.to_h
121121

122122
params = transaction[:spans][0][:data][:params]
123123
expect(params["foo"]).to eq("bar")
@@ -139,7 +139,7 @@
139139

140140
it "records all params" do
141141
get "/posts?foo=bar&password=42&secret=baz"
142-
transaction = transport.events.last.to_hash
142+
transaction = transport.events.last.to_h
143143

144144
params = transaction[:spans][0][:data][:params]
145145
expect(params["foo"]).to eq("bar")

sentry-ruby/lib/sentry/rspec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def find_matched_event(event_message, sentry_events)
7070
end
7171

7272
def dump_events(sentry_events)
73-
sentry_events.map(&Kernel.method(:Hash)).map do |hash|
73+
sentry_events.map(&:to_h).map do |hash|
7474
hash.select { |k, _| [:message, :contexts, :tags, :exception].include?(k) }
7575
end.map do |hash|
7676
JSON.pretty_generate(hash)

sentry-ruby/lib/sentry/vernier/profiler.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def active_thread_id
8888
Thread.current.object_id
8989
end
9090

91-
def to_hash
91+
def to_h
9292
return EMPTY_RESULT unless @started
9393

9494
unless @sampled

sentry-ruby/spec/sentry/event_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
it "doesn't overwrite already set ip address" do
147147
Sentry.set_user({ ip_address: "3.3.3.3" })
148148
Sentry.get_current_scope.apply_to_event(event)
149-
expect(event.to_hash[:user][:ip_address]).to eq("3.3.3.3")
149+
expect(event.to_h[:user][:ip_address]).to eq("3.3.3.3")
150150
end
151151

152152
context "with config.trusted_proxies = [\"2.2.2.2\"]" do

sentry-ruby/spec/sentry/profiler_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
end
182182

183183
it 'returns empty' do
184-
expect(subject.to_hash).to eq({})
184+
expect(subject.to_h).to eq({})
185185
end
186186

187187
it 'records lost event' do

sentry-ruby/spec/sentry/vernier/profiler_spec.rb

+11-11
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
end
150150
end
151151

152-
describe "#to_hash" do
152+
describe "#to_h" do
153153
let (:transport) { Sentry.get_current_client.transport }
154154

155155

@@ -160,7 +160,7 @@
160160
profiler.start
161161
profiler.set_initial_sample_decision(false)
162162

163-
expect(profiler.to_hash).to eq({})
163+
expect(profiler.to_h).to eq({})
164164
end
165165
end
166166

@@ -169,9 +169,9 @@
169169
profiler.set_initial_sample_decision(true)
170170
end
171171

172-
describe '#to_hash' do
172+
describe '#to_h' do
173173
it "returns empty hash if not started" do
174-
expect(profiler.to_hash).to eq({})
174+
expect(profiler.to_h).to eq({})
175175
end
176176

177177
context 'with single-thread profiled code' do
@@ -182,7 +182,7 @@
182182
end
183183

184184
it 'has correct frames' do
185-
frames = profiler.to_hash[:profile][:frames]
185+
frames = profiler.to_h[:profile][:frames]
186186

187187
foo_frame = frames.find { |f| f[:function] =~ /foo/ }
188188

@@ -195,7 +195,7 @@
195195
end
196196

197197
it 'has correct stacks' do
198-
profile = profiler.to_hash[:profile]
198+
profile = profiler.to_h[:profile]
199199
frames = profile[:frames]
200200
stacks = profile[:stacks]
201201

@@ -213,7 +213,7 @@
213213
end
214214

215215
it 'has correct samples' do
216-
profile = profiler.to_hash[:profile]
216+
profile = profiler.to_h[:profile]
217217
samples = profile[:samples]
218218
last_elapsed = 0
219219

@@ -252,7 +252,7 @@
252252
end
253253

254254
it "has correct thread metadata" do
255-
thread_metadata = profiler.to_hash[:profile][:thread_metadata]
255+
thread_metadata = profiler.to_h[:profile][:thread_metadata]
256256

257257
main_thread = thread_metadata.values.find { |metadata| metadata[:name].include?("rspec") }
258258
thread1 = thread_metadata.values.find { |metadata| metadata[:name] == "thread-bar-0" }
@@ -268,7 +268,7 @@
268268
end
269269

270270
it 'has correct frames', when: { ruby_version?: [:>=, "3.3"] } do
271-
frames = profiler.to_hash[:profile][:frames]
271+
frames = profiler.to_h[:profile][:frames]
272272

273273
foo_frame = frames.find { |f| f[:function] =~ /foo/ }
274274

@@ -281,7 +281,7 @@
281281
end
282282

283283
it 'has correct stacks', when: { ruby_version?: [:>=, "3.3"] } do
284-
profile = profiler.to_hash[:profile]
284+
profile = profiler.to_h[:profile]
285285
frames = profile[:frames]
286286
stacks = profile[:stacks]
287287

@@ -299,7 +299,7 @@
299299
end
300300

301301
it 'has correct samples' do
302-
profile = profiler.to_hash[:profile]
302+
profile = profiler.to_h[:profile]
303303
samples = profile[:samples]
304304

305305
samples.group_by { |sample| sample[:thread_id] }.each do |thread_id, thread_samples|

0 commit comments

Comments
 (0)