From 10a5087f30b7f785d9b62e6ca5eb89ce6f0bc7a6 Mon Sep 17 00:00:00 2001 From: Federico Teotini Date: Wed, 12 Oct 2016 19:19:01 +0200 Subject: [PATCH] updated ember-cli (+3 squashed commits) Squashed commits: [713bd13] ember try config [11789d8] travis.ci phantomjs [8418b68] Updated ember-cli --- .editorconfig | 14 -- .jshintrc | 2 +- .npmignore | 20 +-- .travis.yml | 35 ++--- addon/adapters/pouch.js | 2 +- addon/serializers/pouch.js | 5 +- blueprints/.jshintrc | 6 - blueprints/ember-pouch/index.js | 5 +- bower.json | 38 +---- config/ember-try.js | 131 ++++++++++++------ ember-cli-build.js | 5 +- index.js | 35 +---- package.json | 36 ++--- testem.json => testem.js | 5 +- tests/.jshintrc | 2 +- tests/dummy/app/adapters/application.js | 2 +- tests/dummy/app/app.js | 4 +- tests/dummy/app/index.html | 16 +-- tests/dummy/app/resolver.js | 3 + tests/dummy/app/router.js | 3 +- tests/dummy/app/templates/application.hbs | 3 - tests/dummy/config/environment.js | 8 +- tests/helpers/module-for-acceptance.js | 47 ++----- tests/helpers/module-for-pouch-acceptance.js | 52 +++++++ tests/helpers/resolver.js | 2 +- tests/index.html | 33 +++-- .../{dummy/app/views => integration}/.gitkeep | 0 .../integration/adapters/pouch-basics-test.js | 3 +- .../pouch-default-change-watcher-test.js | 3 +- tests/integration/serializers/pouch-test.js | 2 +- vendor/ember-pouch/shim.js | 7 - vendor/shims/pouchdb.js | 9 ++ 32 files changed, 263 insertions(+), 275 deletions(-) delete mode 100644 blueprints/.jshintrc rename testem.json => testem.js (81%) create mode 100644 tests/dummy/app/resolver.js delete mode 100644 tests/dummy/app/templates/application.hbs create mode 100644 tests/helpers/module-for-pouch-acceptance.js rename tests/{dummy/app/views => integration}/.gitkeep (100%) delete mode 100644 vendor/ember-pouch/shim.js create mode 100644 vendor/shims/pouchdb.js diff --git a/.editorconfig b/.editorconfig index 47c5438..219985c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,22 +13,8 @@ insert_final_newline = true indent_style = space indent_size = 2 -[*.js] -indent_style = space -indent_size = 2 - [*.hbs] insert_final_newline = false -indent_style = space -indent_size = 2 - -[*.css] -indent_style = space -indent_size = 2 - -[*.html] -indent_style = space -indent_size = 2 [*.{diff,md}] trim_trailing_whitespace = false diff --git a/.jshintrc b/.jshintrc index 08096ef..d421faa 100644 --- a/.jshintrc +++ b/.jshintrc @@ -27,6 +27,6 @@ "strict": false, "white": false, "eqnull": true, - "esnext": true, + "esversion": 6, "unused": true } diff --git a/.npmignore b/.npmignore index 49996f5..fa8b147 100644 --- a/.npmignore +++ b/.npmignore @@ -1,14 +1,16 @@ -bower_components/ -tests/ -tmp/ -dist/ - +/bower_components +/config/ember-try.js +/dist +/tests +/tmp +**/.gitkeep .bowerrc .editorconfig .ember-cli +.gitignore +.jshintrc +.watchmanconfig .travis.yml -.npmignore -**/.gitkeep bower.json -Brocfile.js -testem.json +ember-cli-build.js +testem.js diff --git a/.travis.yml b/.travis.yml index c74d6b2..b81ce7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ --- language: node_js node_js: - - "0.12" + - "4" sudo: false @@ -10,10 +10,11 @@ cache: - node_modules env: - - EMBER_TRY_SCENARIO=ember-data-2.0 - - EMBER_TRY_SCENARIO=ember-data-2.1 - - EMBER_TRY_SCENARIO=ember-data-2.2 - - EMBER_TRY_SCENARIO=ember-data-2.3 + - EMBER_TRY_SCENARIO=ember-2.0-stack + - EMBER_TRY_SCENARIO=ember-2.1-stack + - EMBER_TRY_SCENARIO=ember-2.2-stack + - EMBER_TRY_SCENARIO=ember-2.3-stack + - EMBER_TRY_SCENARIO=ember-2.4-stack - EMBER_TRY_SCENARIO=ember-release - EMBER_TRY_SCENARIO=ember-beta - EMBER_TRY_SCENARIO=ember-canary @@ -21,28 +22,20 @@ env: matrix: fast_finish: true allow_failures: - - env: EMBER_TRY_SCENARIO=ember-release - - env: EMBER_TRY_SCENARIO=ember-beta - env: EMBER_TRY_SCENARIO=ember-canary before_install: - # After travis-ci/travis-ci#3225 is resolved, restore this and remove the - # manual download/install of PhantomJS 2.0. - # - export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH - - mkdir 'phantomjs-2.0.0' - - cd 'phantomjs-2.0.0' - - curl -O 'https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2' - - tar xjvf 'phantomjs-2.0.0-ubuntu-12.04.tar.bz2' - - cd - - - export PATH=./phantomjs-2.0.0:$PATH - - - "npm config set spin false" - - "npm install -g npm@^2" + - npm config set spin false + - npm install -g bower + - bower --version + - npm install -g phantomjs-prebuilt + - phantomjs --version install: - - npm install -g bower - npm install - bower install script: - - ember try $EMBER_TRY_SCENARIO test + # Usually, it's ok to finish the test scenario without reverting + # to the addon's original dependency state, skipping "cleanup". + - ember try:one $EMBER_TRY_SCENARIO test --skip-cleanup diff --git a/addon/adapters/pouch.js b/addon/adapters/pouch.js index 310ea60..d00164e 100644 --- a/addon/adapters/pouch.js +++ b/addon/adapters/pouch.js @@ -3,7 +3,7 @@ import DS from 'ember-data'; import { extractDeleteRecord -} from 'ember-pouch/utils'; +} from '../utils'; const { run: { diff --git a/addon/serializers/pouch.js b/addon/serializers/pouch.js index ee92d1b..4043de4 100644 --- a/addon/serializers/pouch.js +++ b/addon/serializers/pouch.js @@ -5,6 +5,7 @@ const { get, } = Ember; const keys = Object.keys || Ember.keys; +const assign = Object.assign || Ember.assign; export default DS.RESTSerializer.extend({ _shouldSerializeHasMany: function() { @@ -41,9 +42,9 @@ export default DS.RESTSerializer.extend({ // of the document. // This will conflict with any 'attachments' attr in the model. Suggest that // #toRawDoc in relational-pouch should allow _attachments to be specified - json.attachments = Object.assign({}, json.attachments || {}, json[payloadKey]); // jshint ignore:line + json.attachments = assign({}, json.attachments || {}, json[payloadKey]); // jshint ignore:line json[payloadKey] = keys(json[payloadKey]).reduce((attr, fileName) => { - attr[fileName] = Object.assign({}, json[payloadKey][fileName]); // jshint ignore:line + attr[fileName] = assign({}, json[payloadKey][fileName]); // jshint ignore:line delete attr[fileName].data; delete attr[fileName].content_type; return attr; diff --git a/blueprints/.jshintrc b/blueprints/.jshintrc deleted file mode 100644 index 33f4f6f..0000000 --- a/blueprints/.jshintrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "predef": [ - "console" - ], - "strict": false -} diff --git a/blueprints/ember-pouch/index.js b/blueprints/ember-pouch/index.js index ec423cc..5a5a4fe 100644 --- a/blueprints/ember-pouch/index.js +++ b/blueprints/ember-pouch/index.js @@ -1,7 +1,6 @@ -'use strict'; - +/*jshint node:true*/ module.exports = { - normalizeEntityName: function() {}, + description: 'Install ember-pouch deps via Bower', afterInstall: function() { return this.addBowerPackagesToProject([ diff --git a/bower.json b/bower.json index e32153e..3c10f78 100644 --- a/bower.json +++ b/bower.json @@ -1,41 +1,11 @@ { "name": "ember-pouch", - "version": "2.0.0", - "description": "PouchDB adapter for Ember Data", - "homepage": "https://github.com/nolanlawson/ember-pouch", - "authors": [ - "Nolan Lawson " - ], - "main": "dist/globals/main.js", - "keywords": [ - "PouchDB", - "Ember", - "Data", - "adapter" - ], - "license": "Apache 2", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], "dependencies": { - "ember": "~1.13.0 || 2.x", - "ember-cli-shims": "0.1.0", - "ember-cli-test-loader": "0.2.1", - "ember-data": "~1.13.0 || 2.x", - "ember-load-initializers": "0.1.7", - "ember-qunit": "0.4.16", - "ember-qunit-notifications": "0.1.0", - "ember-resolver": "~0.1.20", - "jquery": "1.11.3", - "loader.js": "ember-cli/loader.js#3.4.0", - "qunit": "~1.20.0", + "ember": "~2.8.0", + "ember-cli-shims": "0.1.1", "pouchdb": "^5.4.5", "relational-pouch": "^1.4.4", - "phantomjs-polyfill-object-assign": "chuckplantain/phantomjs-polyfill-object-assign", - "pouchdb-find": "^0.10.2" + "pouchdb-find": "^0.10.3", + "phantomjs-polyfill-object-assign": "chuckplantain/phantomjs-polyfill-object-assign" } } diff --git a/config/ember-try.js b/config/ember-try.js index 238c384..bcd49f0 100644 --- a/config/ember-try.js +++ b/config/ember-try.js @@ -1,76 +1,123 @@ +/*jshint node:true*/ module.exports = { scenarios: [ { - name: 'ember-data-2.0', - dependencies: { - 'ember': '2.0.2', - 'ember-data': '2.0.1', - 'ember-cli-shims': '0.0.6' + name: 'ember-2.0-stack', + npm: { + devDependencies: { + 'ember-data': '2.0.1' + } }, - resolutions: { - 'ember': '2.0.2' + bower: { + dependencies: { + 'ember': '2.0.3', + 'ember-data': '2.0.1', + 'ember-cli-shims': '0.0.6' + } } }, { - name: 'ember-data-2.1', - dependencies: { - 'ember': '2.1.1', - 'ember-data': '2.1.0', - 'ember-cli-shims': '0.0.6' + name: 'ember-2.1-stack', + npm: { + devDependencies: { + 'ember-data': '2.1.0' + } }, - resolutions: { - 'ember': '2.1.1' + bower: { + dependencies: { + 'ember': '2.1.2', + 'ember-data': '2.1.0', + 'ember-cli-shims': '0.0.6' + } } }, { - name: 'ember-data-2.2', - dependencies: { - 'ember': '2.2.0', - 'ember-data': '2.2.1', - 'ember-cli-shims': '0.0.6' + name: 'ember-2.2-stack', + npm: { + devDependencies: { + 'ember-data': '2.2.1' + } }, - resolutions: { - 'ember': '2.2.0' + bower: { + dependencies: { + 'ember': '2.2.2', + 'ember-data': '2.2.1', + 'ember-cli-shims': '0.0.6' + } } }, { - name: 'ember-data-2.3', - dependencies: { - 'ember': '2.2.1', - 'ember-data': '2.3.0', + name: 'ember-2.3-stack', + npm: { + devDependencies: { + 'ember-data': '2.3.3' + } }, - resolutions: { - 'ember': '2.2.1' + bower: { + dependencies: { + 'ember': '2.3.2' + } + } + }, + { + name: 'ember-2.4-stack', + npm: { + devDependencies: { + 'ember-data': '2.4.3' + } + }, + bower: { + dependencies: { + 'ember': '2.4.6' + } } }, { name: 'ember-release', - dependencies: { - 'ember': 'components/ember#release', - 'ember-data': 'components/ember-data#release' + npm: { + devDependencies: { + 'ember-data': 'components/ember-data#release' + } }, - resolutions: { - 'ember': 'release' + bower: { + dependencies: { + 'ember': 'components/ember#release' + }, + resolutions: { + 'ember': 'release' + } } }, { name: 'ember-beta', - dependencies: { - 'ember': 'components/ember#beta', - 'ember-data': 'components/ember-data#beta' + npm: { + devDependencies: { + 'ember-data': 'components/ember-data#beta' + } }, - resolutions: { - 'ember': 'beta' + bower: { + dependencies: { + 'ember': 'components/ember#beta' + }, + resolutions: { + 'ember': 'beta' + } } }, { name: 'ember-canary', - dependencies: { - 'ember': 'components/ember#canary', - 'ember-data': 'components/ember-data#canary' + npm: { + devDependencies: { + 'ember-data': 'components/ember-data#canary' + } }, - resolutions: { - 'ember': 'canary' + bower: { + dependencies: { + 'ember': 'components/ember#canary' + }, + resolutions: { + 'ember': 'canary' + } } } ] diff --git a/ember-cli-build.js b/ember-cli-build.js index a764a76..e35c7a9 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -8,15 +8,14 @@ module.exports = function(defaults) { }); /* - This build file specifes the options for the dummy test app of this + This build file specifies the options for the dummy test app of this addon, located in `/tests/dummy` This build file does *not* influence how the addon or the app using it behave. You most likely want to be modifying `./index.js` or app's build file */ - app.import('bower_components/phantomjs-polyfill-object-assign/object-assign-polyfill.js', { type: 'test' }); - + return app.toTree(); }; diff --git a/index.js b/index.js index d0adc63..b298a94 100644 --- a/index.js +++ b/index.js @@ -1,43 +1,16 @@ /* jshint node: true */ 'use strict'; -var VersionChecker = require('ember-cli-version-checker'); - -// We support Ember-Data 1.13.x and 2.x. Checking for this is complicated -// because the effective version of ember-data is controlled by bower for -// 1.13.0-2.2.x and npm for 2.3.x. This gets as close as we can get using -// ember-cli-version-checker. -function satisfactoryEmberDataVersion(addon) { - var checker = new VersionChecker(addon), - bowerEmberData = checker.for('ember-data', 'bower'), - npmEmberData = checker.for('ember-data', 'npm'); - return npmEmberData.isAbove('2.2.99') || bowerEmberData.isAbove('1.13.16'); -} - module.exports = { name: 'ember-pouch', - - init: function () { - this._super.init && this._super.init.apply(this, arguments); - - if (!satisfactoryEmberDataVersion(this)) { - var error = new Error("ember-pouch requires ember-data 1.13.x or 2.x"); - error.suppressStacktrace = true; - throw error; - } - }, - - included: function included(app) { - var bowerDir = app.bowerDirectory; + included(app) { + const bowerDir = app.bowerDirectory; app.import(bowerDir + '/pouchdb/dist/pouchdb.js'); app.import(bowerDir + '/relational-pouch/dist/pouchdb.relational-pouch.js'); app.import(bowerDir + '/pouchdb-find/dist/pouchdb.find.js'); - app.import('vendor/ember-pouch/shim.js', { - type: 'vendor', - exports: { - 'pouchdb': [ 'default' ] - } + app.import('vendor/shims/pouchdb.js', { + exports: { 'pouchdb': [ 'default' ]} }); } }; diff --git a/package.json b/package.json index 899f6ee..b4a6289 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "scripts": { "build": "ember build", "start": "ember server", - "test": "ember try:testall" + "test": "ember try:each" }, "repository": { "type": "git", @@ -32,28 +32,28 @@ "url": "https://github.com/nolanlawson/ember-pouch/issues" }, "devDependencies": { - "broccoli-asset-rev": "^2.2.0", - "ember-cli": "1.13.13", + "broccoli-asset-rev": "^2.4.2", + "ember-cli": "2.8.0", "ember-cli-app-version": "^1.0.0", - "ember-cli-content-security-policy": "0.4.0", - "ember-cli-dependency-checker": "^1.1.0", - "ember-cli-htmlbars": "^1.0.1", + "ember-cli-dependency-checker": "^1.2.0", + "ember-cli-htmlbars": "^1.0.3", "ember-cli-htmlbars-inline-precompile": "^0.3.1", - "ember-cli-ic-ajax": "0.2.4", - "ember-cli-inject-live-reload": "^1.3.1", - "ember-cli-qunit": "^1.0.4", - "ember-cli-release": "0.2.8", - "ember-cli-sri": "^1.2.0", + "ember-cli-inject-live-reload": "^1.4.0", + "ember-cli-jshint": "^1.0.0", + "ember-cli-qunit": "^2.1.0", + "ember-cli-release": "^0.2.9", + "ember-cli-sri": "^2.1.0", + "ember-cli-test-loader": "^1.1.0", "ember-cli-uglify": "^1.2.0", - "ember-data": "~1.13.0 || 2.x", - "ember-disable-proxy-controllers": "^1.0.1", - "ember-export-application-global": "^1.0.4", - "ember-disable-prototype-extensions": "^1.0.0", - "ember-try": "~0.0.8" + "ember-data": "^2.8.0", + "ember-disable-prototype-extensions": "^1.1.0", + "ember-export-application-global": "^1.0.5", + "ember-load-initializers": "^0.5.1", + "ember-resolver": "^2.0.3", + "loader.js": "^4.0.1" }, "dependencies": { - "ember-cli-babel": "^5.1.5", - "ember-cli-version-checker": "1.1.5" + "ember-cli-babel": "^5.1.6" }, "ember-addon": { "configPath": "tests/dummy/config" diff --git a/testem.json b/testem.js similarity index 81% rename from testem.json rename to testem.js index 0f35392..26044b2 100644 --- a/testem.json +++ b/testem.js @@ -1,4 +1,5 @@ -{ +/*jshint node:true*/ +module.exports = { "framework": "qunit", "test_page": "tests/index.html?hidepassed", "disable_watching": true, @@ -9,4 +10,4 @@ "PhantomJS", "Chrome" ] -} +}; diff --git a/tests/.jshintrc b/tests/.jshintrc index 6ec0b7c..d2bd113 100644 --- a/tests/.jshintrc +++ b/tests/.jshintrc @@ -47,6 +47,6 @@ "strict": false, "white": false, "eqnull": true, - "esnext": true, + "esversion": 6, "unused": true } diff --git a/tests/dummy/app/adapters/application.js b/tests/dummy/app/adapters/application.js index 740da8a..2ee8495 100644 --- a/tests/dummy/app/adapters/application.js +++ b/tests/dummy/app/adapters/application.js @@ -1,4 +1,4 @@ -import { Adapter } from 'ember-pouch/index'; +import { Adapter } from 'ember-pouch'; import PouchDB from 'pouchdb'; import config from 'dummy/config/environment'; import Ember from 'ember'; diff --git a/tests/dummy/app/app.js b/tests/dummy/app/app.js index 8b234d6..831ad61 100644 --- a/tests/dummy/app/app.js +++ b/tests/dummy/app/app.js @@ -1,6 +1,6 @@ import Ember from 'ember'; -import Resolver from 'ember/resolver'; -import loadInitializers from 'ember/load-initializers'; +import Resolver from './resolver'; +import loadInitializers from 'ember-load-initializers'; import config from './config/environment'; let App; diff --git a/tests/dummy/app/index.html b/tests/dummy/app/index.html index 1c49d36..5120bd7 100644 --- a/tests/dummy/app/index.html +++ b/tests/dummy/app/index.html @@ -7,19 +7,19 @@ - {{content-for 'head'}} + {{content-for "head"}} - - + + - {{content-for 'head-footer'}} + {{content-for "head-footer"}} - {{content-for 'body'}} + {{content-for "body"}} - - + + - {{content-for 'body-footer'}} + {{content-for "body-footer"}} diff --git a/tests/dummy/app/resolver.js b/tests/dummy/app/resolver.js new file mode 100644 index 0000000..2fb563d --- /dev/null +++ b/tests/dummy/app/resolver.js @@ -0,0 +1,3 @@ +import Resolver from 'ember-resolver'; + +export default Resolver; diff --git a/tests/dummy/app/router.js b/tests/dummy/app/router.js index 3bba78e..cdc2578 100644 --- a/tests/dummy/app/router.js +++ b/tests/dummy/app/router.js @@ -2,7 +2,8 @@ import Ember from 'ember'; import config from './config/environment'; const Router = Ember.Router.extend({ - location: config.locationType + location: config.locationType, + rootURL: config.rootURL }); Router.map(function() { diff --git a/tests/dummy/app/templates/application.hbs b/tests/dummy/app/templates/application.hbs deleted file mode 100644 index f8bc38e..0000000 --- a/tests/dummy/app/templates/application.hbs +++ /dev/null @@ -1,3 +0,0 @@ -

