• This repository has been archived on 29/Oct/2020
  • Stars
    star
    260
  • Rank 156,726 (Top 4 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 15 years ago
  • Updated over 13 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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.

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.3.5) 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

You will need the celerity gem installed into JRuby:

jruby -S gem install celerity

Now install the Culerity gem:

gem install culerity --source http://gemcutter.org

Assuming you have a Rails application set up already you can 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 culerity_steps.rb into your application. This file contains step definitions for basic interactions like clicking links or filling out forms. Now is a good time to get rid of any webrat specific files generated by cucumber (i.e. features/step_definitions/webrat_steps.rb).

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.

rake culerity:rails:start
cucumber features/my_feature.feature

The Rails instance uses a special environment culerity.

When you have finished running culerity/cucumber you can turn off the Rails instance:

NOTE: The default port for this server is 3001. You can change this in features/step_definitions/common_celerity.rb

rake culerity:rails:stop

RVM

If you are using RVM there's an integration guide for culerity on their website.

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 3001

My application can't find the data I create in my steps

  • make sure you have disabled transactional fixtures in your env.rb

My database is not cleared automatically between scenarios

  • Rails can't clean the database because you had to disable transactional fixtures - which only work if your test process is the same as your web server process. Hence you have to clean your database manually. A quick way would be:

    Before do [User, .... all your models].each do |model| model.delete_all end end

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

More Repositories

1

couch_potato

Ruby persistence layer for CouchDB.
Ruby
325
star
2

boom_amazing

a couchapp that lets you give a presentation by panning, rotating and zooming in an svg/png/pdf file
JavaScript
116
star
3

totally-restful-authorization

This plugin adds an authorization layer to your rails app that is totally transparent to your restful controllers and a DSL for declaring permissions on your models.
Ruby
30
star
4

hejhej

This is a CouchApp I have written for fun and to demonstrate how to test drive CouchApps with Cucumber. Its purpose is to help learn new (spoken) languages.
JavaScript
24
star
5

mite_enterprise

a node.js/sammy.js webapp that pulls together reports from multiple mite (http://mite.yo.lk) time tracking accounts
JavaScript
16
star
6

dead_simple_reports

create reports via sql or ruby code for your rails app in minutes
Ruby
15
star
7

local_cache

A ruby on rails (>= 2.1) plugin that extends the cache store with an in memory cache to enhance caching performance and solves a race conditions. (replaces extended_fragment_cache)
Ruby
8
star
8

realtimebattle_rb

simplified ruby implementation of realtimebattle
Ruby
7
star
9

forms-fu

enhanced form handling for rails applications
Ruby
7
star
10

web_spell

WebMock for Elixir. Dynamically stub HTTP requests in your tests.
Elixir
6
star
11

couchfoto

An example CouchDB/Rails application to demonstrate Basic CouchDB usage and attachment uploads. Based on Couch Potato.
Ruby
4
star
12

couchonrails

couchonrails.org website: guides for using couchdb with ruby
2
star
13

plants_alive

an in browser app that tracks when the plants have been watered the last time
JavaScript
2
star
14

rails_girls_project_group

Collection of meeting notes, homework and (in the future) code from our Rails Girls project group
Ruby
2
star
15

resource_potato

something like resource_controller but for CouchPotato/CouchDB and smaller
Ruby
2
star
16

jsrumble

JavaScript Rumble Website
Ruby
1
star