Sha256: 079daf34bd351bc37de696439e2588b9a7307a4d6dcbdf6aa615c0fb714bcfef

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

# frozen_string_literal: true
require_relative '../test_helper'

module Excon
  # AddressableTest
  #
  # Verifies the templated uri being parsed correctly by Addressable::Template.
  #
  class AddressableTest < Minitest::Test
    def setup
      Excon.defaults[:mock] = true
      Excon.stub({}, status: 200)
    end

    def test_expand_templated_uri
      conn = Excon.new('http://www.example.com/{uid}', expand: { uid: 'hello' })

      assert_equal '/hello', conn.data[:path]
      assert_equal 200, conn.get.status
    end

    def test_templated_uri_with_optional_query_parameters
      conn = Excon.new('http://www.example.com/{?uid}')

      assert_equal '/', conn.data[:path]
    end

    def teardown
      Excon.stubs.clear
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
excon-addressable-0.1.1 test/excon/addressable_test.rb