├── .gitignore ├── LICENSE ├── README.md ├── app └── initializers │ └── simple-auth-testing.js ├── blueprints └── ember-cli-simple-auth-testing │ └── index.js ├── index.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 simplabs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ember Simple Auth Testing 2 | 3 | __This repository is deprecated. [Ember Simple Auth 1.0 is distributed as an 4 | Ember CLI Addon](https://github.com/simplabs/ember-simple-auth) that contains 5 | all of the previously individual parts of the library.__ 6 | 7 | This is an npm package that contains the Ember Simple Auth Testing extension 8 | library packaged as an [Ember CLI](https://github.com/stefanpenner/ember-cli) 9 | Addon. 10 | 11 | ## Installation 12 | 13 | **Ember Simple Auth testing requires at least Ember CLI 0.0.47** 14 | 15 | To install simply run 16 | 17 | ``` 18 | ember install ember-cli-simple-auth 19 | ember install ember-cli-simple-auth-testing 20 | ``` 21 | 22 | in your Ember CLI project's root. 23 | 24 | If you're using Ember CLI 0.2.2 or older, run 25 | 26 | ``` 27 | ember install:addon ember-cli-simple-auth 28 | ember install:addon ember-cli-simple-auth-testing 29 | ``` 30 | 31 | If you're using Ember CLI 0.1.4 or older, run 32 | 33 | ``` 34 | npm install --save-dev ember-cli-simple-auth 35 | ember generate ember-cli-simple-auth 36 | npm install --save-dev ember-cli-simple-auth-testing 37 | ember generate ember-cli-simple-auth-testing 38 | ``` 39 | 40 | You also need to import the helpers - preferrably in the app's 41 | `tests/helpers/start-app.js` file: 42 | 43 | ```js 44 | … 45 | 46 | import initializeTestHelpers from 'simple-auth-testing/test-helpers'; 47 | initializeTestHelpers(); 48 | 49 | export default function startApp(attrs) { 50 | … 51 | ``` 52 | 53 | ## Configuration 54 | 55 | When using the testing helpers also make sure to use the ephemeral session 56 | store for the `test` environment as otherwise the session will be persisted and 57 | tests might influence each other. 58 | 59 | ```js 60 | //config/environment.js 61 | if (environment === 'test') { 62 | ENV['simple-auth'] = { 63 | store: 'simple-auth-session-store:ephemeral' 64 | } 65 | } 66 | ``` 67 | 68 | For the actual Ember Simple Auth repository see 69 | https://github.com/simplabs/ember-simple-auth 70 | -------------------------------------------------------------------------------- /app/initializers/simple-auth-testing.js: -------------------------------------------------------------------------------- 1 | import initializer from 'simple-auth-testing/initializer'; 2 | 3 | export default initializer; 4 | -------------------------------------------------------------------------------- /blueprints/ember-cli-simple-auth-testing/index.js: -------------------------------------------------------------------------------- 1 | var EOL = require('os').EOL; 2 | 3 | module.exports = { 4 | normalizeEntityName: function() { 5 | }, 6 | 7 | afterInstall: function() { 8 | this.insertIntoFile('tests/.jshintrc', 9 | ' "authenticateSession",' + EOL + 10 | ' "invalidateSession",' + EOL + 11 | ' "currentSession",', 12 | { after: ' "predef": [' + EOL } 13 | ); 14 | 15 | return this.addBowerPackageToProject('ember-simple-auth', '0.8.0'); 16 | } 17 | }; 18 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var fs = require('fs'); 3 | 4 | module.exports = { 5 | name: 'Ember CLI Simple Auth Testing', 6 | 7 | treeFor: function(name) { 8 | if(!this.app.tests) { 9 | return; 10 | } 11 | 12 | var treePath = path.join(__dirname, name); 13 | if (fs.existsSync(treePath)) { 14 | return this.treeGenerator(treePath); 15 | } 16 | }, 17 | 18 | included: function(app) { 19 | if (app.tests) { 20 | app.import(app.bowerDirectory + '/ember-simple-auth/simple-auth-testing.amd.js', { 21 | exports: { 22 | 'simple-auth-testing/test-helpers': ['default'], 23 | 'simple-auth-testing/initializer': ['default'] 24 | } 25 | }); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-cli-simple-auth-testing", 3 | "author": "Marco Otte-Witte", 4 | "license": "MIT", 5 | "version": "0.8.0", 6 | "description": "Include the Ember Simple Auth Testing extension library into an Ember CLI application.", 7 | "main": "index.js", 8 | "scripts": { 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "ember-addon": { 12 | "main": "index" 13 | }, 14 | "keywords": [ 15 | "ember-addon" 16 | ], 17 | "repository": { 18 | "type": "git", 19 | "url": "git://github.com/simplabs/ember-cli-simple-auth-testing" 20 | }, 21 | "homepage": "https://github.com/simplabs/ember-cli-simple-auth-testing", 22 | "dependencies": { 23 | "ember-cli-simple-auth": "0.8.0" 24 | } 25 | } 26 | --------------------------------------------------------------------------------