Skip to content

Commit

Permalink
fix(ember): Fix auto-register and add tests to cover
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmit committed Aug 14, 2018
1 parent 66ecd8b commit 24c15bd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/@pollyjs/ember/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@ module.exports = {
},

contentFor(name) {
if (name !== 'body-footer' || !this._config.enabled) {
if (name !== 'app-prefix' || !this._config.enabled) {
return;
}

return `
<script type="text/javascript">
(function() {
'use strict';
require('@pollyjs/ember/-private/preconfigure');
})();
</script>
(function() {
'use strict';
require('@pollyjs/ember/-private/preconfigure');
})();
`;
},

Expand Down
14 changes: 14 additions & 0 deletions packages/@pollyjs/ember/tests/unit/polly-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,18 @@ module('Unit | Polly | General', function() {
assert.equal(typeof Timing.relative, 'function');
});
});

module('auto-registers', function() {
test('adapters', async function(assert) {
const polly = new Polly('adapters');
assert.equal(polly.adapters.size, 2);
await polly.stop();
});

test('persister', async function(assert) {
const polly = new Polly('persister');
assert.equal(typeof polly.persister, 'object');
await polly.stop();
});
});
});

0 comments on commit 24c15bd

Please sign in to comment.