-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test transaction contents through extension
Refactor the test suite to not test if transactions are created by asserting method calls. Use the tooling to see if a transaction has been created or not and assert what's set on the transaction using the transaction matchers. Part of #299 Closes #252
- Loading branch information
Showing
12 changed files
with
319 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require "appsignal/integrations/net_http" | ||
|
||
describe Appsignal::Integrations::NetHttpIntegration do | ||
let(:transaction) { http_request_transaction } | ||
before(:context) { start_agent } | ||
before { set_current_transaction transaction } | ||
around { |example| keep_transactions { example.run } } | ||
|
||
it "instruments a http request" do | ||
stub_request(:any, "http://www.google.com/") | ||
|
||
Net::HTTP.get_response(URI.parse("http://www.google.com")) | ||
|
||
expect(transaction).to include_event( | ||
"name" => "request.net_http", | ||
"title" => "GET http://www.google.com" | ||
) | ||
end | ||
|
||
it "instruments a https request" do | ||
stub_request(:any, "https://www.google.com/") | ||
|
||
uri = URI.parse("https://www.google.com") | ||
http = Net::HTTP.new(uri.host, uri.port) | ||
http.use_ssl = true | ||
http.get(uri.request_uri) | ||
|
||
expect(transaction).to include_event( | ||
"name" => "request.net_http", | ||
"title" => "GET https://www.google.com" | ||
) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.