Skip to content

Conversation

@Flamefire
Copy link

Additionally assert that the given command was stubbed
Also avoids error message when parameter was not given and program was not stubbed

@lox I'm totally unsure how to implement this. Reasoning was that if you put unstub foo in teardown you get an error on stderr if you already unstubbed foo in the test. But you usually want it there to cleanup stuff and/or do a final verification.

My first attempt was --allow-missing which is the current behavior minus the message: status=0, output="" and without that param it would fail with status=1 and a message. However this changes existing behavior because the current version does not fail if the command does not exist (anymore)

Probably better solution:

  • unstub fails if command does not exist
  • unstub --allow-missing avoids this
  • unstub_all removes all stubs without issuing messages and errors
  • unstub_verify removes and verifies all set stubs

This is a breaking change, but allows for clean tests: unstub for use IN tests if one wants to do that, the parameter for compatibility and the other 2 for cleanup (if unstub is used in the tests) or verification (if it isn't)

Additionally assert that the given command was stubbed
Also avoids error message when parameter was not given and program was
not stubbed
@Flamefire Flamefire mentioned this pull request Jun 20, 2019
@Flamefire
Copy link
Author

Closing this in favor of Flamefire@1838e83

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

Labels

None yet

1 participant