How to run RSpec in Ruby on Rails by Travis CI


You can use Travis CI for free, if you push GitHub public repository.

The service supports following languages:

C、C++、Clojure、Erlang、Go、Groovy、Haskell、Java、
JavaScript(Node.js)、Objective-C、Perl、PHP、Python、Ruby、Scala

🐠 Sign up Travis CI

At first, you sign up for Travis CI.

After you finish to register, you allow to collaborate with a GitHub repository in Profile - Travis CI.

Travis_CI_sync

🐝 Create .travis.yml

Please execute following commands:

$ gem install travis

# generate .travis.yml
$ travis init

Edit .travis.yml like:

language: ruby
rvm:
- 2.3.0
- 2.2.4
bundler_args: --jobs=2
script:
script:
- bundle exec rake db:setup
- bundle exec rake spec
cache: bundler
services:
- postgresql
addons:
postgresql: "9.4"

Execute following commands for checking .travis.yml by travis-ci/travis-lint:

$ gem install travis-lint

$ travis lint
> Hooray, .travis.yml looks valid :)

After finishing the setting, running RSpec on Travis CI when you push .travis.yml to GitHub.
Let’s check the status by travis open which show the status on your browser.

Travis_CI_status

🐮 Add Badge

You can put a batch which shows the status on Travis CI on README of GitHub. You can get a tag of the batch by Travis.

Travis CI badge

🍣 Special Thanks

🖥 Recommended VPS Service

VULTR provides high performance cloud compute environment for you. Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour). In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!