minitest
is a great testing library and factory_girl
is a handy fixture replace library, especially when working with Rails.
It can get tedious to repeat FactoryGirl.
for every invocation of build
, create
, etcetera. Here is a handy shortcut to help reduce your Carpal Tunnel pain:
1 2 3 4 5 6 7 8 9 |
|
Place this in a file such as test/support/factory_girl.rb
.
This allows you to use the core set of syntax methods (build
, build_stubbed
, create
, attributes_for
, and their *_list
counterparts) without having to call them on FactoryGirl
directly:
1 2 3 4 5 6 7 |
|