Created
September 29, 2010 21:42
-
-
Save coshx/603621 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Given /^an? (.+) exists with (?:an? )?(.+) (?:of )?\"([^\"]*)\"$/ do |model, field, value| | |
factory_name = model.gsub(' ', '_').to_sym | |
eval("@#{factory_name} = Factory.create(factory_name, field => value)") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When /^(?:|I )fill in "([^\"])" with the (?:the )?(.+)'s "([^\"]+)"(?: within "([^\"])")?$/ do |field, model, attrib, selector|
with_scope(selector) do
factory_name = model.gsub(' ', '_').to_sym
object = eval("@#{factory_name}")
fill_in(field, :with => object.send(attrib))
end
end