Skip to content
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

Merged
merged 7 commits into from
Mar 19, 2018
Merged

added fixtures #8

merged 7 commits into from
Mar 19, 2018

Conversation

markbates
Copy link
Member

No description provided.

Copy link
Member

@paganotoni paganotoni left a 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
Copy link
Member

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") %>

Copy link
Member Author

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]]
Copy link
Member

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

Copy link
Member Author

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"))
Copy link
Member

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? :)

Copy link
Member Author

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". :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@markbates markbates mentioned this pull request Mar 18, 2018
@markbates markbates merged commit f8d299e into master Mar 19, 2018
@fasmat fasmat deleted the fixtures branch January 12, 2022 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants