bblimke/webmock · error · ArgumentError

assert_not_requested with a stub object, doesn't accept bloc

Error message

assert_not_requested with a stub object, doesn't accept blocks

What it means

Error "assert_not_requested with a stub object, doesn't accept blocks" thrown in bblimke/webmock.

Source

Thrown at lib/webmock/api.rb:35

    class << self
      alias :request :a_request
    end

    def assert_requested(*args, &block)
      if not args[0].is_a?(WebMock::RequestStub)
        args = convert_uri_method_and_options_to_request_and_options(args[0], args[1], args[2], &block)
      elsif block
        raise ArgumentError, "assert_requested with a stub object, doesn't accept blocks"
      end
      assert_request_requested(*args)
    end

    def assert_not_requested(*args, &block)
      if not args[0].is_a?(WebMock::RequestStub)
        args = convert_uri_method_and_options_to_request_and_options(args[0], args[1], args[2], &block)
      elsif block
        raise ArgumentError, "assert_not_requested with a stub object, doesn't accept blocks"
      end
      assert_request_not_requested(*args)
    end
    alias refute_requested assert_not_requested

    # Similar to RSpec::Mocks::ArgumentMatchers#hash_including()
    #
    # Matches a hash that includes the specified key(s) or key/value pairs.
    # Ignores any additional keys.
    #
    # @example
    #
    #   object.should_receive(:message).with(hash_including(:key => val))
    #   object.should_receive(:message).with(hash_including(:key))
    #   object.should_receive(:message).with(hash_including(:key, :key2 => val2))
    def hash_including(*args)
      if defined?(super)
        super

View on GitHub (pinned to b187df8827)

When it happens

Trigger: Thrown at lib/webmock/api.rb:35 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bblimke/webmock@b187df8827 (2026-08-23). Data as JSON: /api/errors/df7590abbda75710. Report an issue: GitHub.