Skip to content

Commit

Permalink
implicit stubs defined instead of explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
msterle committed Mar 26, 2024
1 parent e7407b0 commit d271f5e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 52 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ This project uses [`shellspec`](https://github.com/shellspec/shellspec) as a tes

Tests are defined in the `spec` directory, and are all files matching the pattern `<suite_name>_spec.sh`. Mocks, custom matchers and other fixtures can be defined in the `spec/support` directory.

The `pot` mock has already been defined and is imported into all tests. By default, all `pot` subcommands return truthy with no side effects, but these can be overloaded on a per-subcommand basis, as each subcommand has its own stub function. See [here](spec/simple_spec.sh#L47) for an example of overloading the `pot exec` subcommand, and [here](spec/support/pot_mock.sh#L59) for a list of all subcommand stubs that can be overloaded.
The `pot` mock has already been defined and is imported into all tests. By default, all `pot` subcommands return truthy with no side effects, but these can be overloaded on a per-subcommand basis, as each subcommand has its own stub function. See [here](spec/simple_spec.sh#L47) for an example of overloading the `pot exec` subcommand, and [here](spec/support/pot_mock.sh#L5) for a list of all subcommand stubs that can be overloaded.

Wrapper scripts to run GitHub actions in a jail on FreeBSD
----------------------------------------------------------
Expand Down
56 changes: 5 additions & 51 deletions spec/support/pot_mock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,55 +53,9 @@ pot() {
*) fn='pot_other';;
esac
shift 1
$fn "$@"
if type "$fn" 2>/dev/null | grep -q 'function'; then
$fn "$@"
else
:
fi
}

pot_help() { :; }
pot_version() { :; }
pot_config() { :; }
pot_list() { :; }
pot_show() { :; }
pot_info() { :; }
pot_top() { :; }
pot_ps() { :; }
pot_init() { :; }
pot_de_init() { :; }
pot_vnet_start() { :; }
pot_create_base() { :; }
pot_create_fscomp() { :; }
pot_create_private_bridge() { :; }
pot_create() { :; }
pot_clone() { :; }
pot_clone_fscomp() { :; }
pot_rename() { :; }
pot_destroy() { :; }
pot_prune() { :; }
pot_copy_in() { :; }
pot_copy_out() { :; }
pot_mount_in() { :; }
pot_mount_out() { :; }
pot_add_dep() { :; }
pot_set_rss() { :; }
pot_get_rss() { :; }
pot_set_cmd() { :; }
pot_set_env() { :; }
pot_set_hosts() { :; }
pot_set_hook() { :; }
pot_set_attribute() { :; }
pot_get_attribute() { :; }
pot_export_ports() { :; }
pot_start() { :; }
pot_stop() { :; }
pot_term() { :; }
pot_run() { :; }
pot_snapshot() { :; }
pot_revert() { :; }
pot_purge_snapshots() { :; }
pot_export() { :; }
pot_import() { :; }
pot_prepare() { :; }
pot_update_config() { :; }
pot_last_run_stats() { :; }
pot_signal() { :; }
pot_exec() { :; }
pot_other() { :; }

0 comments on commit d271f5e

Please sign in to comment.