Created
February 20, 2010 17:36
-
-
Save josephholsten/309794 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pretty_factory_name name | |
name.to_s.gsub '_', ' ' | |
end | |
Factory.factories.each do |name, factory| | |
Given( /^an? #{pretty_factory_name name} exists$/ ) do | |
Factory(name) | |
end | |
Given( /^an? #{pretty_factory_name name} exists with an? (.*) of "([^"]*)"$/ ) do |attr, value| | |
Factory(name, attr.gsub(' ', '_') => value) | |
end | |
Given( /^the following #{pretty_factory_name name} records?$/ ) do |table| | |
table.hashes.each do |hash| | |
Factory(name, hash) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment