Setup of rails repo for contribution and existing failing tests

I have 2 questions for anyone that contributes to Rails.

  1. How have you setup your bash output to have colors when running the full test suite for easy parsing of red/green/yellow of the suite?
  2. If you run the suite and there are failing tests, is that expected from time to time? Travis CI - Test and Deploy Your Code with Confidence shows a green build but in this instance I get a failure on: actionpack/test/controller/render_test.rb:1465


If you have failing tests locally but they are passing on Travis make sure your master branch is at the same commit of the one Travis ran against. Sometimes failures do get pushed to master, though they’re (hopefully) fixed quickly, and you may have forked or cloned while master was actually failing. I like adding an upstream remote to my git config git config -e so I can quickly grab the latest from rails/rails master git pull --rebase upstream master.

All tests should be passing, make sure you haven’t accidentally added anything to the files, also make sure to always run tests with bundle exec. After that it may be something setup with your environment, maybe try re-installing rubies, and/or ruby gems. Try it on a friends or co-workers computer to see if you get a failure there, then try to figure out the differences in environment.

Worst case scenario if you cannot get that one single test passing and you want to contribute first run the tests against unchanged master (as you already did) and make note of failing tests. Then make your change in a branch, and re-run tests. If no additional tests fail it is likely safe to make a PR. Pull requests get tested against travis, so you will see if it fails on CI.

Happy bug fixing,

Richard Schneeman


Additionally, use the rails-dev-box for running the tests – it’s a standardized environment with all necessary dependencies installed: