Skip to content

expect_request should take into account times() #1108

Description

@grosser
r = stub_request(...).times(3)
assert_requested r

should validate that it was called 3 times, and not 1 time like it does now

just need to store the sum of times

WebMock::RequestStub.prepend(Module.new do
  attr_reader :times_to_expect
  def times(t)
    @times_to_expect ||= 0
    @times_to_expect += t
    super
  end
end)

and then validate using that number (unless times kwarg was given)

... lmk if you agree and I can send a PR

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