Last active
August 29, 2015 14:08
-
-
Save d6y/9d41a8f2182b953a2e51 to your computer and use it in GitHub Desktop.
populate
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
implicit val pc = PopulationControl( | |
dataSource=postgressDs, | |
...customzation here) | |
"Friends database" should { | |
populate(""" | |
# User | |
You can document data set between table name and the table itself. | |
Note that _ in a cell means "I don't care, create any value you want or auto increment if it's | |
that kind of a column". | |
id | name | age | | |
-----+--------+------+ | |
_ | Alice | NULL | | |
2 | Bob | _ | | |
_ | ${f()} | _ | | |
...and 9 others | |
# Friend | |
You can refer to foreign keys using table.column=match syntax | |
You'd probably not mention the id column as you don't care what goes in it. | |
If you don't mention a column that exist in the database, you'll get an | |
auto incrementing value, null or a random value depending on what we know about the column. | |
id | friend_er | friend_ee | | |
-----+---------------+-----------------+ | |
_ | User.name=Bob | User.name=Alice | | |
""") | |
"Recognize Bob & Alice as buddies" in { | |
// Using whatever test and query framework you want... | |
friend.all.filter(_.friend_er === "Bob").map(friend_ee) must beSome("Alice") | |
user.count must_== 12 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment