-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added fixtures #8
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markbates this looks nice, added a couple of ideas maybe for the future, thanks for adding me in this review.
[[scenario.table.row]] | ||
id = "<%= uuid() %>" | ||
name = "Mark Bates" | ||
admin = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to add a fake data generation helper, probably we could use something like <%= fake("FirstName") %>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed! that would be great. PR please! ;)
[[scenario.table]] | ||
name = "widgets" | ||
|
||
[[scenario.table.row]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if we could do something like loops for rows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's plush, so you can! :)
} | ||
|
||
func Test_ActionSuite(t *testing.T) { | ||
action, err := suite.NewActionWithFixtures(App(), packr.NewBox("../fixtures")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought here: since fixtures are intended to be used in a test context, why do we have to use packr here instead of a regular fs? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great question! I almost did that, then I went with packr instead. The reason why is when go test
runs it does all sorts of stuff with cd
and such under the covers. The problem with this is that if you use relative files, the relativity can change. Part of packr's design is based on turning relative into absolute. So using packr means we don't have to worry about those issues.
Another advantage of packr is it opens things up to interesting, programmatic things you can do during your tests, like import someone else box.
TL;DR: relativity can change when running tests; packr doesn't have this problem so it's "safer". :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
No description provided.