简体   繁体   中英

How to stop Event Machine in setup like this?

I have a Sinatra app, overall configured like described here sinatra docs .

It basically starts an event machine loop.

Now, If I want to write a RSpec test, how do I start server like this and shutdown it after?

I can do this from console by ruby server.rb , I may execute this command from spec file in test suit setup (however, I'm not sure if it is right). But then, even if I do so, how I stop it after? (and do I need or it will be stopped after test is finished?)

I think, in any case, you can use Rack::Test to test your Sinatra app. In order to run the specs, you don't need to run the server from the terminal.

Take a look at the documentation, you can find different examples: http://www.sinatrarb.com/testing.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM