Created
March 25, 2011 04:12
-
-
Save heptat/886352 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
# assume the field to search on is "name" | |
Given /^the ([^\s]+) "([^"]+)" belongs to(?: the) ([^\s]+) "([^"]+)"$/ do |model, value, parent_model, parent_value| | |
Given "the #{model} with the name \"#{value}\" belongs to the #{parent_model} with the name \"#{parent_value}\"" | |
end | |
Given /^the ([^\s]+) with the ([^\s]+) "([^"]+)" belongs to(?: the) ([^\s]+) with the ([^\s]+) "([^"]+)"$/ do |model, field, value, parent_model, parent_field, parent_value| | |
# get the id for the first thing | |
# get the id for the second thing | |
model_id = get_id(model, field, value) | |
parent_id = get_id(parent_model, parent_field, parent_value) | |
Given "the following #{parent_model} #{model} joins exist:", table(%{ | |
| #{parent_model}_id | #{model}_id | | |
| #{parent_id} | #{model_id} | | |
}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment