Sha256: 97e6aefde2bfc288314573397dd5184ac108c9a625e28a3d50c3c9e38e9ab170

Contents?: true

Size: 1.78 KB

Versions: 2

Compression:

Stored size: 1.78 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], {Factory.create(:movie)}[http://github.com/thoughtbot/factory_girl], 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

== Factory support

{Machinist blueprints}[http://github.com/notahat/machinist] and {factory_girl factories}[http://github.com/thoughtbot/factory_girl] will be used when available.

=== 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.3.0 README.rdoc
cucumber_factory-1.2.1 README.rdoc