Skip to content

Commit

Permalink
Add test to warn about search being deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
helenye-stripe committed Jan 19, 2024
1 parent 37fa3c1 commit 08b0063
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/stripe/api_operations_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 08b0063

Please sign in to comment.