Skip to content

Commit 52bd808

Browse files
authored
Merge pull request #225 from gorner/bugfix/deprecate-syntax
[bugfix] Fix Ember.deprecate syntax
2 parents 0492d1b + 1090be3 commit 52bd808

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

addon-test-support/only.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import { wrapTest, commonConfig } from './utils/config';
66
commonConfig();
77

88
export default function only(testName, callback) {
9-
deprecate('This pattern is now deprecated. Please import the `setupSinon` method instead.', {
10-
id: 'ember-sinon-qunit.only'
9+
deprecate('This pattern is now deprecated. Please import the `setupSinon` method instead.', false, {
10+
id: 'ember-sinon-qunit.only',
11+
until: '5.0.0',
12+
url: 'https://github.com/elwayman02/ember-sinon-qunit#migration-from-older-versions-of-ember-sinon-qunit'
1113
});
1214
wrapTest(testName, callback, emberQUnitOnly);
1315
}

addon-test-support/test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import { wrapTest, commonConfig } from './utils/config';
66
commonConfig();
77

88
export default function test(testName, callback) {
9-
deprecate('This pattern is now deprecated. Please import the `setupSinon` method instead.', {
10-
id: 'ember-sinon-qunit.test'
9+
deprecate('This pattern is now deprecated. Please import the `setupSinon` method instead.', false, {
10+
id: 'ember-sinon-qunit.test',
11+
until: '5.0.0',
12+
url: 'https://github.com/elwayman02/ember-sinon-qunit#migration-from-older-versions-of-ember-sinon-qunit'
1113
});
1214
wrapTest(testName, callback, emberQUnitTest);
1315
}

tests/unit/ember-sinon-qunit-test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { module } from 'qunit';
22
import { resolve } from 'rsvp';
33
import test from 'ember-sinon-qunit/test-support/test';
44
import assertSinonInTestContext from '../helpers/assert-sinon-in-test-context';
5+
import Ember from 'ember';
6+
import sinon from 'sinon';
57

68
let fooValue = 42;
79
let origMethod;
@@ -24,10 +26,21 @@ module('Deprecated | Unit | ember-sinon-qunit', {
2426

2527
assertSinonInTestContext(test);
2628

29+
const deprecateStub = sinon.stub(Ember, 'deprecate').callsFake(function (unused, deprecateTest) {
30+
if (deprecateTest !== false) {
31+
throw new Error('Ember.deprecate should be called with 2nd argument `false`');
32+
}
33+
});
34+
2735
test('does not destroy context from beforeEach', function (assert) {
2836
assert.equal(this.foo, fooValue);
2937
});
3038

39+
if (!deprecateStub.called) {
40+
throw new Error('Ember.deprecate should be called');
41+
}
42+
deprecateStub.restore();
43+
3144
test('async with assert.async()', function (assert) {
3245
assert.expect(2);
3346
this.stub(obj, 'method');

0 commit comments

Comments
 (0)