How can I test WebSockets (using Pusher) with RSpec?

I am looking for successful methods for testing PushSupport events through RSpec. My application currently uses the Pusher application, but WebSockets information is more widely distributed.

Ideally, I would like something simple:

parsed_body = JSON.parse(response.body) parsed_body["error"].should == "xyzError" 

... which I found in a very convenient way to test JSON responses.

Sincere thanks in advance.

+7
source share
2 answers

WebSocket Server is a remote service. This is a good way to drown out any requests to remote services and make fun of responses from them.

+2
source

Tristan Dunn came out with this amazing gem: https://github.com/tristandunn/pusher-fake

+2
source

All Articles