https://github.com/tristandunn/pusher-fake-example
An example of pusher-fake with RSpec to test a Rails application.
https://github.com/tristandunn/pusher-fake-example
fake pusher pusher-api pusher-js pusher-service pusherjs
Last synced: 4 months ago
JSON representation
An example of pusher-fake with RSpec to test a Rails application.
- Host: GitHub
- URL: https://github.com/tristandunn/pusher-fake-example
- Owner: tristandunn
- License: mit
- Created: 2012-02-11T22:14:18.000Z (about 13 years ago)
- Default Branch: main
- Last Pushed: 2024-12-17T21:58:01.000Z (4 months ago)
- Last Synced: 2024-12-27T19:12:18.945Z (4 months ago)
- Topics: fake, pusher, pusher-api, pusher-js, pusher-service, pusherjs
- Language: JavaScript
- Homepage: https://github.com/tristandunn/pusher-fake
- Size: 235 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
# pusher-fake-example [](https://github.com/tristandunn/pusher-fake-example/actions?query=workflow%3ACI)
An example of using [pusher-fake](https://github.com/tristandunn/pusher-fake) with RSpec to test a Rails application.
## How-To
#### 1. Use the PusherFake JS for the Pusher JS instance.
```erb
<% if defined?(PusherFake) %>
// Test environment.
//
// Note: Ensure output is not HTML escaped, such as with the raw helper in Rails.
var instance = <%= PusherFake.javascript %>;
<% else %>
// Other environments, such as production.
var instance = new Pusher(...);
<% end %>```
#### 2. Configure and start PusherFake in your RSpec environment.
```ruby
require "pusher-fake/support/rspec"
```#### 3. Enjoy testing your Pusher application!
## License
pusher-fake-example uses the MIT license. See LICENSE for more details.