Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save svesely/331789 to your computer and use it in GitHub Desktop.
Save svesely/331789 to your computer and use it in GitHub Desktop.
Factory.factories.each do |name, factory|
Given /^an? #{name} exists with an? (.*)$/ do |attr|
attributes = attr.split(" and ").inject({}) do |attributes, pair_string|
pair = pair_string.gsub(/^an? /, '').split(" of ")
attributes[pair.shift.downcase.strip.to_sym] = pair.pop.to_s.scan(/".*"/).first.gsub('"','')
attributes
end
Factory(name, attributes)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment