Skip to content

Instantly share code, notes, and snippets.

@danielspaniel
Last active February 21, 2018 00:56
Show Gist options
  • Save danielspaniel/24f526bd329ac563a15c23514a415ebd to your computer and use it in GitHub Desktop.
Save danielspaniel/24f526bd329ac563a15c23514a415ebd to your computer and use it in GitHub Desktop.
FactoryGuy make/mockFindRecord
import Ember from 'ember';
export default Ember.Controller.extend({
});
import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
export default Model.extend({
name: attr('string'),
email: attr('string')
});
import Ember from 'ember';
import {make} from 'ember-data-factory-guy';
export default Ember.Route.extend({
model() {
return make('user');
}
});
<h1>Welcome to Factory Guy make / mockFindRecord </h1>
<br>
User:
<br>
name: {{model.name}}
<br>
email: {{model.email}}
<br>
<br>
import FactoryGuy from 'ember-data-factory-guy';
FactoryGuy.define('user', {
default: {
name: (f) => `name-${f.id}`,
email: (f) => `user-${f.id}@test.com`,
}
});
{
"version": "0.13.0",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.16.2",
"ember-template-compiler": "2.16.2",
"ember-testing": "2.16.2"
},
"addons": {
"ember-data": "2.16.3",
"ember-data-factory-guy": "2.13.22"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment