Skip to content

stub_request no longer accepts Addressable::URI in webmock 3.24.0 #1082

@postmodern

Description

@postmodern

In webmock 3.24.0, stub_request(method,uri) no longer accepts Addressable::URI objects.

      let(:uri) do
        Addressable::URI.new(
          scheme: 'http',
          host:   host,
          port:   port,
          path:   path
        )
      end

      it "must send a request with the given method and path to the host and return an Net::HTTPResponse object" do
        stub_request(method,uri)

        expect(subject.request(method,uri)).to be_kind_of(Net::HTTPResponse)

        expect(WebMock).to have_requested(method,uri)
      end
     Failure/Error: stub_request(method,uri)
     
     ArgumentError:
       URI should be a String, Regexp, Addressable::Template or a callable object. Got: Addressable::URI
     # /data/home/postmodern/code/ronin-rb/vendor/bundle/ruby/3.3.0/gems/webmock-3.24.0/lib/webmock/request_pattern.rb:92:in `create_uri_pattern'
     # /data/home/postmodern/code/ronin-rb/vendor/bundle/ruby/3.3.0/gems/webmock-3.24.0/lib/webmock/request_pattern.rb:21:in `initialize'
     # /data/home/postmodern/code/ronin-rb/vendor/bundle/ruby/3.3.0/gems/webmock-3.24.0/lib/webmock/request_stub.rb:9:in `new'
     # /data/home/postmodern/code/ronin-rb/vendor/bundle/ruby/3.3.0/gems/webmock-3.24.0/lib/webmock/request_stub.rb:9:in `initialize'
     # /data/home/postmodern/code/ronin-rb/vendor/bundle/ruby/3.3.0/gems/webmock-3.24.0/lib/webmock/api.rb:9:in `new'
     # /data/home/postmodern/code/ronin-rb/vendor/bundle/ruby/3.3.0/gems/webmock-3.24.0/lib/webmock/api.rb:9:in `stub_request'

This previously worked with webmock 3.23.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions