0

My application runs properly using Faye, Redis, Resque and other services, that I am starting every time with Foreman. Now I am writing acceptance tests with Capybara+RSpec, and I wonder how I could start Foreman (or even Faye alone) with Capybara in spec_helper to test live features.

Don't Panic
  • 41,125
  • 10
  • 61
  • 80
Rustam Gasanov
  • 15,290
  • 8
  • 59
  • 72

2 Answers2

0

One option is to not depend on these services in your tests. I know redis and resque have "mock" counterparts that behave like these services without actually needing to run them. Some services might not have a "mock" version (I can't find one for Faye), so you may just need to run them in the background.

Peter Brown
  • 50,956
  • 18
  • 113
  • 146
  • Thanks for answer, I need to run only faye for now, but it need to be started with acceptance tests, not manually, is there option how to do this in spec_helper? – Rustam Gasanov Aug 08 '12 at 12:27
  • You can execute system commends from ruby using either backticks (\`start service\`) or `%x[start service]`. I would create a rake task that starts the service and then runs all your specs, and stops the service at the end. – Peter Brown Aug 08 '12 at 12:50
0

if you are using jenkins as the CI server, you can start the foreman before rspec started.

lidaobing
  • 1,005
  • 13
  • 26