You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The biggest reason to use factories instead of fixtures is that the properties are not static, so your tests aren't depending on static "magic" values. This article explains pretty well why thoughtbot's factory_girl gem is better than the built-in rails fixtures.
For this reason, I think this library should support generating dynamic properties.
For example:
chai.factory('person',{age: ()=>{Math.floor(Math.random()*(100-5))+5)}// Pick a random age between 5 and 100.});varuser1=chai.create('person');varuser2=chai.create('person');console.log(user1.age);// Logs 31console.log(user2.age);// Logs 57
The text was updated successfully, but these errors were encountered:
The biggest reason to use factories instead of fixtures is that the properties are not static, so your tests aren't depending on static "magic" values. This article explains pretty well why thoughtbot's factory_girl gem is better than the built-in rails fixtures.
For this reason, I think this library should support generating dynamic properties.
For example:
The text was updated successfully, but these errors were encountered: