all files / tests/dummy/app/instance-initializers/ dummy-dev.js

100% Statements 14/14
100% Branches 0/0
100% Functions 1/1
100% Lines 14/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52                                                                           
import Ember from 'ember';
 
const {
  Logger: { info }
} = Ember;
 
export default {
  name: 'dummy:dev',
  initialize(app) {
    let stores = app.lookup('documents:stores');
    let store = stores.store({ url: 'http://dev.amateurinmotion.com:6016' });
 
    let db = store.database('thing');
 
    app.register('service:db', db, { instantiate: false });
 
    window.log = info;
    window.stores = stores;
    window.store = store;
    window.db = db;
 
    app.inject('route', 'db', 'service:db');
    app.inject('component', 'db', 'service:db');
 
    window.author = db.push({
      _id: 'author:ampatspell',
      _rev: '1-qwe',
      type: 'author',
      name: 'ampatspell'
    });
 
    window.blog = db.push({
      _id: 'blog:ducks',
      _rev: '1-asd',
      type: 'blog',
      title: 'The Ducks',
      owner: 'author:ampatspell'
    });
 
    window.post = db.push({
      _id: 'blog-post:ducks:one',
      _rev: '1-sdf',
      type: 'blog-post',
      title: 'Welcome',
      owner: 'author:ampatspell',
      blog: 'blog:ducks'
    });
 
  }
};