-
-
Notifications
You must be signed in to change notification settings - Fork 34
unmock all test doubles after each test #235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e5eacd0
feat: create unmock
Chemaclass 1af89bb
docs: update changelog and add docs for unmock
Chemaclass 6ad473c
fix: broken pipe
Chemaclass 518bef4
fix: unmock test
Chemaclass e028e39
refactor: test_successful_unmock
Chemaclass c846f06
feat: add assert_is_mock
Chemaclass 3c5964d
refactor: src/test_doubles.sh
Chemaclass c69e7c2
refactor: simplify test_successful_unmock
Chemaclass 9a216c8
feat: allow unmock spy
Chemaclass 354353a
feat: runner::clean_mocks()
Chemaclass df9de9c
test: test_runner_clean_mocks
Chemaclass 9dc58c4
test: create acceptance/mock_test
Chemaclass 58f0b66
docs: add assert_is_mock to docs
Chemaclass a3815ca
refactor: rename clean_mocks to clear_mocks
Chemaclass 6b97a40
test: add test_unsuccessful_unmock
Chemaclass d1dce6b
chore: use clear_mocks()
Chemaclass 7092b56
fix: local expected in is_mock()
Chemaclass 1e5bce4
refactor: unmock() unset inside for if
Chemaclass 00e408a
update changelog
Chemaclass 1f0aa34
feat: remove internal assert mocks functions
Chemaclass b7124b7
test: add spies to acceptance/mock_test
Chemaclass dbfb433
fix: Declare and assign separately to avoid masking return values
Chemaclass 699c0e5
docs: update changelog
Chemaclass 39be998
docs: remove unmock func from docs
Chemaclass File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Make sure that the `runner::clear_mocks()` is being called, | ||
# removing the mocks and spies from the first test | ||
# | ||
function test_runner_clear_mocks_first() { | ||
mock ls echo foo | ||
assert_equals "foo" "$(ls)" | ||
|
||
spy ps | ||
ps foo bar | ||
assert_have_been_called_times 1 ps | ||
} | ||
|
||
function test_runner_clear_mocks_second() { | ||
assert_not_equals "foo" "$(ls)" | ||
assert_have_been_called_times 0 ps | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.