Use FactoryGirl steps in Cucumber features

I came across something VERY useful recently: factory_girl‘s built in cucumber steps. That’s right, factory_girl comes with some built in cucumber steps that can be used in your cucumber features.

Just add the following to your cucumber env.rb file:

require "factory_girl/step_definitions"

Then, assuming you have the actual factory definitions in the first place, you can use all kinds of loveliness, including the use of associations!

For more detailed information, check out Brandon Keepers’ Practical Cucumber series.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s