Skip to content

Latest commit

 

History

History
62 lines (44 loc) · 968 Bytes

File metadata and controls

62 lines (44 loc) · 968 Bytes

#hangarjs

Use hangar factories from protractor

##Install

Use npm

npm install hangarjs

##Usage

Initialize hangar, passing it the URL where hangar can be reached, as well as the protractor object

var hangar = require('hangarjs');

var factory = new hangar('http://localhost/', protractor);

Create a record

factory.create('user', {
  email: 'somebody@gmail.com',
  password: 'hunter2'
});

Get example attributes

factory.attributesFor('user').then(function(attributes){
  //...
});

Create a record based on the example

factory.attributesFor('user').then(function(attributes){
  attributes.admin = true;
  factory.create('user', attributes);
});

Create a record based in traits

factory.create('user',
  { email: 'somebody@gmail.com', password: 'hunter2'},
  { traits: ["admin", "full"] }
);

Empty the db when you're done testing

factory.clear();