From 3e2a6bb8472e53a6c58b22cc0d84f4f6e2299995 Mon Sep 17 00:00:00 2001 From: Can Rozanes <37912128+canrozanes@users.noreply.github.com> Date: Thu, 29 Apr 2021 12:50:44 -0400 Subject: [PATCH] docs: factory - fix traits example The code snippet changed in this PR is described with the following text `Here we define a withComments trait that creates 3 comments for a newly created post:` Creating a post requires having a factory on the path `mirage/factories/post.js` as opposed to `mirage/factories/user.js` Also to keep it consistent with the rest of the examples where posts have a property called `title`, as opposed to `name`, I went ahead and updated the `name` property on the factory to be `title`. --- tests/dummy/app/pods/docs/data-layer/factories/template.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/dummy/app/pods/docs/data-layer/factories/template.md b/tests/dummy/app/pods/docs/data-layer/factories/template.md index 671bf19d9..863e41634 100644 --- a/tests/dummy/app/pods/docs/data-layer/factories/template.md +++ b/tests/dummy/app/pods/docs/data-layer/factories/template.md @@ -470,11 +470,11 @@ When combined with the `afterCreate()` hook, traits simplify the process of sett Here we define a `withComments` trait that creates 3 comments for a newly created post: ``` js -// mirage/factories/user.js +// mirage/factories/post.js import { Factory, trait } from 'ember-cli-mirage'; export default Factory.extend({ - name: 'Lorem ipsum', + title: 'Lorem ipsum', withComments: trait({ afterCreate(post, server) {