https://github.com/krisleech/wisper-testing
Helpers for testing Wisper publisher/subscribers.
https://github.com/krisleech/wisper-testing
testing wisper
Last synced: about 1 year ago
JSON representation
Helpers for testing Wisper publisher/subscribers.
- Host: GitHub
- URL: https://github.com/krisleech/wisper-testing
- Owner: krisleech
- License: mit
- Created: 2015-08-02T22:45:30.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-02-15T09:26:15.000Z (over 3 years ago)
- Last Synced: 2025-04-13T03:06:53.873Z (about 1 year ago)
- Topics: testing, wisper
- Language: Ruby
- Size: 13.7 KB
- Stars: 4
- Watchers: 2
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Wisper::Testing
[](https://travis-ci.org/krisleech/wisper-testing)
Helpers for testing Wisper publisher/subscribers.
## Installation
```ruby
gem 'wisper-testing'
```
## Usage
Using `fake!` and `fake` prevents any events from being broadcast.
Instead each event is recorded and can be inspected.
```ruby
Wisper::Testing.fake!
Wisper::Testing.fake do
# ...
end
Wisper::Testing.events # => [...]
```
### Inline
Using `inline!` and `inline` ensures all events are broadcast using the default
broadcaster, meaning any subscribers which are subscribed with `async: true`
will not be called asynchronously, but synchronously.
```ruby
Wisper::Testing.inline!
Wisper::Testing.inline do
# ...
end
```
### Restore
Using `restore!` will turn off `fake!` and `inline!` and restore the original
configuration.
It is not nessesary to call this if you are using the block variations
`fake` and `inline`.
```ruby
Wisper::Testing.restore!
```
### Enabled
```ruby
Wisper::Testing.enabled? # => true/false
```
## Development
```
ls **/*.rb | entr -c bundle exec rspec
```
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/krisleech/wisper-testing.
This project is intended to be a safe, welcoming space for collaboration, and
contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org)
code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).