jejacks0n / teaspoon

Teaspoon: Javascript test runner for Rails. Use Selenium, BrowserStack, or PhantomJS.
1.43k stars 244 forks source link

Rails 5rc2 #489

Open chadrem opened 8 years ago

chadrem commented 8 years ago

I have teaspoon (and teaspoon-jasmine) setup/installed in a rails 5rc2 app. I am using two terminal windows. In the first one I am running "rails server" and in the second I am running "teaspoon". Whenever teaspoon runs in the second terminal, it starts it's own rails server and this appears to signal the other rails server (in the first terminal) to exit. Because of this, my workflow has turned into having to manually restart rails server every time I execute my javascript tests. Here is the output I see from the rails server in the first terminal:

=> Booting Puma
=> Rails 5.0.0.rc2 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.4.0 (ruby 2.3.1-p112), codename: Owl Bowl Brawl
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
* Restarting...
=> Booting Puma
=> Rails 5.0.0.rc2 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
A server is already running. Check xxxxxxxxxxxxxxx/webapp/tmp/pids/server.pid.
Exiting

I suspect this has something to do with a new restart feature in Rails 5, but I haven't dug into it yet. Can anyone else confirm this behavior?

joowh85 commented 7 years ago

+1

arrbee commented 7 years ago

I was seeing the same problem. I believe I tracked it down to having plugin :tmp_restart at the bottom of my config/puma.rb file. I replaced that line with:

if ENV["RAILS_ENV"] != "test"
  plugin :tmp_restart
end

and the problem seems to have gone away.

jejacks0n commented 7 years ago

Yeah, we just use your configuration to start a server (in a thread), so if starting that server forces others to restart, it would also potentially be an issue in capybara too (though I think it might default harder to webrick).

Anyway, thanks for the info @arrbee. I'll leave this around for others if it's a confirmed fix.

chadrem commented 7 years ago

@arrbee thanks for tracking it down! Jut to confirm your code works for me. One additional note... I have to run RAILS_ENV=test rake teaspoon for this to work. Or else the rails server in my other terminal dies.