forked from Shopify/shopify-api-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase_errors_test.rb
28 lines (21 loc) · 954 Bytes
/
base_errors_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# typed: true
# frozen_string_literal: true
require_relative "../test_helper"
module ShopifyAPITest
class BaseErrorsTest < Minitest::Test
def test_outputs_error_message
errors = ShopifyAPI::Rest::BaseErrors.new
errors.errors << StandardError.new("Something went wrong")
errors.errors << StandardError.new("Another thing went wrong")
assert_equal(errors.full_messages, "Something went wrong\nAnother thing went wrong")
end
def test_outputs_error_code
errors = ShopifyAPI::Rest::BaseErrors.new
response = ShopifyAPI::Clients::HttpResponse.new(code: 404, body: {}, headers: {})
errors.errors << ShopifyAPI::Errors::HttpResponseError.new(response: response)
response = ShopifyAPI::Clients::HttpResponse.new(code: 405, body: {}, headers: {})
errors.errors << ShopifyAPI::Errors::HttpResponseError.new(response: response)
assert_equal(errors.codes, [404, 405])
end
end
end