go-testfixtures / testfixtures

Ruby on Rails like test fixtures for Go. Write tests against a real database
https://pkg.go.dev/github.com/go-testfixtures/testfixtures/v3?tab=doc
MIT License
1.12k stars 80 forks source link

FS loader #134

Closed underbek closed 2 years ago

underbek commented 2 years ago

I often use the testfixtures library. Often the data is in the same shared folder, but the tests are in different folders. Because of this you have to use ugly paths. To solve this problem, I decided to add the ability to pin the target path using fs.FS.

With this simple solution, you can fix the target path for finding fixtures. At least the paths in the tests will look nice. As a maximum, you no longer have to mess with ../

andreynering commented 2 years ago

Great idea and implementation. Thanks @underbek!