Reputation: 15216
In RSpec it is possible to create a test and refer to it from multiple places using shared_examples
. It simplifies developer's life a lot.
Is there any way to use shared examples in ExUnit?
Upvotes: 4
Views: 833
Reputation: 11288
test
macros do some bookkeeping, but ultimately they simply define a function for the test. ExUnit test code is like any other Elixir code, so you can use all the things you normally use to remove duplication. You can use macros to define common tests similar to shared_examples
for you or use functions to extract common code that repeats between tests.
Upvotes: 1