-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Your shunit2 description mentions that it can't be used to mock functions by export. In my experience it's working though.
Looks like alias in your unit test example is still in effect and break function export test.
This patch makes tests work for me.
diff --git a/example-shunit2/test/unit_test.sh b/example-shunit2/test/unit_test.sh
index 82176e0..38d64ed 100755
--- a/example-shunit2/test/unit_test.sh
+++ b/example-shunit2/test/unit_test.sh
@@ -20,12 +20,10 @@ function test_there_should_be_20_percent_discount_for_large_quantities_on_odd_da
assertEquals 0 $?
assertContains "${result}" "Total 320"
+ unalias getDay
}
function test_there_should_be_no_discount_even_for_large_quantities_on_even_days() {
- # Mocking by exporting functions does not work for shunit2
- startSkipping
-
source src/ice_cream_price.sh
# Mocking a function by exporting a function
And by the way, thanks for the great guide!
dodie
Metadata
Metadata
Assignees
Labels
No labels