Hacker News new | ask | show | jobs
by pmontra 3405 days ago
The Rails app runs in one thread, the test in another one. There are no problems as long as you don't use the database from the tests, which would be against the spirit of integration testing anyway. Only browser actions, even to check if the assertions are valid. A little inconvenient but safe and true to what users will do and see. I never got any problems in that way.
1 comments

If you've had no problems, that's great, but lots and lots and lots of us have. I tried to summarize (well, that's not the right word, it was at length) here: https://bibwild.wordpress.com/2016/02/18/struggling-towards-...

While integration tests may ideally not use the database (although I find in practice, I think you often need or want to do some 'manual' setup first. But even if you don't, the _other_ tests do db setup and teardown, and the problems start happening when the Rails app is still busy doing something triggered by a test that the test thread considers 'over'. Easy to say "Well, don't do that", but in practice it is very difficult to diagnose, debug, and stop. Using fancy new front-end frameworks like React or Angular tends to make it orders of magnitude worse.

If you haven't run into problems, consider yourself lucky and I don't hold it against you, but many have.