By now we know that testing is important or more than that, vital!! so our apps will always have tests. If you have your code on Github the there is the possibility of using Travis CI as a Continuous Integration Service that is free for Open Source projects. So every time you do a commit, your tests will be run by Travis and you’ll be notified by mail if they pass or not.
Travis CI documentation is great, everything explained but sometimes when you have a simple project, you just don’t want to go through all the documentation, figure out how it all works, etc you expect to be able to copy&paste a simple configuration file and done.
So, I’ll share the files for a simple case like the webcalendar. Where for testing I’m using rspec, the test DB is sqlite and since the app is deployed in heroku my production DB is postgresql. The configuration files needed are config/database.yml and .travis.yml
The database.yml file looks like
database: db/<%= Rails.env %>.sqlite3
database: webcalendar_<%= Rails.env %>
<<: *<%= p ENV[‘DB’] || “sqlite” %>
Don’t worry about seeing here the user and password of the postgreql DB, they work on Travis but are not the ones used in Heroku 😛 …
The .travis.yml file on your root directory that looks like
– psql -c ‘create database webcalendar_test;’ -U postgres
– RAILS_ENV=test bundle exec rake –trace db:migrate spec
Using this configuration files is working for me, so I help is of some help to some else and does not have to spend a couple of hours trying to figure out how to make travis-ci work on your github account 🙂