Sha256: d65704ec943604cba956b3d88e6ff4cb7efaad0c0f2fa955b0f7e30c4dcfe7ee

Contents?: true

Size: 708 Bytes

Versions: 19

Compression:

Stored size: 708 Bytes

Contents

require 'helper'

module Mollie
  class UtilTest < Test::Unit::TestCase
    def test_extract_id
      links = {
        'customer' => {
          'href' => 'https://api.mollie.com/v2/customers/cst_4qqhO89gsT',
          'type' => 'application/hal+json'
        }
      }

      customer_id = Util.extract_id(links, 'customer')
      assert_equal 'cst_4qqhO89gsT', customer_id
    end

    def test_extract_id_missing_link
      links = {
        'customer' => {
          'href' => 'https://api.mollie.com/v2/customers/cst_4qqhO89gsT',
          'type' => 'application/hal+json'
        }
      }

      customer_id = Util.extract_id(links, 'unknown-resource')
      assert_nil customer_id
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
mollie-api-ruby-4.14.0 test/mollie/util_test.rb
mollie-api-ruby-4.7.1 test/mollie/util_test.rb
mollie-api-ruby-4.7.0 test/mollie/util_test.rb
mollie-api-ruby-4.6.2 test/mollie/util_test.rb
mollie-api-ruby-4.6.1 test/mollie/util_test.rb
mollie-api-ruby-4.6.0 test/mollie/util_test.rb
mollie-api-ruby-4.5.0 test/mollie/util_test.rb
mollie-api-ruby-4.4.1 test/mollie/util_test.rb
mollie-api-ruby-4.4.0 test/mollie/util_test.rb
mollie-api-ruby-4.3.1 test/mollie/util_test.rb
mollie-api-ruby-4.3.0 test/mollie/util_test.rb
mollie-api-ruby-4.2.0 test/mollie/util_test.rb
mollie-api-ruby-4.1.5 test/mollie/util_test.rb
mollie-api-ruby-4.1.4 test/mollie/util_test.rb
mollie-api-ruby-4.1.3 test/mollie/util_test.rb
mollie-api-ruby-4.1.2 test/mollie/util_test.rb
mollie-api-ruby-4.1.1 test/mollie/util_test.rb
mollie-api-ruby-4.1.0 test/mollie/util_test.rb
mollie-api-ruby-4.0.1 test/mollie/util_test.rb