Skip to content

Conversation

@Kociamber
Copy link
Contributor

@Kociamber Kociamber commented Jul 23, 2025

This PR fixes min_calls and max_calls options for expect_request!. These options were documented but completely ignored by the code. Max was taken from calls option, min value was hardcoded to 1.

The fix:

  • If max_calls is explicitly provided: use it
  • If only min_calls is provided: use calls (for backwards compatibility), if calls not provided either, set max_calls to min_calls value to avoid a clash
  • Default case (neither specified): single call expectation
  • Review required
  • Includes 1+ tests
  • Fully tested locally

@Kociamber Kociamber requested a review from MvanDiemen July 23, 2025 07:24
@coveralls
Copy link

coveralls commented Jul 23, 2025

Pull Request Test Coverage Report for Build 5d35ac68ab997a9da3b5f74eca58a6cd4d2102e1-PR-20

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 3 of 4 (75.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 85.478%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/http_ex/backend/mock/expectation.ex 3 4 75.0%
Totals Coverage Status
Change from base Build 60970f519e1ecdcee631df8eb7e6bcfb030e111e: 0.03%
Covered Lines: 465
Relevant Lines: 544

💛 - Coveralls

@Kociamber Kociamber requested a review from MvanDiemen July 23, 2025 09:28
@Kociamber Kociamber requested a review from MvanDiemen July 23, 2025 10:20
@MvanDiemen MvanDiemen merged commit 2724891 into main Jul 23, 2025
2 checks passed
@MvanDiemen MvanDiemen deleted the rafal/fix_min_and_max_calls_for_expect_request branch July 23, 2025 11:41
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

Successfully merging this pull request may close these issues.

4 participants