Continuous Integration and Continuous Deployment with Ruby/Rails
CircleCI makes Rails testing simple. During each build, Circle looks at your code, infers your build environment, and runs your tests. The majority of the time, this just works—and works well. Of course, it helps if your project adheres to standard practices (i.e., “convention over configuration”) for standard Ruby testing frameworks.
If you don’t want to use the default, you can specify your version in
machine: ruby: version: rbx-2.2.6
Our test environment doc covers more details about language versions and tools; it also explains how Circle works with testing tools that require a browser.
If Circle detects a Gemfile, we automatically run
bundle install. Your
gems are automatically cached between builds to save time downloading dependencies.
You can add additional project dependencies from the
dependencies section of your circle.yml:
dependencies: post: - bundle exec rake assets:precompile
Circle manages all your database requirements,
such as running your
rake commands for creating, loading,
and migrating your database.
We have pre-installed more than a dozen databases and queues,
including PostgreSQL, MySQL, and MongoDB.
You can add custom database commands from the
database section of your circle.yml.
Circle will automatically infer your test commands if you’re using Test::Unit, RSpec, Cucumber, Spinach, Jasmine, or Konacha. You can also add additional commands from the test section of your circle.yml:
test: post: - bundle exec rake test:custom
Testing in Parallel
Should you need faster testing, Circle can automatically split your tests and run them in parallel across multiple machines. You can enable parallelism on your project’s Project Settings > Parallelism page in the Circle UI.
Circle can automatically split tests for RSpec, Cucumber, and Test::Unit. For other testing libraries, we have instructions for manually setting up parallelism.
Circle offers first-class support for deployment to your staging and production environments. When your build is green, Circle will run the commands from the deployment section of your circle.yml.
You can find more detailed instructions in the Continuous Deployment doc.
Troubleshooting for Ruby on Rails
Our Ruby troubleshooting documentation has information about the following issues and problems:
- Do you need the latest version of Bundler?
- RSpec is failing but CircleCI reports my tests have passed
- The Ruby debugger gem won’t build
- “unable to obtain stable firefox connection in 60 seconds”
- Git errors during a bundle install
- rake db:schema:load fails
- CircleCI is running the Ruby commands not specified in the config
- CircleCI uses the wrong Ruby version
If you are still having trouble, please contact us and we will be happy to help.