Mocking/stubbing library for BATS (Bash Automated Testing System)
Recommended installation is via git submodule. Assuming your project's bats
tests are in test
:
git submodule add https://github.com/jasonkarns/bats-mock test/helpers/mocks
git commit -am 'added bats-mock module'
then in test/test_helper.bash
:
load helpers/mocks/stub
(Optionally configure sparse-checkout if you're concerned with all the non-essential files being in your repo)
Also available as an npm module if you're into that sort of thing.
npm install --save-dev bats-mock
then in test/test_helper.bash
:
load ../node_modules/bats-mock/stub
Extracted from the ruby-build test suite. Many thanks to its author and contributors: Sam Stephenson and Mislav Marohnić.