Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ npm install --save-dev bats-mock
then in `test/test_helper.bash`:

```bats
load ../node_modules/bats-mock/stub
load ../node_modules/bats-mock/src/stub
```

## Usage

After loading `bats-mock/stub` you have two new functions defined:
After loading `bats-mock/src/stub` you have two new functions defined:

- `stub`: for creating new stubs,
along with a plan with expected args and the results to return when called.
Expand Down
1 change: 1 addition & 0 deletions load.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source "$(dirname "${BASH_SOURCE[0]}")/src/stub.bash"
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"fixpack": "^4.0.0"
},
"files": [
"binstub",
"stub.bash"
"src/binstub.bash",
"src/stub.bash"
],
"homepage": "https://github.com/jasonkarns/bats-mock#readme",
"keywords": [
Expand All @@ -28,7 +28,7 @@
"unit"
],
"license": "MIT",
"main": "stub.bash",
"main": "src/stub.bash",
"peerDependencies": {
"bats": "^0.4.2 || ^1"
},
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion stub.bash → src/stub.bash
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ stub() {
export "${prefix}_STUB_END"=

mkdir -p "${BATS_MOCK_BINDIR}"
ln -sf "${BASH_SOURCE[0]%stub.bash}binstub" "${BATS_MOCK_BINDIR}/${program}"
ln -sf "${BASH_SOURCE[0]%stub.bash}binstub.bash" "${BATS_MOCK_BINDIR}/${program}"

touch "${BATS_MOCK_TMPDIR}/${program}-stub-plan"
for arg in "$@"; do printf "%s\n" "$arg" >> "${BATS_MOCK_TMPDIR}/${program}-stub-plan"; done
Expand Down