<commit_before>= 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.

== Examples

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

Boolean attributes can be set by appending "which", "that" or "who" at the end:
    Given there is a movie which is awesome
    And there is a movie with the name "Sunshine" that is not a comedy
    And there is a director who is popular

Instead of "and" you can also use "but" and commas to join sentences:
    Given there is a movie which is awesome, popular and successful but not science fiction
    And there is a director with the income "500000" but with the account balance "-30000"

== Factory support

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

You can use named Machinist blueprint such as <tt>Movie.blueprint(:comedy)</tt> like this:

    Given a movie (comedy) with the title "Groundhog Day"

== Overriding factory steps

If you want to override a factory step with your own version, just do so:

    Given /^there is a movie with good actors$/ do
      movie = Movie.make
      movie.actors << Actor.make(:name => '<NAME>')
      movie.actors << Actor.make(:name => '<NAME>')
    end

Custom steps will always be preferred over factory steps. Also Cucumber will not raise a warning about ambiguous steps if the only other matching step is a factory step.

== Installation and setup

Cucumber Factory is a gem, which you can install with
    sudo gem install cucumber_factory

In Rails 2, add the following to your <tt>environment.rb</tt>:
    config.gem 'cucumber_factory'

In Rails 3, add the following to your <tt>Gemfile</tt>:
    gem 'cucumber_factory'
<commit_msg>fix a typo in the README<commit_after>= 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.

== Examples

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

Boolean attributes can be set by appending "which", "that" or "who" at the end:
    Given there is a movie which is awesome
    And there is a movie with the name "Sunshine" that is not a comedy
    And there is a director who is popular

Instead of "and" you can also use "but" and commas to join sentences:
    Given there is a movie which is awesome, popular and successful but not science fiction
    And there is a director with the income "500000" but with the account balance "-30000"

== Factory support

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

You can use named Machinist blueprint such as <tt>Movie.blueprint(:comedy)</tt> like this:

    Given there is a movie (comedy) with the title "Groundhog Day"

== Overriding factory steps

If you want to override a factory step with your own version, just do so:

    Given /^there is a movie with good actors$/ do
      movie = Movie.make
      movie.actors << Actor.make(:name => '<NAME>')
      movie.actors << Actor.make(:name => '<NAME>')
    end

Custom steps will always be preferred over factory steps. Also Cucumber will not raise a warning about ambiguous steps if the only other matching step is a factory step.

== Installation and setup

Cucumber Factory is a gem, which you can install with
    sudo gem install cucumber_factory

In Rails 2, add the following to your <tt>environment.rb</tt>:
    config.gem 'cucumber_factory'

In Rails 3, add the following to your <tt>Gemfile</tt>:
    gem 'cucumber_factory'

{'fraction_non_alphanumeric': 0.07408759124087591, 'fraction_numerical': 0.007664233576642336, 'mean_word_length': 3.964673913043478, 'pattern_counts': {'":': 2, '<': 31, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2424042', 'n_tokens_mistral': 1568, 'n_tokens_neox': 1493, 'n_words': 763}