factory-girl
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -6,3 +6,3 @@ { | ||
"author": "Simon Wade", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"keywords": ["factory", "test", "bdd", "tdd", "fixture"], | ||
@@ -9,0 +9,0 @@ "repository" : { |
# factory-girl | ||
[![Build Status](https://travis-ci.org/aexmachina/factory-girl.png)](https://travis-ci.org/aexmachina/factory-girl) | ||
`factory-girl` is a factory library for [Node.js](http://nodejs.org/) and the browser that is inspired by [Factory\_girl](http://github.com/thoughtbot/factory_girl). It works asynchronously and supports associations and the use of functions for generating attributes. | ||
@@ -19,4 +21,2 @@ | ||
JavaScript: | ||
```javascript | ||
@@ -30,3 +30,3 @@ var factory = require('factory-lady'), | ||
factory.define('user', User, { | ||
state: 'activated', | ||
state: 'active', | ||
// define attributes using functions | ||
@@ -42,2 +42,3 @@ email: function() { | ||
}); | ||
console.log(factory.build('user')); => {state: 'active', email: 'user1@example.com', async: 'foo', password: '123456'} | ||
@@ -49,3 +50,2 @@ factory.define('post', Post, { | ||
subject: 'Hello World', | ||
content: 'Lorem ipsum dolor sit amet...', | ||
// you can refer to other attributes using `this` | ||
@@ -57,2 +57,3 @@ slug: function() { | ||
``` | ||
console.log(factory.build('post')); => {user_id: 123, subject: 'Hello World', slug: 'hello-world'} | ||
@@ -59,0 +60,0 @@ ## Using Factories |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15267
82