Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Culerity integrates Cucumber and Celerity in order to test your application's full stack including Javascript. Your Rails app doesn't have to run in JRuby.
Ruby JavaScript
tag: v0.1.2

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
generators/culerity
lib
rails
spec
MIT-LICENSE
README.textile
Rakefile
VERSION.yml
culerity.gemspec
init.rb

README.textile

Introduction

Culerity integrates Cucumber and Celerity in order to test your application’s full stack.

Culerity lets you:

  • run Celerity from within Cucumber which allows you to test the full stack of your Rails (or other web) application from Database to in browser JavaScript
  • run your application in any Ruby (like MRI 1.8.6) while Celerity runs in JRuby so you can still use gems/plugins that would not work with JRuby
  • reuse existing Webrat-Style step definitions

Getting Started

The following guide is written for a Rails application (tested with 2.2.2) but Culerity should work with any other Web Framework that is supported by Cucumber.

First download JRuby and unpack it to some location, for example $HOME/jruby. Make sure that the jruby executable is in your path. You can do this by either setting your PATH accordingly…

export PATH=$HOME/jruby/bin:$PATH

… or by creating a symlink from your bin directory:

ln -s $HOME/jruby/bin/jruby /usr/bin/jruby

Next install the celerity gem for JRuby:

jruby -S gem install celerity

Now (assuming you have a Rails application set up already) install Culerity as a Rails Plugin:

cd RAILS_ROOT git clone git://github.com/langalex/culerity.git

or as a gem: (definitely preferred)

gem install langalex-culerity

And add the culerity gem to your environment.rb:

config.gem ‘langalex-culerity’, :lib => ‘culerity’, :version => ‘0.1’, :source => ‘http://gems.github.com’

Run the RSpec, Cucumber and Culerity generators:

cd RAILS_ROOT script/generate rspec script/generate cucumber script/generate culerity

This creates the features folder and a file common_celerity.rb into your application. This file contains step definitions for basic interactions like clicking links or filling out forms.

After you have written a first feature you can run it just like you would run a standard cucumber feature. The only difference is that you have to start a web server (e.g. mongrel) with the test environment enabled beforehand.

NOTE: For now this server has to run on port 80 because of some problem with redirects losing the port information.

sudo script/server -p 80 -e test cucumber features/my_feature.feature

How does it work

While Celerity is based on Java and requires JRuby to run, with Culerity you can still run your tests in your own Ruby Environment. When you run your features a separate JRuby process for Celerity is spawned and all Celerity Commands are redirected to this other process.

Troubleshooting

I get a broken pipe error:

  • make sure JRuby is installed and in your path: running jruby -v should not produce an error

I get Connection Refused errors

  • make sure you have started a server in the test environment that runs on port 80

Links to Celerity documentation

Links

Contact

Written 2009 by Alexander Lang, contact alex[at]upstream-berlin.com or http://github.com/langalex, released under the MIT license

Something went wrong with that request. Please try again.