Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
postmodern opened this issue Nov 19, 2024 · 1 comment
Open

Comments

@postmodern
Copy link
Contributor

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.

@postmodern postmodern changed the title stub_request no longer accepts Addressable::URI stub_request no longer accepts Addressable::URI in webmock 3.24.0 Nov 19, 2024
postmodern added a commit to ronin-rb/ronin-support that referenced this issue Nov 19, 2024
@Earlopain
Copy link
Contributor

Some info in #1073

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants