Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Create records from Cucumber features without writing step definitions.

tree: 830ff23c62

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
Octocat-spinner-32 cucumber_factory.gemspec

Cucumber Factory - create ActiveRecord objects without step definitions

Cucumber Factory allows you to create ActiveRecord objects directly from your Cucumber features. No step definitions required.


Install the gem:

sudo gem sources -a
sudo gem install makandra-cucumber_factory

Add the following to your block in your environment.rb:

config.gem 'makandra_cucumber_factory', :lib => 'cucumber_factory', :source => ''

Create a step definition stub in <tt>features/step_definitions/factory_steps.rb, which just says



The following will call Movie.make, Movie.create! or, depending on what's available:

Given there is a movie

To create a new record with attributes set, you can say:

Given there is a movie with the title "Sunshine" and the year "2007"

The following will also store the created record in @sunshine:

Given "Sunshine" is a movie with the title "Sunshine" and the year "2007"

To set associations you can refer to other records by name:

Given "Before Sunrise" is a movie
And "Before Sunset" is a movie with the prequel "Before Sunrise"

You can also refer to the last created object of a kind by saying “above”:

Given there is a movie with the title "Before Sunrise"
And "Before Sunset" is a movie with the prequel above


Henning Koch


Something went wrong with that request. Please try again.