Skip to content

Commit

Permalink
Add missing specs
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikspang committed Oct 22, 2024
1 parent cafeac9 commit 16f9c6f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
21 changes: 21 additions & 0 deletions sentry-ruby/spec/sentry/excon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
context "with config.send_default_pii = true" do
before do
Sentry.configuration.send_default_pii = true
Sentry.configuration.breadcrumbs_logger = [:http_logger]
end

it "records the request's span with query string in data" do
Expand Down Expand Up @@ -85,6 +86,26 @@
"http.query" => "foo=bar"
})
end

it "records breadcrumbs" do
Excon.stub({}, { body: '', status: 200 })

transaction = Sentry.start_transaction
Sentry.get_current_scope.set_span(transaction)

_response = Excon.get(URI("http://example.com/path?foo=bar"), mock: true)

transaction.span_recorder.spans.last

crumb = Sentry.get_current_scope.breadcrumbs.peek

expect(crumb.category).to eq("http")
expect(crumb.data[:status]).to eq(200)
expect(crumb.data[:method]).to eq("GET")
expect(crumb.data[:url]).to eq("http://example.com/path")
expect(crumb.data[:query]).to eq("foo=bar")
expect(crumb.data[:body]).to be(nil)
end
end

context "with config.send_default_pii = false" do
Expand Down
10 changes: 10 additions & 0 deletions sentry-ruby/spec/sentry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1235,5 +1235,15 @@ def foo; end
expect(target_class.instance_methods).to include(:foo)
end
end

context "with patch and block" do
it "raises error" do
expect do
described_class.register_patch(:bad_patch, module_patch, target_class) do
target_class.send(:prepend, module_patch)
end
end.to raise_error(ArgumentError, "Please provide either a patch and its target OR a block, but not both")
end
end
end
end

0 comments on commit 16f9c6f

Please sign in to comment.