Welcome to Ember

- -{{outlet}} diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index f50bb9c..c034e94 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -5,7 +5,7 @@ module.exports = function(environment) { modulePrefix: 'dummy', environment: environment, emberpouch: { localDb: 'ember-pouch-test' }, - baseURL: '/', + rootURL: '/', locationType: 'auto', EmberENV: { FEATURES: { @@ -17,8 +17,7 @@ module.exports = function(environment) { APP: { // Here you can pass flags/options to your application instance // when it is created - }, - + } }; if (environment === 'development') { @@ -31,7 +30,6 @@ module.exports = function(environment) { if (environment === 'test') { // Testem prefers this... - ENV.baseURL = '/'; ENV.locationType = 'none'; // keep test console output quieter @@ -39,10 +37,10 @@ module.exports = function(environment) { ENV.APP.LOG_VIEW_LOOKUPS = false; ENV.APP.rootElement = '#ember-testing'; - } if (environment === 'production') { + } return ENV; diff --git a/tests/helpers/module-for-acceptance.js b/tests/helpers/module-for-acceptance.js index 65c61ba..76996fd 100644 --- a/tests/helpers/module-for-acceptance.js +++ b/tests/helpers/module-for-acceptance.js @@ -1,52 +1,23 @@ import { module } from 'qunit'; +import Ember from 'ember'; import startApp from '../helpers/start-app'; import destroyApp from '../helpers/destroy-app'; -import config from 'dummy/config/environment'; -import Ember from 'ember'; -/* globals PouchDB */ +const { RSVP: { Promise } } = Ember; export default function(name, options = {}) { module(name, { - beforeEach(assert) { - var done = assert.async(); - - Ember.RSVP.Promise.resolve().then(() => { - return (new PouchDB(config.emberpouch.localDb)).destroy(); - }).then(() => { - this.application = startApp(); - - this.lookup = function (item) { - return this.application.__container__.lookup(item); - }; - - this.store = function store() { - return this.lookup('service:store'); - }; + beforeEach() { + this.application = startApp(); - // At the container level, adapters are not singletons (ember-data - // manages them). To get the instance that the app is using, we have to - // go through the store. - this.adapter = function adapter() { - return this.store().adapterFor('taco-soup'); - }; - - this.db = function db() { - return this.adapter().get('db'); - }; - - if (options.beforeEach) { - options.beforeEach.apply(this, arguments); - } - }).finally(done); + if (options.beforeEach) { + return options.beforeEach.apply(this, arguments); + } }, afterEach() { - destroyApp(this.application); - - if (options.afterEach) { - options.afterEach.apply(this, arguments); - } + let afterEach = options.afterEach && options.afterEach.apply(this, arguments); + return Promise.resolve(afterEach).then(() => destroyApp(this.application)); } }); } diff --git a/tests/helpers/module-for-pouch-acceptance.js b/tests/helpers/module-for-pouch-acceptance.js new file mode 100644 index 0000000..65c61ba --- /dev/null +++ b/tests/helpers/module-for-pouch-acceptance.js @@ -0,0 +1,52 @@ +import { module } from 'qunit'; +import startApp from '../helpers/start-app'; +import destroyApp from '../helpers/destroy-app'; +import config from 'dummy/config/environment'; + +import Ember from 'ember'; +/* globals PouchDB */ + +export default function(name, options = {}) { + module(name, { + beforeEach(assert) { + var done = assert.async(); + + Ember.RSVP.Promise.resolve().then(() => { + return (new PouchDB(config.emberpouch.localDb)).destroy(); + }).then(() => { + this.application = startApp(); + + this.lookup = function (item) { + return this.application.__container__.lookup(item); + }; + + this.store = function store() { + return this.lookup('service:store'); + }; + + // At the container level, adapters are not singletons (ember-data + // manages them). To get the instance that the app is using, we have to + // go through the store. + this.adapter = function adapter() { + return this.store().adapterFor('taco-soup'); + }; + + this.db = function db() { + return this.adapter().get('db'); + }; + + if (options.beforeEach) { + options.beforeEach.apply(this, arguments); + } + }).finally(done); + }, + + afterEach() { + destroyApp(this.application); + + if (options.afterEach) { + options.afterEach.apply(this, arguments); + } + } + }); +} diff --git a/tests/helpers/resolver.js b/tests/helpers/resolver.js index ebfb4e4..b208d38 100644 --- a/tests/helpers/resolver.js +++ b/tests/helpers/resolver.js @@ -1,4 +1,4 @@ -import Resolver from 'ember/resolver'; +import Resolver from '../../resolver'; import config from '../../config/environment'; const resolver = Resolver.create(); diff --git a/tests/index.html b/tests/index.html index 5e88e5e..f7ff652 100644 --- a/tests/index.html +++ b/tests/index.html @@ -7,28 +7,27 @@ - {{content-for 'head'}} - {{content-for 'test-head'}} + {{content-for "head"}} + {{content-for "test-head"}} - - - + + + - {{content-for 'head-footer'}} - {{content-for 'test-head-footer'}} + {{content-for "head-footer"}} + {{content-for "test-head-footer"}} - {{content-for 'body'}} - {{content-for 'test-body'}} + {{content-for "body"}} + {{content-for "test-body"}} - - - - - - + + + + + - {{content-for 'body-footer'}} - {{content-for 'test-body-footer'}} + {{content-for "body-footer"}} + {{content-for "test-body-footer"}} diff --git a/tests/dummy/app/views/.gitkeep b/tests/integration/.gitkeep similarity index 100% rename from tests/dummy/app/views/.gitkeep rename to tests/integration/.gitkeep diff --git a/tests/integration/adapters/pouch-basics-test.js b/tests/integration/adapters/pouch-basics-test.js index 6612161..6c6b960 100644 --- a/tests/integration/adapters/pouch-basics-test.js +++ b/tests/integration/adapters/pouch-basics-test.js @@ -1,5 +1,6 @@ import { test } from 'qunit'; -import moduleForIntegration from '../../helpers/module-for-acceptance'; +import DS from 'ember-data'; +import moduleForIntegration from '../../helpers/module-for-pouch-acceptance'; import Ember from 'ember'; diff --git a/tests/integration/adapters/pouch-default-change-watcher-test.js b/tests/integration/adapters/pouch-default-change-watcher-test.js index cf0285e..64e2bb3 100644 --- a/tests/integration/adapters/pouch-default-change-watcher-test.js +++ b/tests/integration/adapters/pouch-default-change-watcher-test.js @@ -1,5 +1,5 @@ import { test } from 'qunit'; -import moduleForIntegration from '../../helpers/module-for-acceptance'; +import moduleForIntegration from '../../helpers/module-for-pouch-acceptance'; import Ember from 'ember'; @@ -193,4 +193,3 @@ test('a new record is automatically loaded', function (assert) { }, 15); }).finally(done); }); - diff --git a/tests/integration/serializers/pouch-test.js b/tests/integration/serializers/pouch-test.js index 32af5dc..4ba0561 100644 --- a/tests/integration/serializers/pouch-test.js +++ b/tests/integration/serializers/pouch-test.js @@ -1,5 +1,5 @@ import { test } from 'qunit'; -import moduleForIntegration from '../../helpers/module-for-acceptance'; +import moduleForIntegration from '../../helpers/module-for-pouch-acceptance'; import Ember from 'ember'; diff --git a/vendor/ember-pouch/shim.js b/vendor/ember-pouch/shim.js deleted file mode 100644 index edcc205..0000000 --- a/vendor/ember-pouch/shim.js +++ /dev/null @@ -1,7 +0,0 @@ -/* globals PouchDB */ - -define('pouchdb', [], function() { - "use strict"; - - return { 'default': PouchDB }; -}); \ No newline at end of file diff --git a/vendor/shims/pouchdb.js b/vendor/shims/pouchdb.js new file mode 100644 index 0000000..ab8c2c4 --- /dev/null +++ b/vendor/shims/pouchdb.js @@ -0,0 +1,9 @@ +(function() { + function vendorModule() { + 'use strict'; + + return { 'default': self['PouchDB'] }; + } + + define('pouchdb', [], vendorModule); +})();