test/stripe/stripe_client_test.rb in stripe-5.0.1 vs test/stripe/stripe_client_test.rb in stripe-5.1.0

- old
+ new

@@ -120,10 +120,16 @@ should "retry on a 409 Conflict" do assert StripeClient.should_retry?(Stripe::StripeError.new(http_status: 409), method: :post, num_retries: 0) end + should "retry on a 429 Too Many Requests when lock timeout" do + assert StripeClient.should_retry?(Stripe::StripeError.new(http_status: 429, + code: "lock_timeout"), + method: :post, num_retries: 0) + end + should "retry on a 500 Internal Server Error when non-POST" do assert StripeClient.should_retry?(Stripe::StripeError.new(http_status: 500), method: :get, num_retries: 0) end @@ -137,9 +143,15 @@ method: :post, num_retries: Stripe.max_network_retries) end should "not retry on a certificate validation error" do refute StripeClient.should_retry?(OpenSSL::SSL::SSLError.new, + method: :post, num_retries: 0) + end + + should "not retry on a 429 Too Many Requests when not lock timeout" do + refute StripeClient.should_retry?(Stripe::StripeError.new(http_status: 429, + code: "rate_limited"), method: :post, num_retries: 0) end should "not retry on a 500 Internal Server Error when POST" do refute StripeClient.should_retry?(Stripe::StripeError.new(http_status: 500),