Hello,
there is a typo in the "Intercepting" sample in the README.md,
see https://github.com/shellspec/shellspec?tab=readme-ov-file#intercepting
The "today.sh" sample script use "begin" and "end", but in the "today_spec.sh" an intercept is defined for "begin" only.
Describe "today.sh"
Intercept begin end
__begin__() {
now() { echo "2021-01-01 01:02:03"; }
}
__end__() {
# The "run source" is run in a subshell, so you need to use "%preserve"
# to preserve variables
%preserve today
}
It "gets today's date"
When run source ./today.sh
The output should eq "Today is 2021-01-01"
The variable today should eq "2021-01-01"
End
End
Add "end" to the "Intercept begin" line and the variable "today" will be preserved.
Thanks for the nice and useful script test tool,
Lutz
Hello,
there is a typo in the "Intercepting" sample in the README.md,
see https://github.com/shellspec/shellspec?tab=readme-ov-file#intercepting
The "today.sh" sample script use "begin" and "end", but in the "today_spec.sh" an intercept is defined for "begin" only.
Add "end" to the "Intercept begin" line and the variable "today" will be preserved.
Thanks for the nice and useful script test tool,
Lutz