Sha256: fd6d1fede1eac086e2a482b9d4f5273936d673cb0ce798bd96f54dc8e0379eef

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

= Cucumber Factory - create ActiveRecord objects without step definitions

Cucumber Factory allows you to create ActiveRecord objects directly from your {Cucumber}[http://cukes.info/] features. No step definitions required.

== Installation

Install the gem:
    sudo gem sources -a http://gemcutter.org
    sudo gem install cucumber_factory

Add the following to your <tt>Initializer.run</tt> block in your <tt>environment.rb</tt>:
    config.gem 'cucumber_factory', :source => 'http://gemcutter.org'

Create a step definition stub in <tt>features/step_definitions/factory_steps.rb</tt>, which just says
    Cucumber::Factory.add_steps(self)

== Example 

The following will call {Movie.make}[http://github.com/notahat/machinist/tree/master], 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 <tt>@sunshine</tt>:
    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

{www.makandra.de}[http://www.makandra.de/]

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cucumber_factory-1.2.0 README.rdoc
cucumber_factory-1.1.8 README.rdoc