Skip to content

Commit d405fd7

Browse files
authored
Merge pull request #1089 from NullVoxPopuli/remove-hasEmberVersion
Remove hasEmberVersion
2 parents d456685 + b783fb2 commit d405fd7

File tree

4 files changed

+1
-61
lines changed

4 files changed

+1
-61
lines changed

addon-test-support/adapter.js

-40
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,5 @@
11
import Ember from 'ember';
22
import * as QUnit from 'qunit';
3-
import hasEmberVersion from '@ember/test-helpers/has-ember-version';
4-
5-
function unhandledRejectionAssertion(current, error) {
6-
let message, source;
7-
8-
if (typeof error === 'object' && error !== null) {
9-
message = error.message;
10-
source = error.stack;
11-
} else if (typeof error === 'string') {
12-
message = error;
13-
source = 'unknown source';
14-
} else {
15-
message = 'unhandledRejection occurred, but it had no message';
16-
source = 'unknown source';
17-
}
18-
19-
current.assert.pushResult({
20-
result: false,
21-
actual: false,
22-
expected: true,
23-
message: message,
24-
source: source,
25-
});
26-
}
273

284
export function nonTestDoneCallback() {}
295

@@ -59,22 +35,6 @@ let Adapter = Ember.Test.Adapter.extend({
5935
done();
6036
}
6137
},
62-
63-
// clobber default implementation of `exception` will be added back for Ember
64-
// < 2.17 just below...
65-
exception: null,
6638
});
6739

68-
// Ember 2.17 and higher do not require the test adapter to have an `exception`
69-
// method When `exception` is not present, the unhandled rejection is
70-
// automatically re-thrown and will therefore hit QUnit's own global error
71-
// handler (therefore appropriately causing test failure)
72-
if (!hasEmberVersion(2, 17)) {
73-
Adapter = Adapter.extend({
74-
exception(error) {
75-
unhandledRejectionAssertion(QUnit.config.current, error);
76-
},
77-
});
78-
}
79-
8040
export default Adapter;

tests/acceptance/basic-test.js

-5
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,8 @@ import {
1010
click,
1111
} from '@ember/test-helpers';
1212
import { setResolverRegistry } from '../helpers/resolver';
13-
import hasEmberVersion from '@ember/test-helpers/has-ember-version';
1413

1514
module('setupApplicationTest tests', function (hooks) {
16-
if (!hasEmberVersion(2, 4)) {
17-
return;
18-
}
19-
2015
const Router = EmberRouter.extend({ location: 'none' });
2116
Router.map(function () {
2217
this.route('widgets');

tests/integration/setup-rendering-test-test.js

-5
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@ import { hbs } from 'ember-cli-htmlbars';
55
import { setupRenderingTest } from 'ember-qunit';
66
import { render } from '@ember/test-helpers';
77
import { setResolverRegistry } from '../helpers/resolver';
8-
import hasEmberVersion from '@ember/test-helpers/has-ember-version';
98

109
module('setupRenderingTest tests', function (hooks) {
11-
if (!hasEmberVersion(2, 4)) {
12-
return;
13-
}
14-
1510
hooks.beforeEach(function () {
1611
setResolverRegistry({});
1712
});

tests/integration/setup-test-test.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@ import { module, test } from 'qunit';
22
import Service, { inject as injectService } from '@ember/service';
33
import Component from '@ember/component';
44
import { setupTest } from 'ember-qunit';
5-
import hasEmberVersion from '@ember/test-helpers/has-ember-version';
65
import { setResolverRegistry } from '../helpers/resolver';
76

87
module('setupTest tests', function (hooks) {
9-
if (!hasEmberVersion(2, 4)) {
10-
return;
11-
}
12-
138
hooks.beforeEach(function () {
149
setResolverRegistry({});
1510
});
@@ -63,12 +58,7 @@ module('setupTest tests', function (hooks) {
6358
})
6459
);
6560

66-
let subject;
67-
if (hasEmberVersion(2, 12)) {
68-
subject = this.owner.lookup('component:foo-bar');
69-
} else {
70-
subject = this.owner._lookupFactory('component:foo-bar').create();
71-
}
61+
let subject = this.owner.lookup('component:foo-bar');
7262

7363
assert.equal(subject.someMethod(), 'hello thar!');
7464
});

0 commit comments

Comments
 (0)