Skip to content

add nth method to restrict assert on a specific call number.#4

Open
vhenriet-sfy wants to merge 1 commit intomasterfrom
feat/nth
Open

add nth method to restrict assert on a specific call number.#4
vhenriet-sfy wants to merge 1 commit intomasterfrom
feat/nth

Conversation

@vhenriet-sfy
Copy link
Copy Markdown

This is used to check call order on the same spy.

This is used to check call order on the same spy.
Comment on lines +57 to 59
controlData:assert(controlData.actual:called_with(arguments, controlData.spyCallNumber), FailureMessage(
'expected spy for {actualFunction} to have been called with arguments {!arguments}', params), FailureMessage(
'expected spy for {actualFunction} to not have been called with arguments {!arguments}', params))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je rajouterai bien une information pour le nth :

Suggested change
controlData:assert(controlData.actual:called_with(arguments, controlData.spyCallNumber), FailureMessage(
'expected spy for {actualFunction} to have been called with arguments {!arguments}', params), FailureMessage(
'expected spy for {actualFunction} to not have been called with arguments {!arguments}', params))
params.nth = ""
if controlData.spyCallNumber then
params.nth = "call #" .. controlData.spyCallNumber .. " of "
controlData:assert(controlData.actual:called_with(arguments, controlData.spyCallNumber), FailureMessage(
'expected {nth}spy for {actualFunction} to have been called with arguments {!arguments}', params), FailureMessage(
'expected {nth}spy for {actualFunction} to not have been called with arguments {!arguments}', params))

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.

2 participants