Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ericgj/ministub
Simple javascript stub utility translated from Ruby's MiniTest
https://github.com/ericgj/ministub
Last synced: 9 days ago
JSON representation
Simple javascript stub utility translated from Ruby's MiniTest
- Host: GitHub
- URL: https://github.com/ericgj/ministub
- Owner: ericgj
- Created: 2013-05-09T19:04:08.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-05-12T03:58:23.000Z (over 11 years ago)
- Last Synced: 2024-11-15T12:27:37.551Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 117 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# ministub
Simple stub utility translated from Ruby's [MiniTest][mt]
## Installation
$ component install ericgj/ministub
## API
### Stub( obj, name, val_or_fn, fn )
Stub the method `name` of `obj` with `val_or_fn` for the duration of block `fn`.
## Examples
```javascript
var stub = require('ministub');
var foo = { bar: 'bar' };
stub(foo, 'bar', 'baz', function(){
foo.bar // 'baz'
});foo.bar // 'bar'
```
## License
MIT
[mt]: https://github.com/seattlerb/minitest