-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
blueprints/adapter-test: Add RFC232 variants #5296
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
blueprints/adapter-test/qunit-rfc-232-files/tests/unit/__path__/__test__.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupTest } from 'ember-qunit'; | ||
|
||
module('adapter:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', function(hooks) { | ||
setupTest(hooks); | ||
|
||
// Replace this with your real tests. | ||
test('it exists', function(assert) { | ||
let adapter = this.owner.lookup('adapter:<%= dasherizedModuleName %>'); | ||
assert.ok(adapter); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,25 +18,28 @@ const fixture = require('../helpers/fixture'); | |
describe('Acceptance: generate and destroy adapter blueprints', function() { | ||
setupTestHooks(this); | ||
|
||
beforeEach(function() { | ||
return emberNew(); | ||
}); | ||
|
||
|
||
it('adapter', function() { | ||
let args = ['adapter', 'foo']; | ||
|
||
return emberNew() | ||
.then(() => emberGenerateDestroy(args, _file => { | ||
return emberGenerateDestroy(args, _file => { | ||
expect(_file('app/adapters/foo.js')) | ||
.to.contain('import DS from \'ember-data\';') | ||
.to.contain('export default DS.JSONAPIAdapter.extend({'); | ||
|
||
expect(_file('tests/unit/adapters/foo-test.js')) | ||
.to.equal(fixture('adapter-test/foo-default.js')); | ||
})); | ||
}); | ||
}); | ||
|
||
it('adapter extends application adapter if it exists', function() { | ||
let args = ['adapter', 'foo']; | ||
|
||
return emberNew() | ||
.then(() => emberGenerate(['adapter', 'application'])) | ||
return emberGenerate(['adapter', 'application']) | ||
.then(() => emberGenerateDestroy(args, _file => { | ||
expect(_file('app/adapters/foo.js')) | ||
.to.contain('import ApplicationAdapter from \'./application\';') | ||
|
@@ -50,61 +53,76 @@ describe('Acceptance: generate and destroy adapter blueprints', function() { | |
it('adapter with --base-class', function() { | ||
let args = ['adapter', 'foo', '--base-class=bar']; | ||
|
||
return emberNew() | ||
.then(() => emberGenerateDestroy(args, _file => { | ||
return emberGenerateDestroy(args, _file => { | ||
expect(_file('app/adapters/foo.js')) | ||
.to.contain('import BarAdapter from \'./bar\';') | ||
.to.contain('export default BarAdapter.extend({'); | ||
|
||
expect(_file('tests/unit/adapters/foo-test.js')) | ||
.to.equal(fixture('adapter-test/foo-default.js')); | ||
})); | ||
}); | ||
}); | ||
|
||
xit('adapter throws when --base-class is same as name', function() { | ||
let args = ['adapter', 'foo', '--base-class=foo']; | ||
|
||
return emberNew() | ||
.then(() => expect(emberGenerate(args)) | ||
.to.be.rejectedWith(SilentError, /Adapters cannot extend from themself/)); | ||
return expect(emberGenerate(args)) | ||
.to.be.rejectedWith(SilentError, /Adapters cannot extend from themself/); | ||
}); | ||
|
||
it('adapter when is named "application"', function() { | ||
let args = ['adapter', 'application']; | ||
|
||
return emberNew() | ||
.then(() => emberGenerateDestroy(args, _file => { | ||
return emberGenerateDestroy(args, _file => { | ||
expect(_file('app/adapters/application.js')) | ||
.to.contain('import DS from \'ember-data\';') | ||
.to.contain('export default DS.JSONAPIAdapter.extend({'); | ||
|
||
expect(_file('tests/unit/adapters/application-test.js')) | ||
.to.equal(fixture('adapter-test/application-default.js')); | ||
})); | ||
}); | ||
}); | ||
|
||
it('adapter-test', function() { | ||
let args = ['adapter-test', 'foo']; | ||
|
||
return emberNew() | ||
.then(() => emberGenerateDestroy(args, _file => { | ||
return emberGenerateDestroy(args, _file => { | ||
expect(_file('tests/unit/adapters/foo-test.js')) | ||
.to.equal(fixture('adapter-test/foo-default.js')); | ||
})); | ||
}); | ||
}); | ||
|
||
it('adapter-test for mocha v0.12+', function() { | ||
let args = ['adapter-test', 'foo']; | ||
describe('adapter-test with [email protected]', function() { | ||
beforeEach(function() { | ||
generateFakePackageManifest('ember-cli-qunit', '4.2.0'); | ||
}); | ||
|
||
return emberNew() | ||
.then(() => modifyPackages([ | ||
{name: 'ember-cli-qunit', delete: true}, | ||
{name: 'ember-cli-mocha', dev: true} | ||
])) | ||
.then(() => generateFakePackageManifest('ember-cli-mocha', '0.12.0')) | ||
.then(() => emberGenerateDestroy(args, _file => { | ||
it('adapter-test-test foo', function() { | ||
return emberGenerateDestroy(['adapter-test', 'foo'], _file => { | ||
expect(_file('tests/unit/adapters/foo-test.js')) | ||
.to.equal(fixture('adapter-test/foo-mocha-0.12.js')); | ||
})); | ||
.to.equal(fixture('adapter-test/rfc232.js')); | ||
}); | ||
}); | ||
}); | ||
|
||
|
||
describe('with ember-cli-mocha v0.12+', function() { | ||
beforeEach(function() { | ||
modifyPackages([ | ||
{ name: 'ember-cli-qunit', delete: true }, | ||
{ name: 'ember-cli-mocha', dev: true } | ||
]); | ||
generateFakePackageManifest('ember-cli-mocha', '0.12.0'); | ||
}); | ||
|
||
it('adapter-test for mocha v0.12+', function() { | ||
let args = ['adapter-test', 'foo']; | ||
|
||
return emberGenerateDestroy(args, _file => { | ||
expect(_file('tests/unit/adapters/foo-test.js')) | ||
.to.equal(fixture('adapter-test/foo-mocha-0.12.js')); | ||
}); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupTest } from 'ember-qunit'; | ||
|
||
module('adapter:foo', 'Unit | Adapter | foo', function(hooks) { | ||
setupTest(hooks); | ||
|
||
// Replace this with your real tests. | ||
test('it exists', function(assert) { | ||
let adapter = this.owner.lookup('adapter:foo'); | ||
assert.ok(adapter); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should not be three arguments here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated... sorry about that..