lundi 4 mai 2015

Websockets-Rails gives "eventmachine not initialized" error in test environment

I have recently started using the websocket-rails gem and all is fine in development and even in production, but when I run rspec tests I get the following error:

Failure/Error: Unable to find matching line from backtrace
 RuntimeError:
   eventmachine not initialized: evma_install_oneshot_timer

The message seems to appear on the second test I run. When I run a previously failing test on it's own by adding :focus => true to the test and then rspec --tag focus its passes OK. If I add the focus to more than one test, usually the first one passes and the second test gives the error.

I am using rspec Capybara with the Selemium web driver. I think this may be to do with the web server in test not being an "eventmachine based web server" but I am not 100% sure. I have tried setting up the websockets server as standalone by adding the following in my websocket initializer config.standalone = true and then starting the server by rake websocket_rails:start_server RAILS_ENV=test.

Aucun commentaire:

Enregistrer un commentaire