Skip to content

Commit

Permalink
Stripe testing update (#2891)
Browse files Browse the repository at this point in the history
* Update Stripe test

Co-authored-by: James Bunch <fallwith@gmail.com>

---------

Co-authored-by: James Bunch <fallwith@gmail.com>
  • Loading branch information
hannahramadan and fallwith authored Oct 4, 2024
1 parent f4f1305 commit ffea529
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 1 addition & 2 deletions test/multiverse/suites/stripe/Envfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
instrumentation_methods :chain

STRIPE_VERSIONS = [
# TODO: support Stripe v13+ https://github.com/newrelic/newrelic-ruby-agent/issues/2884
# [nil, 2.4],
[nil, 2.4],
['12.6.0', 2.4],
['5.38.0', 2.4]
]
Expand Down
16 changes: 13 additions & 3 deletions test/multiverse/suites/stripe/stripe_instrumentation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,19 @@ def stripe_segment_from_transaction(txn)
end

def with_stubbed_connection_manager(&block)
Stripe::StripeClient.stub(:default_connection_manager, @connection) do
@connection.stub(:execute_request, @response) do
yield
# Stripe moved StripeClient and requestor logic to APIRequestor in v13.0.0
# https://github.com/stripe/stripe-ruby/pull/1458
if Gem::Version.new(Stripe::VERSION) >= Gem::Version.new('13.0.0')
Stripe::APIRequestor.stub(:default_connection_manager, @connection) do
@connection.stub(:execute_request, @response) do
yield
end
end
else
Stripe::StripeClient.stub(:default_connection_manager, @connection) do
@connection.stub(:execute_request, @response) do
yield
end
end
end
end
Expand Down

0 comments on commit ffea529

Please sign in to comment.