rosiejs / rosie

factory for building JavaScript objects, mostly useful for setting up test data. Inspired by factory_girl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to exclude attributes when inheriting?

Alino opened this issue · comments

let's say I have this example factory definition

Factory.define('example')
.sequence('id')
.attr('ignored', false)
.attr('taskId', '666')

now I want to define another factory and inherit from 'example' factory
but removing some attributes

Factory.define('second-example').extend('example')
.removeAttr('ignored')

the .removeAttr method does not exist, is there such concept? or how could I achieve my goal?

You could reverse the "inheritance", or you could define an after build step for the second one that arbitrarily edits the object.