Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
410 views
in Technique[技术] by (71.8m points)

rspec - Best way of setting up integration tests for ably

I'm considering migration from pusher to ably.

In my current setup, I'm using https://github.com/tristandunn/pusher-fake as a solution to run integration tests. In short, this is running local server, which is faking real pusher server. This allows to run integration tests, including realtime communication, with ease as there is no stubbing requests.

I can't find anything like this for ably, unfortunately. But there seems to be no go-to solution even.

What is a best way for writing integration tests with ably?

Some ideas that comes to my mind:

  • write fake server (something like pusher-fake) on my own BUT it's a lot of work
  • stub requests to ably BUT should I somehow stub websocket messages :O
  • request actual ably server BUT this is error prone because it make specs network dependent

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The best way would be writing the fake server and releasing it back to the community (as the author of pusher-fake did). To stub requests you'd need to use a programmable proxy like puffing-billy since requests are made directly from the browser.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...