O'Reilly logo

Functional Programming: A PragPub Anthology by Michael Swaine

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Instantiating Template Entries

Now, you can create new users or admins. Just use your Forge module and the macros that Blacksmith creates for you, like this:

 ~~~
 user = Forge.user
 ~~~

Or, you can create a list of five users, like this:

 ~~~
 users = Forge.user_list 5
 ~~~

You can override any of the registered attributes, like this:

 ~~~
 user = Forge.user first_name: "Will", last_name: "Override"
 ~~~

Simple and powerful. Now, your tests can quickly create new entities with many elements, with the ability to override or create new attributes as needed.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required