From 08b00636a50f6e19214e32a045f25de532056e2c Mon Sep 17 00:00:00 2001 From: Helen Ye Date: Thu, 18 Jan 2024 16:46:51 -0800 Subject: [PATCH] Add test to warn about search being deprecated --- test/stripe/api_operations_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/stripe/api_operations_test.rb b/test/stripe/api_operations_test.rb index e171ee92e..515290197 100644 --- a/test/stripe/api_operations_test.rb +++ b/test/stripe/api_operations_test.rb @@ -39,6 +39,26 @@ def self.protected_fields end end + context ".search" do + should "warn that ._search is deprecated" do + old_stderr = $stderr + $stderr = StringIO.new + begin + stub_request(:post, "#{Stripe.api_base}/v1/customers/search?query=foo:bar") + .to_return(body: JSON.generate(object: "customer")) + + client = StripeClient.new + client.request { Customer._search("/v1/customers/search", query: "foo:bar") } + + message = "NOTE: Stripe::Customer._search is deprecated; use request_stripe_object " \ + "instead. It will be removed on or after 2024-01." + assert_match Regexp.new(message), $stderr.string + ensure + $stderr = old_stderr + end + end + end + context ".nested_resource_class_methods" do class MainResource < APIResource # rubocop:todo Lint/ConstantDefinitionInBlock extend Stripe::APIOperations::NestedResource