Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge latest master into fastboot #1110

Merged
merged 9 commits into from
Dec 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addon/authenticators/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default EmberObject.extend(Evented, {
`data.authenticated` property (see
{{#crossLink "SessionService/data:property"}}{{/crossLink}}). A rejecting
promise indicates that `data` does not constitute a valid session and will
result in the session being invalidated or remaining unauthencicated.
result in the session being invalidated or remaining unauthenticated.

The `BaseAuthenticator`'s implementation always returns a rejecting
promise. __This method must be overridden in subclasses.__
Expand Down
2 changes: 1 addition & 1 deletion addon/authenticators/oauth2-password-grant.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default BaseAuthenticator.extend({
const min = 5;
const max = 10;

return (Math.floor(Math.random() * min) + (max - min)) * 1000;
return (Math.floor(Math.random() * (max - min)) + min) * 1000;
}).volatile(),

_refreshTokenTimeout: null,
Expand Down
2 changes: 1 addition & 1 deletion app/initializers/ember-simple-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
name: 'ember-simple-auth',
initialize: function(registry) {
const config = ENV['ember-simple-auth'] || {};
config.baseURL = ENV.baseURL;
config.baseURL = ENV.rootURL || ENV.baseURL;
Configuration.load(config);

setupSession(registry);
Expand Down
9 changes: 9 additions & 0 deletions docs/theme/helpers/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
exists: function(variable, options) {
if (typeof variable !== 'undefined') {
return options.fn(this);
} else if (options.inverse) {
return options.inverse(this);
}
}
};
4 changes: 2 additions & 2 deletions docs/theme/partials/props.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
{{#if access}}
<span class="label label-access-{{access}} pull-right">{{access}}</span>
{{/if}}
{{#if readOnly}}
{{#exists readonly}}
<span class="label label-warning pull-right">readonly</span>
{{/if}}
{{/exists}}
<h3 class="panel-title signature">
<strong class="name">`{{name}}`</strong>: <code>{{#crossLink type}}{{/crossLink}}</code>
</h3>
Expand Down
3 changes: 2 additions & 1 deletion ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ module.exports = function(defaults) {
quiet: true,
parseOnly: false,
lint: false,
themedir: 'docs/theme'
themedir: 'docs/theme',
helpers: ['docs/theme/helpers/helpers.js']
}
});

Expand Down
3 changes: 2 additions & 1 deletion guides/managing-current-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ export default Ember.Service.extend({
return new RSVP.Promise((resolve, reject) => {
let userId = this.get('session.data.authenticated.user_id');
if (!isEmpty(userId)) {
return this.get('store').find('user', userId).then((user) => {
this.get('store').find('user', userId).then((user) => {
this.set('user', user);
resolve();
}, reject);
} else {
resolve();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-inject-live-reload": "^1.4.0",
"ember-cli-jshint": "^1.0.0",
"ember-cli-mocha": "~0.10.4",
"ember-cli-mocha": "^0.12.0",
"ember-cli-pretender": "~0.6.0",
"ember-cli-release": "^0.2.9",
"ember-cli-sri": "^2.1.0",
Expand Down
3 changes: 2 additions & 1 deletion tests/dummy/app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import config from './config/environment';
const { Router: EmberRouter } = Ember;

const Router = EmberRouter.extend({
location: config.locationType
location: config.locationType,
rootURL: config.rootURL
});

Router.map(function() {
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/app/services/session-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default Service.extend({
return new RSVP.Promise((resolve, reject) => {
const accountId = this.get('session.data.authenticated.account_id');
if (!isEmpty(accountId)) {
return this.get('store').find('account', accountId).then((account) => {
this.get('store').find('account', accountId).then((account) => {
this.set('account', account);
resolve();
}, reject);
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/authenticators/base-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* jshint expr:true */
import { it } from 'ember-mocha';
import { describe, beforeEach } from 'mocha';
import { describe, beforeEach, it } from 'mocha';
import { expect } from 'chai';
import Base from 'ember-simple-auth/authenticators/base';

Expand Down
3 changes: 1 addition & 2 deletions tests/unit/authenticators/devise-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* jshint expr:true */
import Ember from 'ember';
import { it } from 'ember-mocha';
import { describe, beforeEach, afterEach } from 'mocha';
import { describe, beforeEach, afterEach, it } from 'mocha';
import { expect } from 'chai';
import Pretender from 'pretender';
import Devise from 'ember-simple-auth/authenticators/devise';
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/authenticators/oauth2-password-grant-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* jshint expr:true */
/* jscs:disable requireDotNotation */
import Ember from 'ember';
import { it } from 'ember-mocha';
import { describe, beforeEach, afterEach } from 'mocha';
import { describe, beforeEach, afterEach, it } from 'mocha';
import { expect } from 'chai';
import Pretender from 'pretender';
import OAuth2PasswordGrant from 'ember-simple-auth/authenticators/oauth2-password-grant';
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/authenticators/test-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* jshint expr:true */
import { it } from 'ember-mocha';
import { describe, beforeEach } from 'mocha';
import { describe, beforeEach, it } from 'mocha';
import { expect } from 'chai';
import Test from 'ember-simple-auth/authenticators/test';

Expand Down
3 changes: 1 addition & 2 deletions tests/unit/authenticators/torii-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* jshint expr:true */
import Ember from 'ember';
import { it } from 'ember-mocha';
import { describe, beforeEach } from 'mocha';
import { describe, beforeEach, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import Torii from 'ember-simple-auth/authenticators/torii';
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/authorizers/devise-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* jshint expr:true */
import { it } from 'ember-mocha';
import { describe, beforeEach } from 'mocha';
import { describe, beforeEach, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import Devise from 'ember-simple-auth/authorizers/devise';
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/authorizers/oauth2-bearer-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* jshint expr:true */
import { it } from 'ember-mocha';
import { describe, beforeEach } from 'mocha';
import { describe, beforeEach, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import OAuth2BearerAuthorizer from 'ember-simple-auth/authorizers/oauth2-bearer';
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/configuration-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* jshint expr:true */
import { it } from 'ember-mocha';
import { describe, afterEach } from 'mocha';
import { describe, afterEach, it } from 'mocha';
import { expect } from 'chai';
import Configuration from 'ember-simple-auth/configuration';

Expand Down
3 changes: 1 addition & 2 deletions tests/unit/initializers/setup-session-service-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* jshint expr:true */
import { it } from 'ember-mocha';
import { describe, beforeEach } from 'mocha';
import { describe, beforeEach, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import setupSessionService from 'ember-simple-auth/initializers/setup-session-service';
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/initializers/setup-session-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* jshint expr:true */
import Ember from 'ember';
import { it } from 'ember-mocha';
import { describe, beforeEach, afterEach } from 'mocha';
import { describe, beforeEach, afterEach, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import setupSession from 'ember-simple-auth/initializers/setup-session';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* jshint expr:true */
import Ember from 'ember';
import { it } from 'ember-mocha';
import { describe, beforeEach } from 'mocha';
import { describe, beforeEach, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import setupSessionRestoration from 'ember-simple-auth/instance-initializers/setup-session-restoration';
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/internal-session-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* jshint expr:true */
import Ember from 'ember';
import { it } from 'ember-mocha';
import { describe, beforeEach } from 'mocha';
import { describe, beforeEach, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import InternalSession from 'ember-simple-auth/internal-session';
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/mixins/application-route-mixin-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* jshint expr:true */
import Ember from 'ember';
import { it } from 'ember-mocha';
import { describe, beforeEach } from 'mocha';
import { describe, beforeEach, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/mixins/authenticated-route-mixin-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* jshint expr:true */
import Ember from 'ember';
import { it } from 'ember-mocha';
import { describe, beforeEach } from 'mocha';
import { describe, beforeEach, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/mixins/data-adapter-mixin-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* jshint expr:true */
import Ember from 'ember';
import { it } from 'ember-mocha';
import { describe, beforeEach } from 'mocha';
import { describe, beforeEach, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/mixins/unauthenticated-route-mixin-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* jshint expr:true */
import Ember from 'ember';
import { it } from 'ember-mocha';
import { describe, beforeEach } from 'mocha';
import { describe, beforeEach, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin';
Expand Down
11 changes: 7 additions & 4 deletions tests/unit/routes/application-test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/* jshint expr:true */
import { expect } from 'chai';
import { describeModule, it } from 'ember-mocha';
import { it, describe } from 'mocha';
import { setupTest } from 'ember-mocha';

describe('ApplicationRoute', function() {
setupTest('route:application', {
needs: ['service:session', 'router:main']
});

describeModule('route:application', 'ApplicationRoute', {
needs: ['service:session', 'router:main']
}, function() {
it('is still testable when using the ApplicationRouteMixin', function() {
const route = this.subject();

Expand Down
11 changes: 7 additions & 4 deletions tests/unit/routes/login-test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/* jshint expr:true */
import { expect } from 'chai';
import { describeModule, it } from 'ember-mocha';
import { it, describe } from 'mocha';
import { setupTest } from 'ember-mocha';

describe('LoginRoute', function() {
setupTest('route:login', {
needs: ['router:main']
});

describeModule('route:login', 'LoginRoute', {
needs: ['router:main']
}, function() {
it('is still testable when using the UnauthenticatedRouteMixin', function() {
const route = this.subject();

Expand Down
11 changes: 7 additions & 4 deletions tests/unit/routes/protected-test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/* jshint expr:true */
import { expect } from 'chai';
import { describeModule, it } from 'ember-mocha';
import { it, describe } from 'mocha';
import { setupTest } from 'ember-mocha';

describe('ProtectedRoute', function() {
setupTest('route:protected', {
needs: ['router:main']
});

describeModule('route:protected', 'ProtectedRoute', {
needs: ['router:main']
}, function() {
it('is still testable when using the AuthenticatedRouteMixin', function() {
const route = this.subject();

Expand Down
3 changes: 1 addition & 2 deletions tests/unit/services/session-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* jshint expr:true */
import Ember from 'ember';
import { it } from 'ember-mocha';
import { describe, beforeEach } from 'mocha';
import { describe, beforeEach, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import Session from 'ember-simple-auth/services/session';
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/session-stores/shared/cookie-store-behavior.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* jshint expr:true */
import Ember from 'ember';
import { it } from 'ember-mocha';
import { describe, beforeEach, afterEach } from 'mocha';
import { describe, beforeEach, afterEach, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import FakeCookieService from '../../../helpers/fake-cookie-service';
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/session-stores/shared/store-behavior.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* jshint expr:true */
import Ember from 'ember';
import { it } from 'ember-mocha';
import { describe, beforeEach } from 'mocha';
import { describe, beforeEach, it } from 'mocha';
import { expect } from 'chai';

const { run: { next }, K } = Ember;
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/utils/objects-are-equal-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* jshint expr:true */
import { it } from 'ember-mocha';
import { describe } from 'mocha';
import { describe, it } from 'mocha';
import { expect } from 'chai';
import objectsAreEqual from 'ember-simple-auth/utils/objects-are-equal';

Expand Down