Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tests for multi clients #166

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Unreleased

# v 1.0.1
- Send the current client instance to the initializer of the client resource #165
[#165](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/165) @omarowns

# v 1.0.0
- Implement a Better response API [159](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/156)
- Implement a Better API for calling the Cloud API [156](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/156)
Expand Down
2 changes: 1 addition & 1 deletion lib/whatsapp_sdk/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module WhatsappSdk
VERSION = "1.0.1"
VERSION = "1.0.2"
end
23 changes: 23 additions & 0 deletions test/whatsapp/api/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,29 @@ def test_templates
assert_equal(WhatsappSdk::Api::Templates, @client.templates.class)
end

%i[
media
messages
phone_numbers
business_profiles
templates
].each do |api|
define_method("test_#{api}_keeps_same_client") do
api = @client.send(api)

@client.expects(:send_request).with(
http_method: "delete",
full_url: nil,
endpoint: "/1",
params: {},
headers: {},
multipart: false
).returns({ "success" => true })

api.send_request(http_method: "delete", endpoint: "/1")
end
end

private

def stub_test_request(method_name, body: {}, headers: {}, response_status: 200, response_body: { success: true },
Expand Down
2 changes: 1 addition & 1 deletion test/whatsapp/version_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

class VersionTest < Minitest::Test
def test_that_it_has_a_version_number
assert_equal("1.0.1", WhatsappSdk::VERSION)
assert_equal("1.0.2", WhatsappSdk::VERSION)
end
end
Loading