Posts Tagged ‘rspec’

JetBrains TeamCity — Continuous Integration For Ruby

Friday, November 27th, 2009

There’s been lots of talks about Ruby and Rails being Agile. One of the core agile practices is Continuous Integration. And JetBrains offers its continuous integration and build management system named TeamCity.

One of the many RubyMine 2.0 additions is IDE integration with TeamCity. So, here we want to review how a Ruby/Rails project can be set up in TeamCity and what additional benefits the IDE integration brings.

We’ll not be giving a full tutorial on TeamCity setup and configuration here, we’ll link to TeamCity docs instead, which are very good, by the way. We recommend using TeamCity 5.0 as it has the ‘Rake runner’ bundled and RubyMine only supports this version.

So, after you install TeamCity, launch it, direct your browser to it, (e.g. http://localhost:8111), log in and begin adding your project to start building it.

First, create a new project, and then create a build configuration that actually configures the build process. Follow the configuration steps.

For running Ruby builds you need to select the right build runner. Most probably you want to choose Rake Runner.

Do not forget to configure test reporters for the build, so you get nice stats for all types of tests (RSpec, Cucumber, Shoulda, etc.).

Once the build configuration is ready you can ‘Run’ it to get first results.

Here are some cool things about TeamCity:

  • Instant build results — you do not need the build to finish to know some test have failed
  • Build time estimation — TeamCity tells you how long the build will run
  • Misc. build triggers — launch build on VCS commit, by schedule, or dependency from other build configuration
  • Pre-tested commit — TeamCity will perform VCS check-in of your changes only after a successful build with them (e.g. no tests fail).
  • Assign/take responsibility — responsibility can be set for a build configuration problems or failed tests.
  • Multiple notification ways such as e-mail, Jabber, RSS, IDE plugin, tray notifier.
  • Multiple supported VCS — SVN, Git, Perforce, CVS, Mercurial, etc.
  • Open source code in IDE from TeamCity web UI (works for RubyMine, IntelliJ IDEA, Eclipse, etc.)
  • View VCS check-in diffs in TeamCity web UI

Additionally, you can add custom reports to TeamCity UI. For example, if you have RCov set-up analyzing your code, you can embed its HTML report as another tab (see screenshot below, click to enlarge).

Review some TeamCity screenshots made from Cucumber and other projects builds:

So, your builds should up and running already. Time to see how we can work with TeamCity from RubyMine. Let’s install the IDE plugin.

For this, in TeamCity UI go to My Settings & Tools and from TeamCity Tools section, download the IntelliJ Platform plugin. For plugin installation instructions refer to Installing Plugin Manually.

When you relaunch RubyMine you will notice a new icon in the status bar and a new TeamCity menu item. You need to configure the server and log in to it to see your builds. Make sure you configure watched projects/builds under IDE Notifier in Watched Builds and Notifications section.

Now, with the IDE plugin, you can:

  • Start/stop builds from RubyMine
  • View build stats from RubyMine
  • Receive build results notifications in the IDE

As always, we look forward to hear your thoughts on this. Welcome to our issue tracker and discussion forum. There’s also TeamCIty forum where you can ask questions about the system
To be continued..

BDD with RSpec in RubyMine

Monday, March 23rd, 2009

We, at JetBrains in general, and in RubyMine team in particular, pay big attention to unit testing of our code. And as first users of our own products we try to make unit testing tightly integrated with the major development tasks adding features for easy test-code navigation, tests execution, etc.

Ruby and Rails developers have a great RSpec framework for doing behavior-driven development. We provide a good level of integration with RSpec in RubyMine for Ruby and for Rails projects. And the support for the latest RSpec 1.2 release is already available.

We captured a short screencast (5 mins) that demonstrates the development process when you start a feature with a test. The demo shows the useful features, shortcuts and shows off the RubyMine’s Test Runner UI. The features are demonstrated while adding new functionality to our real-live Exception Analyzer application.

Here is the couple of screenshots:


Code completion and quick doc lookup

RubyMine Test Runner UI


RubyMine also supports other test frameworks such as Test::Unit and test/spec.

View screencast online (5 min) or Download demo movie (27Mb, QuickTime)

Develop and test with pleasure using RubyMine!