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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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