Closed dbesserman closed 7 years ago
That is a great question! Could you give me an example of what you're trying to do? Pseudo-code is fine.
Let's say I have a method that generates a random string that I'd like to share across a few fabricators. Is there a natural place for that method ?
I always recommend using ffaker
in conjunction with fabrication
. For example,
Fabricator(:company) do
name { FFaker::Company.name }
end
It has lots of ipsums and other random word generators. Pretty much any random data you could possibly need. Just wrap it in a block as I did above when you pass it to the attribute and it will work as expected.
I'd like to extract methods from fabricators to a helper. How should I go about that ?