I posted this on SO, but figured it might be more appropriate here since it's an actual testing question.

I have a CI.yaml file (For Gitlab CI) that builds our Rails app and runs integration (Rspec/Capybara tests)

  - rbenv install --skip-existing `cat .ruby-version`
  - bundle install
  - RAILS_ENV=test bundle exec rake db:drop db:create db:migrate db:seed

    - bundle exec rspec . --tag type:feature
    - ruby

Pretty simple right? However i'll need to spin up a Rails app server to actually run these on via bundle exec rails s

Does anyone know the best way to stop such a server on a CI stack? (Were using Gitlab). Im pretty sure Gitlab doesn't stop any servers running after the build, so i'd need to kill it some way but im not sure of the best way.

1 Answer 1


For reference (In case someone comes across this), this was solved by allowed Capybara itself to spin up the server, since it will automatically stop itself once the tests are finished.

This was done by adjusting the app_host and server_host/etc... for capybara in my test_helper.rb file:

Capybara.app_host = "http://localhost:3000"
Capybara.server_host = "localhost"
Capybara.server_port = "3000"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.