Sha256: 37a97b4a3d2765f976503caf69e69e6e646f411f64695898ed8c5a3251218f31

Contents?: true

Size: 1.34 KB

Versions: 8

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

require_relative "../test_helper"

module Telnyx
  class TelnyxErrorTest < Test::Unit::TestCase
    context "#to_s" do
      should "convert to string" do
        e = TelnyxError.new([{ "title" => "Missing required attributes" }])
        assert_equal 'Missing required attributes Full details: [{"title"=>"Missing required attributes"}]', e.to_s

        e = TelnyxError.new([{ "title" => "Missing required attributes" }], http_status: 422)
        assert_equal '(Status 422) Missing required attributes Full details: [{"title"=>"Missing required attributes"}]', e.to_s

        e = TelnyxError.new([{ "title" => "Missing required attributes" }], http_status: nil, http_body: nil, json_body: nil, http_headers: { request_id: "request-id" })
        assert_equal '(Request request-id) Missing required attributes Full details: [{"title"=>"Missing required attributes"}]', e.to_s

        e = TelnyxError.new([{ "title" => "Missing required attributes" }, { "title" => "Phone number must be in +E.164 format" }], http_status: nil, http_body: nil, json_body: nil, http_headers: { request_id: "request-id" })
        assert_equal '(Request request-id) Missing required attributes plus 1 other error. Full details: [{"title"=>"Missing required attributes"}, {"title"=>"Phone number must be in +E.164 format"}]', e.to_s
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
telnyx-3.0.5 test/telnyx/errors_test.rb
telnyx-3.0.4 test/telnyx/errors_test.rb
telnyx-3.0.3 test/telnyx/errors_test.rb
telnyx-3.0.2 test/telnyx/errors_test.rb
telnyx-3.0.0 test/telnyx/errors_test.rb
telnyx-2.9.0 test/telnyx/errors_test.rb
telnyx-2.8.0 test/telnyx/errors_test.rb
telnyx-2.7.0 test/telnyx/errors_test.rb