bryanjos
Building Test Factories with StreamData
I was trying to use StreamData with test factory functions based off of what is in “What’s new in Ecto 2.1” book (or also close to what the ExMachina package does). I created a generator for a struct and used it inside the factory function for that struct, but noticed whenever it was called, the generator was returning the same value. I’m assuming because I’m running the generator the first time each time? Has any tried the above with any success?
Marked As Solved
ibarch
Hello, Bryan!
I’ve created a GitHub gist with some examples how to use StreamData as Ecto factories. I’m not sure if it is the perfect implementation, but it works. I’ll gladly improve it if you or others have suggestions.
Also Liked
ibarch
I published it as a library https://github.com/ibarchenkov/ecto_stream_factory







