Our Capybara tests can run on PhantomJS and on Selenium. I want to have a situation when
- master branch builds run them on Selenium
- staging / feature branches builds run them on Phantom JS
I can do that by setting environment variable CAPYBARA_DRIVER. However, I don’t know how to set this variable conditionally (by checking CIRCLE_BRANCH). What I tried is this
test: override: - case $CIRCLE_BRANCH in "master") CAPYBARA_DRIVER=selenium bundle exec rake test:subset ;; *) CAPYBARA_DRIVER=poltergeist bundle exec rake test:subset ;; esac: parallel: true files: - test/capybara/*_test.rb
But it of course doesn’t work (since rake test:subset is inside case). I don’t want to use test:post because I want to use Circle CI’s method of distributing tests across nodes.