You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ShellSpec already has result of modifier for custom assertion. It can be assert using custom function. However, it can not pass arguments and you might want a simpler custom assertion.
Here are sample.
exists_docker_image() {
docker inspect "$1">/dev/null 2>&1
}
It "builds docker image"
When run create_docker_image my_image
Assert exists_docker_image my_image
End
Planned specifications
Difference between result of and Assert.
The result of is
custom assertion for result of evaluation.
That is, the arguments of the custom function are stdout, stderr, and status.
The Assert is
custom assertion for external side effects.
That is, the arguments of the custom function are passed as is.
You can not assert stdout/stderr/status of evaluation.
To be exact, it is possible by using the variable SHELLSPEC_STDOUT etc, But not recommend because it is internal variable.
Enable errexit before calling custom function.
To make it easy to assert without a return like bats.
NOTE: No plan to implement AssertEqual etc. Because it can be implemented with Assert.
Do you have any suggestion? or thumbs up if you like it.
The text was updated successfully, but these errors were encountered:
ShellSpec already has
result of
modifier for custom assertion. It can be assert using custom function. However, it can not pass arguments and you might want a simpler custom assertion.Here are sample.
Planned specifications
Difference between
result of
andAssert
.The
result of
isThe
Assert
isSHELLSPEC_STDOUT
etc, But not recommend because it is internal variable.errexit
before calling custom function.return
like bats.NOTE: No plan to implement
AssertEqual
etc. Because it can be implemented withAssert
.Do you have any suggestion? or thumbs up if you like it.
The text was updated successfully, but these errors were encountered: