Skip to content
This repository

HTTPS clone URL

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…

Octocat-spinner-32-eaf2f5

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
README.rdoc

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.

Installation

Install the gem:

sudo gem sources -a http://gems.github.com
sudo gem install makandra-cucumber_factory

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

config.gem 'makandra_cucumber_factory', :lib => 'cucumber_factory', :source => 'http://gems.github.com'

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

Cucumber::Factory.add_steps(this)

Example

The following will call Movie.make, Movie.create! or Movie.new, 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

Credits

Henning Koch

link www.makandra.de

Something went wrong with that request. Please try again.