-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
27eee0c
commit 2a632cd
Showing
18 changed files
with
332 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
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
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,47 @@ | ||
'use strict'; | ||
|
||
const blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); | ||
const setupTestHooks = blueprintHelpers.setupTestHooks; | ||
const emberNew = blueprintHelpers.emberNew; | ||
const emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; | ||
const modifyPackages = blueprintHelpers.modifyPackages; | ||
|
||
const expect = require('ember-cli-blueprint-test-helpers/chai').expect; | ||
|
||
const fixture = require('../helpers/fixture'); | ||
|
||
describe('Acceptance: ember generate and destroy feature', function() { | ||
setupTestHooks(this); | ||
|
||
beforeEach(function() { | ||
return emberNew(); | ||
}); | ||
|
||
[ | ||
'qunit', | ||
'mocha' | ||
].forEach((testFramework) => { | ||
|
||
describe(testFramework, function() { | ||
|
||
if (testFramework === 'mocha') { | ||
beforeEach(function() { | ||
return modifyPackages([ | ||
{ name: 'ember-cli-qunit', delete: true }, | ||
{ name: 'ember-cli-mocha', dev: true } | ||
]); | ||
}); | ||
} | ||
|
||
it('feature foo', function() { | ||
let args = ['feature', 'foo']; | ||
|
||
// pass any additional command line options in the arguments array | ||
return emberGenerateDestroy(args, (file) => { | ||
expect(file('tests/acceptance/foo.feature')).to.equal(fixture('acceptance/foo.feature')); | ||
expect(file('tests/acceptance/steps/foo-steps.js')).to.equal(fixture(`acceptance/${testFramework}/foo-steps.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,53 @@ | ||
'use strict'; | ||
|
||
const blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); | ||
const setupTestHooks = blueprintHelpers.setupTestHooks; | ||
const emberNew = blueprintHelpers.emberNew; | ||
const emberGenerate = blueprintHelpers.emberGenerate; | ||
const modifyPackages = blueprintHelpers.modifyPackages; | ||
|
||
const chai = require('ember-cli-blueprint-test-helpers/chai'); | ||
const expect = chai.expect; | ||
const file = chai.file; | ||
|
||
const fixture = require('../helpers/fixture'); | ||
|
||
describe('Acceptance: ember generate ember-cli-yadda', function() { | ||
setupTestHooks(this); | ||
|
||
beforeEach(function() { | ||
return emberNew(); | ||
}); | ||
|
||
[ | ||
'qunit', | ||
'mocha' | ||
].forEach((testFramework) => { | ||
|
||
describe(testFramework, function() { | ||
|
||
if (testFramework === 'mocha') { | ||
beforeEach(function() { | ||
return modifyPackages([ | ||
{ name: 'ember-cli-qunit', delete: true }, | ||
{ name: 'ember-cli-mocha', dev: true } | ||
]); | ||
}); | ||
} | ||
|
||
it('adds required files', function() { | ||
let args = ['ember-cli-yadda']; | ||
|
||
let fixtureFiles = [ | ||
'helpers/yadda.js', | ||
'helpers/yadda-annotations.js', | ||
// 'unit/steps/steps.js', | ||
'acceptance/steps/steps.js', | ||
]; | ||
|
||
return emberGenerate(args) | ||
.then(() => fixtureFiles.forEach((fileName) => expect(file(`tests/${fileName}`)).to.equal(fixture(`main/${testFramework}/${fileName}`)))); | ||
}); | ||
}); | ||
}); | ||
}); |
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,7 @@ | ||
Feature: foo | ||
|
||
Scenario: the one where I type ember g feature | ||
|
||
Given I type "Ember g feature make-feature" | ||
When I look in the folder | ||
Then I should find a file |
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 steps from './steps'; | ||
|
||
// step definitions that are shared between features should be moved to the | ||
// tests/acceptance/steps/steps.js file | ||
|
||
export default function() { | ||
return steps() | ||
.then('I should find a file', function(next) { | ||
// Add your own assert library | ||
next(); | ||
}); | ||
} |
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 steps from './steps'; | ||
|
||
// step definitions that are shared between features should be moved to the | ||
// tests/acceptance/steps/steps.js file | ||
|
||
export default function(assert) { | ||
return steps(assert) | ||
.then('I should find a file', function(next) { | ||
assert.ok(true, this.step); | ||
next(); | ||
}); | ||
} |
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,14 @@ | ||
import yadda from '../../helpers/yadda'; | ||
|
||
export default function() { | ||
return yadda.localisation.English.library() | ||
.given('I type "Ember g feature make-feature"', function(next) { | ||
visit('/'); | ||
// Add your own assert library | ||
andThen(() => next()); | ||
}) | ||
.when('I look in the folder', function(next) { | ||
// Add your own assert library | ||
next(); | ||
}); | ||
} |
61 changes: 61 additions & 0 deletions
61
node-tests/fixtures/main/mocha/helpers/yadda-annotations.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,61 @@ | ||
import ENV from '../../config/environment'; | ||
import { describe } from 'mocha'; | ||
import Ember from 'ember'; | ||
|
||
// this logic could be anything, but in this case... | ||
// if @ignore, then return skip (for backwards compatibility) | ||
// if no annotations are set in the config, run everything without an annotation (for backwards compatibility) | ||
// if have annotations in config, then only run those that have a matching annotation | ||
function checkAnnotations(annotations) { | ||
|
||
// if ignore is set then we want to skip for backwards compatibility | ||
if (annotations.ignore) { | ||
return ignoreIt; | ||
} | ||
|
||
// if have annotations set in config, the only run those that have a matching annotation | ||
if (ENV.annotations && ENV.annotations.length >= 0) { | ||
|
||
for (let annotation in annotations) { | ||
if (ENV.annotations.indexOf(annotation) >= 0) { | ||
// have match, so test it | ||
return 'testIt'; // return something other than a function | ||
} | ||
} | ||
|
||
// no match, so don't run it | ||
return logIt; | ||
|
||
} else { | ||
// no annotations set, so run it for backwards compatibility | ||
// unless it has annotations, then don't run it | ||
if (Object.keys(annotations).length) { | ||
// has annotation, so don't run it | ||
return logIt; | ||
} else { | ||
// no annotations, so test it | ||
return 'testIt'; // return something other than a function | ||
} | ||
} | ||
} | ||
|
||
// call back functions | ||
function ignoreIt(testElement) { | ||
describe.skip(`${testElement.title}`, () => {}); | ||
} | ||
|
||
function logIt(testElement) { | ||
// change this to do what you need it to do | ||
Ember.Logger.info(`Not running or skipping: "${testElement.title}"`); | ||
} | ||
|
||
// exported functions | ||
function runFeature(annotations) { | ||
return checkAnnotations(annotations); | ||
} | ||
|
||
function runScenario(featureAnnotations, scenarioAnnotations) { | ||
return checkAnnotations(scenarioAnnotations); | ||
} | ||
|
||
export { runFeature, runScenario }; |
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,2 @@ | ||
import yadda from 'npm:yadda'; | ||
export default yadda; |
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,14 @@ | ||
import yadda from '../../helpers/yadda'; | ||
|
||
export default function(assert) { | ||
return yadda.localisation.English.library() | ||
.given('I type "Ember g feature make-feature"', function(next) { | ||
visit('/'); | ||
assert.ok(true, this.step); | ||
andThen(() => next()); | ||
}) | ||
.when('I look in the folder', function(next) { | ||
assert.ok(true, this.step); | ||
next(); | ||
}); | ||
} |
60 changes: 60 additions & 0 deletions
60
node-tests/fixtures/main/qunit/helpers/yadda-annotations.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,60 @@ | ||
import ENV from '../../config/environment'; | ||
import { skip } from 'ember-qunit'; | ||
import Ember from 'ember'; | ||
|
||
// this logic could be anything, but in this case... | ||
// if @ignore, then return skip (for backwards compatibility) | ||
// if no annotations are set in the config, run everything without an annotation (for backwards compatibility) | ||
// if have annotations in config, then only run those that have a matching annotation | ||
function checkAnnotations(annotations) { | ||
|
||
// if ignore is set then we want to skip for backwards compatibility | ||
if (annotations.ignore) { | ||
return ignoreIt; | ||
} | ||
|
||
// if have annotations set in config, the only run those that have a matching annotation | ||
if (ENV.annotations && ENV.annotations.length >= 0) { | ||
|
||
for (let annotation in annotations) { | ||
if (ENV.annotations.indexOf(annotation) >= 0) { | ||
// have match, so test it | ||
return 'testIt'; // return something other than a function | ||
} | ||
} | ||
|
||
// no match, so don't run it | ||
return logIt; | ||
|
||
} else { | ||
// no annotations set, so run it for backwards compatibility | ||
// unless it has annotations, then don't run it | ||
if (Object.keys(annotations).length) { | ||
// has annotation, so don't run it | ||
return logIt; | ||
} else { | ||
// no annotations, so test it | ||
return 'testIt'; // return something other than a function | ||
} | ||
} | ||
} | ||
|
||
// call back functions | ||
function ignoreIt(testElement) { | ||
skip(`${testElement.title}`, function(assert) {}); | ||
} | ||
|
||
function logIt(testElement) { | ||
Ember.Logger.info(`Not running or skipping: "${testElement.title}"`); | ||
} | ||
|
||
// exported functions | ||
function runFeature(annotations) { | ||
return checkAnnotations(annotations); | ||
} | ||
|
||
function runScenario(featureAnnotations, scenarioAnnotations) { | ||
return checkAnnotations(scenarioAnnotations); | ||
} | ||
|
||
export { runFeature, runScenario }; |
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,2 @@ | ||
import yadda from 'npm:yadda'; | ||
export default yadda; |
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,13 @@ | ||
import yadda from '../../helpers/yadda'; | ||
|
||
export default function(assert) { | ||
return yadda.localisation.English.library() | ||
.given('I type "Ember g feature make-feature"', function(next){ | ||
assert.ok(true, this.step); | ||
next(); | ||
}) | ||
.when('I look in the folder', function(next){ | ||
assert.ok(true, this.step); | ||
next(); | ||
}); | ||
} |
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,8 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const file = require('ember-cli-blueprint-test-helpers/chai').file; | ||
|
||
module.exports = function(filePath) { | ||
return file(path.join(__dirname, '../fixtures', filePath)); | ||
}; |
Oops, something went wrong.