hangar-factory-girl
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -18,3 +18,3 @@ var url = require('url'); | ||
hangarFactoryGirl.prototype = { | ||
create: function(name, attributes) { | ||
create: function(name, attributes, include) { | ||
this._name = name; | ||
@@ -24,3 +24,4 @@ this._path = '/' + this.pluralizeName(); | ||
this.formatData(attributes); | ||
this.formatData(attributes, include); | ||
return this.request(); | ||
@@ -45,3 +46,3 @@ }, | ||
}, | ||
formatData: function(attributes) { | ||
formatData: function(attributes, include) { | ||
this._data = {}; | ||
@@ -52,2 +53,6 @@ | ||
} | ||
if (include !== undefined) { | ||
this._data["include"] = include; | ||
} | ||
}, | ||
@@ -54,0 +59,0 @@ request: function() { |
{ | ||
"name": "hangar-factory-girl", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Library to use Hangar with protractor", | ||
@@ -5,0 +5,0 @@ "main": "hangar-factory-girl.js", |
@@ -5,4 +5,4 @@ # Hangar Factory Girl | ||
This is only usefull with [Hangar](https://github.com/faradayio/hangar). | ||
More info about hangar: http://faraday.io/2014/09/24/hangar-using-factorygirl-factories-from-your-frontend-tests | ||
This is only useful with [Hangar](https://github.com/faradayio/hangar). | ||
Read more about hanger [here](hangar: http://www.faraday.io/blog/hangar-use-your-factorygirl-factories-for-your-front-end-tests). | ||
@@ -33,3 +33,15 @@ ## Installation | ||
it("does something", function() { | ||
/* | ||
* method create | ||
* 1st param is factory's name | ||
* 2nd param is factory's attributes that you want to override | ||
* 3rd param is include option when you want model to return it's association | ||
*/ | ||
var user = factory.create('user'); | ||
/* | ||
* method build | ||
* 1st param is factory's name | ||
* 2nd param is factory's attributes that you want to override | ||
*/ | ||
var comment = factory.build('comment', { user_id: user.id }); | ||
@@ -36,0 +48,0 @@ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
5229
73
64
1